code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void terminated(Pipe pipe) { // Remove the pipe from the list; adjust number of matching, active and/or // eligible pipes accordingly. if (pipes.indexOf(pipe) < matching) { Collections.swap(pipes, pipes.indexOf(pipe), matching - 1); matching--; } if (pipes.indexOf(pipe) < active) { Collections.swap(pipes, pipes.indexOf(pipe), active - 1); active--; } if (pipes.indexOf(pipe) < eligible) { Collections.swap(pipes, pipes.indexOf(pipe), eligible - 1); eligible--; } pipes.remove(pipe); } }
public class class_name { public void terminated(Pipe pipe) { // Remove the pipe from the list; adjust number of matching, active and/or // eligible pipes accordingly. if (pipes.indexOf(pipe) < matching) { Collections.swap(pipes, pipes.indexOf(pipe), matching - 1); // depends on control dependency: [if], data = [none] matching--; // depends on control dependency: [if], data = [none] } if (pipes.indexOf(pipe) < active) { Collections.swap(pipes, pipes.indexOf(pipe), active - 1); // depends on control dependency: [if], data = [none] active--; // depends on control dependency: [if], data = [none] } if (pipes.indexOf(pipe) < eligible) { Collections.swap(pipes, pipes.indexOf(pipe), eligible - 1); // depends on control dependency: [if], data = [none] eligible--; // depends on control dependency: [if], data = [none] } pipes.remove(pipe); } }
public class class_name { public Movie setVolume(final double volume) { getAttributes().setVolume(volume); if (null != m_video) { m_video.setVolume(getVolume()); } return this; } }
public class class_name { public Movie setVolume(final double volume) { getAttributes().setVolume(volume); if (null != m_video) { m_video.setVolume(getVolume()); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { @Override public void update(double extrp, int x, int y, double speed) { data.setOffsetY(y); for (int i = 0; i < cloudsNumber; i++) { this.x[i] += this.speed[i] * extrp; this.x[i] = UtilMath.wrapDouble(this.x[i], 0.0, sprite.getWidth()); } } }
public class class_name { @Override public void update(double extrp, int x, int y, double speed) { data.setOffsetY(y); for (int i = 0; i < cloudsNumber; i++) { this.x[i] += this.speed[i] * extrp; // depends on control dependency: [for], data = [i] this.x[i] = UtilMath.wrapDouble(this.x[i], 0.0, sprite.getWidth()); // depends on control dependency: [for], data = [i] } } }
public class class_name { @SuppressWarnings("rawtypes") public Set zrangeByScore(Object key, double min, double max) { Jedis jedis = getJedis(); try { Set<byte[]> data = jedis.zrangeByScore(keyToBytes(key), min, max); Set<Object> result = new LinkedHashSet<Object>(); // 有序集合必须 LinkedHashSet valueSetFromBytesSet(data, result); return result; } finally {close(jedis);} } }
public class class_name { @SuppressWarnings("rawtypes") public Set zrangeByScore(Object key, double min, double max) { Jedis jedis = getJedis(); try { Set<byte[]> data = jedis.zrangeByScore(keyToBytes(key), min, max); Set<Object> result = new LinkedHashSet<Object>(); // 有序集合必须 LinkedHashSet valueSetFromBytesSet(data, result); // depends on control dependency: [try], data = [none] return result; // depends on control dependency: [try], data = [none] } finally {close(jedis);} } }
public class class_name { public HashAlgorithmOptions withAllowedValues(HashAlgorithm... allowedValues) { java.util.ArrayList<String> allowedValuesCopy = new java.util.ArrayList<String>(allowedValues.length); for (HashAlgorithm value : allowedValues) { allowedValuesCopy.add(value.toString()); } if (getAllowedValues() == null) { setAllowedValues(allowedValuesCopy); } else { getAllowedValues().addAll(allowedValuesCopy); } return this; } }
public class class_name { public HashAlgorithmOptions withAllowedValues(HashAlgorithm... allowedValues) { java.util.ArrayList<String> allowedValuesCopy = new java.util.ArrayList<String>(allowedValues.length); for (HashAlgorithm value : allowedValues) { allowedValuesCopy.add(value.toString()); // depends on control dependency: [for], data = [value] } if (getAllowedValues() == null) { setAllowedValues(allowedValuesCopy); // depends on control dependency: [if], data = [none] } else { getAllowedValues().addAll(allowedValuesCopy); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public static boolean addResourceToGuvnor(String repLoc, String targetLoc, IFile selectedFile) { boolean res = false; try { String fullPath = targetLoc + selectedFile.getName(); IWebDavClient client = WebDavServerCache.getWebDavClient(repLoc); if (client == null) { client = WebDavClientFactory.createClient(new URL(repLoc)); WebDavServerCache.cacheWebDavClient(repLoc, client); } try { // res = client.createResource(fullPath, selectedFile.getContents(), false); // Hack: When creating a file, if the actual contents are passed first, // the client hangs for about 20 seconds when closing the InputStream. // Don't know why... // But, if the file is created with empty contents, and then the contents // set, the operation is fast (less than a couple of seconds) res = client.createResource(fullPath, new ByteArrayInputStream(new byte[0]), false); if (res) { client.putResource(fullPath, selectedFile.getContents()); } } catch (WebDavException wde) { if (wde.getErrorCode() != IResponse.SC_UNAUTHORIZED) { // If not an authentication failure, we don't know what to do with it throw wde; } boolean retry = PlatformUtils.getInstance(). authenticateForServer(repLoc, client); if (retry) { // res = client.createResource(fullPath, selectedFile.getContents(), false); // See Hack note immediately above... res = client.createResource(fullPath, new ByteArrayInputStream(new byte[0]), false); if (res) { client.putResource(fullPath, selectedFile.getContents()); } } } if (res) { GuvnorMetadataUtils.markCurrentGuvnorResource(selectedFile); ResourceProperties resProps = client.queryProperties(fullPath); GuvnorMetadataProps mdProps = new GuvnorMetadataProps(selectedFile.getName(), repLoc, fullPath, resProps.getLastModifiedDate(), resProps.getRevision()); GuvnorMetadataUtils.setGuvnorMetadataProps(selectedFile.getFullPath(), mdProps); } } catch (Exception e) { Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true); } return res; } }
public class class_name { public static boolean addResourceToGuvnor(String repLoc, String targetLoc, IFile selectedFile) { boolean res = false; try { String fullPath = targetLoc + selectedFile.getName(); IWebDavClient client = WebDavServerCache.getWebDavClient(repLoc); if (client == null) { client = WebDavClientFactory.createClient(new URL(repLoc)); // depends on control dependency: [if], data = [none] WebDavServerCache.cacheWebDavClient(repLoc, client); // depends on control dependency: [if], data = [none] } try { // res = client.createResource(fullPath, selectedFile.getContents(), false); // Hack: When creating a file, if the actual contents are passed first, // the client hangs for about 20 seconds when closing the InputStream. // Don't know why... // But, if the file is created with empty contents, and then the contents // set, the operation is fast (less than a couple of seconds) res = client.createResource(fullPath, new ByteArrayInputStream(new byte[0]), false); // depends on control dependency: [try], data = [none] if (res) { client.putResource(fullPath, selectedFile.getContents()); // depends on control dependency: [if], data = [none] } } catch (WebDavException wde) { if (wde.getErrorCode() != IResponse.SC_UNAUTHORIZED) { // If not an authentication failure, we don't know what to do with it throw wde; } boolean retry = PlatformUtils.getInstance(). authenticateForServer(repLoc, client); if (retry) { // res = client.createResource(fullPath, selectedFile.getContents(), false); // See Hack note immediately above... res = client.createResource(fullPath, new ByteArrayInputStream(new byte[0]), false); // depends on control dependency: [if], data = [none] if (res) { client.putResource(fullPath, selectedFile.getContents()); // depends on control dependency: [if], data = [none] } } } // depends on control dependency: [catch], data = [none] if (res) { GuvnorMetadataUtils.markCurrentGuvnorResource(selectedFile); // depends on control dependency: [if], data = [none] ResourceProperties resProps = client.queryProperties(fullPath); GuvnorMetadataProps mdProps = new GuvnorMetadataProps(selectedFile.getName(), repLoc, fullPath, resProps.getLastModifiedDate(), resProps.getRevision()); GuvnorMetadataUtils.setGuvnorMetadataProps(selectedFile.getFullPath(), mdProps); // depends on control dependency: [if], data = [none] } } catch (Exception e) { Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true); } // depends on control dependency: [catch], data = [none] return res; } }
public class class_name { public boolean mergeEffects(String expr, Effect[] effects, float[] results) { boolean result; if (expr.equals("some(where (p_eft == allow))")) { result = false; for (Effect eft : effects) { if (eft == Effect.Allow) { result = true; break; } } } else if (expr.equals("!some(where (p_eft == deny))")) { result = true; for (Effect eft : effects) { if (eft == Effect.Deny) { result = false; break; } } } else if (expr.equals("some(where (p_eft == allow)) && !some(where (p_eft == deny))")) { result = false; for (Effect eft : effects) { if (eft == Effect.Allow) { result = true; } else if (eft == Effect.Deny) { result = false; break; } } } else if (expr.equals("priority(p_eft) || deny")) { result = false; for (Effect eft : effects) { if (eft != Effect.Indeterminate) { if (eft == Effect.Allow) { result = true; } else { result = false; } break; } } } else { throw new Error("unsupported effect"); } return result; } }
public class class_name { public boolean mergeEffects(String expr, Effect[] effects, float[] results) { boolean result; if (expr.equals("some(where (p_eft == allow))")) { result = false; // depends on control dependency: [if], data = [none] for (Effect eft : effects) { if (eft == Effect.Allow) { result = true; // depends on control dependency: [if], data = [none] break; } } } else if (expr.equals("!some(where (p_eft == deny))")) { result = true; // depends on control dependency: [if], data = [none] for (Effect eft : effects) { if (eft == Effect.Deny) { result = false; // depends on control dependency: [if], data = [none] break; } } } else if (expr.equals("some(where (p_eft == allow)) && !some(where (p_eft == deny))")) { result = false; // depends on control dependency: [if], data = [none] for (Effect eft : effects) { if (eft == Effect.Allow) { result = true; // depends on control dependency: [if], data = [none] } else if (eft == Effect.Deny) { result = false; // depends on control dependency: [if], data = [none] break; } } } else if (expr.equals("priority(p_eft) || deny")) { result = false; // depends on control dependency: [if], data = [none] for (Effect eft : effects) { if (eft != Effect.Indeterminate) { if (eft == Effect.Allow) { result = true; // depends on control dependency: [if], data = [none] } else { result = false; // depends on control dependency: [if], data = [none] } break; } } } else { throw new Error("unsupported effect"); } return result; } }
public class class_name { public TableWriteItems withHashAndRangeKeysToDelete( String hashKeyName, String rangeKeyName, Object... alternatingHashAndRangeKeyValues) { if (hashKeyName == null) throw new IllegalArgumentException("hash key name must be specified"); if (rangeKeyName == null) throw new IllegalArgumentException("range key name must be specified"); if (alternatingHashAndRangeKeyValues.length % 2 != 0) throw new IllegalArgumentException("number of hash and range key values must be the same"); final int len = alternatingHashAndRangeKeyValues.length / 2; PrimaryKey[] primaryKeys = new PrimaryKey[len]; for (int i=0; i < alternatingHashAndRangeKeyValues.length; i += 2) { primaryKeys[i >> 1] = new PrimaryKey( hashKeyName, alternatingHashAndRangeKeyValues[i], rangeKeyName, alternatingHashAndRangeKeyValues[i+1]); } return withPrimaryKeysToDelete(primaryKeys); } }
public class class_name { public TableWriteItems withHashAndRangeKeysToDelete( String hashKeyName, String rangeKeyName, Object... alternatingHashAndRangeKeyValues) { if (hashKeyName == null) throw new IllegalArgumentException("hash key name must be specified"); if (rangeKeyName == null) throw new IllegalArgumentException("range key name must be specified"); if (alternatingHashAndRangeKeyValues.length % 2 != 0) throw new IllegalArgumentException("number of hash and range key values must be the same"); final int len = alternatingHashAndRangeKeyValues.length / 2; PrimaryKey[] primaryKeys = new PrimaryKey[len]; for (int i=0; i < alternatingHashAndRangeKeyValues.length; i += 2) { primaryKeys[i >> 1] = new PrimaryKey( hashKeyName, alternatingHashAndRangeKeyValues[i], rangeKeyName, alternatingHashAndRangeKeyValues[i+1]); // depends on control dependency: [for], data = [i] } return withPrimaryKeysToDelete(primaryKeys); } }
public class class_name { static <T, A extends BindingCollectionAdapter<T>> WeakReference<A> createRef(A adapter, ObservableList<T> items, ObservableList.OnListChangedCallback callback) { if (thread == null || !thread.isAlive()) { thread = new PollReferenceThread(); thread.start(); } return new AdapterRef<>(adapter, items, callback); } }
public class class_name { static <T, A extends BindingCollectionAdapter<T>> WeakReference<A> createRef(A adapter, ObservableList<T> items, ObservableList.OnListChangedCallback callback) { if (thread == null || !thread.isAlive()) { thread = new PollReferenceThread(); // depends on control dependency: [if], data = [none] thread.start(); // depends on control dependency: [if], data = [none] } return new AdapterRef<>(adapter, items, callback); } }
public class class_name { private void fireInvitationRejectionListeners(Message message, MUCUser.Decline rejection) { EntityBareJid invitee = rejection.getFrom(); String reason = rejection.getReason(); InvitationRejectionListener[] listeners; synchronized (invitationRejectionListeners) { listeners = new InvitationRejectionListener[invitationRejectionListeners.size()]; invitationRejectionListeners.toArray(listeners); } for (InvitationRejectionListener listener : listeners) { listener.invitationDeclined(invitee, reason, message, rejection); } } }
public class class_name { private void fireInvitationRejectionListeners(Message message, MUCUser.Decline rejection) { EntityBareJid invitee = rejection.getFrom(); String reason = rejection.getReason(); InvitationRejectionListener[] listeners; synchronized (invitationRejectionListeners) { listeners = new InvitationRejectionListener[invitationRejectionListeners.size()]; invitationRejectionListeners.toArray(listeners); } for (InvitationRejectionListener listener : listeners) { listener.invitationDeclined(invitee, reason, message, rejection); // depends on control dependency: [for], data = [listener] } } }
public class class_name { @Override public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); return new CodeSizeEvaluator(mv) { @Override public void visitEnd() { super.visitEnd(); if (getMaxSize() > 64 * 1024) { state = State.FAIL_TOO_LONG; message = "the method " + name + " was too long."; } } }; } }
public class class_name { @Override public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); return new CodeSizeEvaluator(mv) { @Override public void visitEnd() { super.visitEnd(); if (getMaxSize() > 64 * 1024) { state = State.FAIL_TOO_LONG; // depends on control dependency: [if], data = [none] message = "the method " + name + " was too long."; // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { private static void outputFilesDat(File dstDir, Map<String, SortedMap<String, ZoneRules>> allBuiltZones, Set<String> allRegionIds, Set<ZoneRules> allRules, SortedMap<LocalDate, Byte> leapSeconds) { File tzdbFile = new File(dstDir, "TZDB.dat"); tzdbFile.delete(); try { FileOutputStream fos = null; try { fos = new FileOutputStream(tzdbFile); outputTzdbDat(fos, allBuiltZones, allRegionIds, allRules); } finally { if (fos != null) { fos.close(); } } } catch (Exception ex) { System.out.println("Failed: " + ex.toString()); ex.printStackTrace(); System.exit(1); } } }
public class class_name { private static void outputFilesDat(File dstDir, Map<String, SortedMap<String, ZoneRules>> allBuiltZones, Set<String> allRegionIds, Set<ZoneRules> allRules, SortedMap<LocalDate, Byte> leapSeconds) { File tzdbFile = new File(dstDir, "TZDB.dat"); tzdbFile.delete(); try { FileOutputStream fos = null; try { fos = new FileOutputStream(tzdbFile); // depends on control dependency: [try], data = [none] outputTzdbDat(fos, allBuiltZones, allRegionIds, allRules); // depends on control dependency: [try], data = [none] } finally { if (fos != null) { fos.close(); // depends on control dependency: [if], data = [none] } } } catch (Exception ex) { System.out.println("Failed: " + ex.toString()); ex.printStackTrace(); System.exit(1); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @NotNull @SuppressWarnings("unchecked") public <E extends Throwable> Exceptional<T> ifExceptionIs(@NotNull Class<E> throwableClass, @NotNull Consumer<? super E> consumer) { if ( (throwable != null) && (throwableClass.isAssignableFrom(throwable.getClass())) ) { consumer.accept((E) throwable); } return this; } }
public class class_name { @NotNull @SuppressWarnings("unchecked") public <E extends Throwable> Exceptional<T> ifExceptionIs(@NotNull Class<E> throwableClass, @NotNull Consumer<? super E> consumer) { if ( (throwable != null) && (throwableClass.isAssignableFrom(throwable.getClass())) ) { consumer.accept((E) throwable); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public Float getColumnValueAsFloat(final int col) { final Object value = getColumnValue(col); if (value == null) { return null; } return new Float(value.toString()); } }
public class class_name { public Float getColumnValueAsFloat(final int col) { final Object value = getColumnValue(col); if (value == null) { return null; // depends on control dependency: [if], data = [none] } return new Float(value.toString()); } }
public class class_name { public final static <T> Stream<T> jitter(final Stream<T> stream, final long jitterInNanos) { final Iterator<T> it = stream.iterator(); final Random r = new Random(); return Streams.stream(new Iterator<T>() { @Override public boolean hasNext() { return it.hasNext(); } @Override public T next() { final T nextValue = it.next(); try { final long elapsedNanos = (long) (jitterInNanos * r.nextDouble()); final long millis = elapsedNanos / 1000000; final int nanos = (int) (elapsedNanos - millis * 1000000); Thread.sleep(Math.max(0, millis), Math.max(0, nanos)); } catch (final InterruptedException e) { throw ExceptionSoftener.throwSoftenedException(e); } return nextValue; } }); } }
public class class_name { public final static <T> Stream<T> jitter(final Stream<T> stream, final long jitterInNanos) { final Iterator<T> it = stream.iterator(); final Random r = new Random(); return Streams.stream(new Iterator<T>() { @Override public boolean hasNext() { return it.hasNext(); } @Override public T next() { final T nextValue = it.next(); try { final long elapsedNanos = (long) (jitterInNanos * r.nextDouble()); final long millis = elapsedNanos / 1000000; final int nanos = (int) (elapsedNanos - millis * 1000000); Thread.sleep(Math.max(0, millis), Math.max(0, nanos)); // depends on control dependency: [try], data = [none] } catch (final InterruptedException e) { throw ExceptionSoftener.throwSoftenedException(e); } // depends on control dependency: [catch], data = [none] return nextValue; } }); } }
public class class_name { @Override public String modifyObject(String pid, String state, String label, String ownerId, String logMessage) { LOG.debug("start: modifyObject, {}", pid); assertInitialized(); try { MessageContext ctx = context.getMessageContext(); return DateUtility.convertDateToString(m_management .modifyObject(ReadOnlyContext.getSoapContext(ctx), pid, state, label, ownerId, logMessage, null)); } catch (Throwable th) { LOG.error("Error modifying object", th); throw CXFUtility.getFault(th); } finally { LOG.debug("end: modifyObject, {}", pid); } } }
public class class_name { @Override public String modifyObject(String pid, String state, String label, String ownerId, String logMessage) { LOG.debug("start: modifyObject, {}", pid); assertInitialized(); try { MessageContext ctx = context.getMessageContext(); return DateUtility.convertDateToString(m_management .modifyObject(ReadOnlyContext.getSoapContext(ctx), pid, state, label, ownerId, logMessage, null)); // depends on control dependency: [try], data = [none] } catch (Throwable th) { LOG.error("Error modifying object", th); throw CXFUtility.getFault(th); } finally { // depends on control dependency: [catch], data = [none] LOG.debug("end: modifyObject, {}", pid); } } }
public class class_name { @Sensitive public static byte[] encodeLTPATokenForWASClassic(Codec codec, @Sensitive byte[] ltpaTokenBytes) { byte[] result = null; try { byte[] innerGSSToken = encodeLTPAToken(codec, ltpaTokenBytes); if (innerGSSToken != null) { result = createGSSToken(codec, LTPAMech.LTPA_OID, innerGSSToken); } } catch (Exception ex) { // do nothing, return null } return result; } }
public class class_name { @Sensitive public static byte[] encodeLTPATokenForWASClassic(Codec codec, @Sensitive byte[] ltpaTokenBytes) { byte[] result = null; try { byte[] innerGSSToken = encodeLTPAToken(codec, ltpaTokenBytes); if (innerGSSToken != null) { result = createGSSToken(codec, LTPAMech.LTPA_OID, innerGSSToken); // depends on control dependency: [if], data = [none] } } catch (Exception ex) { // do nothing, return null } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { private void readChunk() throws IOException { String line = readLine(_in).trim(); int length = Integer.parseInt(line, 16); if (length > 0) { // make sure the chunk will fit into the buffer if (length > _buf.length) { _buf = new byte[length]; } int bytesLeft = length; int reqBytes = 0; int off = 0; int read = 0; /* multiple reads might be necessary to load the entire chunk */ while (bytesLeft != 0) { reqBytes = bytesLeft; read = _in.read(_buf, off, reqBytes); if (read == -1) break; bytesLeft -= read; off += read; } _max = off; _index = 0; } else { // end of data indicated _eof = true; } _in.read(); // skip CR _in.read(); // skip LF } }
public class class_name { private void readChunk() throws IOException { String line = readLine(_in).trim(); int length = Integer.parseInt(line, 16); if (length > 0) { // make sure the chunk will fit into the buffer if (length > _buf.length) { _buf = new byte[length]; // depends on control dependency: [if], data = [none] } int bytesLeft = length; int reqBytes = 0; int off = 0; int read = 0; /* multiple reads might be necessary to load the entire chunk */ while (bytesLeft != 0) { reqBytes = bytesLeft; // depends on control dependency: [while], data = [none] read = _in.read(_buf, off, reqBytes); // depends on control dependency: [while], data = [none] if (read == -1) break; bytesLeft -= read; // depends on control dependency: [while], data = [none] off += read; // depends on control dependency: [while], data = [none] } _max = off; _index = 0; } else { // end of data indicated _eof = true; } _in.read(); // skip CR _in.read(); // skip LF } }
public class class_name { private static String getModuleFolder(String moduleName) { if (moduleName == null) { return null; } CmsModule module = OpenCms.getModuleManager().getModule(moduleName); if (module != null) { for (String resource : module.getResources()) { if (CmsStringUtil.comparePaths("/system/modules/" + moduleName, resource)) { return resource; } } } return null; } }
public class class_name { private static String getModuleFolder(String moduleName) { if (moduleName == null) { return null; // depends on control dependency: [if], data = [none] } CmsModule module = OpenCms.getModuleManager().getModule(moduleName); if (module != null) { for (String resource : module.getResources()) { if (CmsStringUtil.comparePaths("/system/modules/" + moduleName, resource)) { return resource; // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { public T completeAfter(long delay, TimeUnit unit) { Checks.notNull(unit, "TimeUnit"); try { unit.sleep(delay); return complete(); } catch (InterruptedException e) { throw new RuntimeException(e); } } }
public class class_name { public T completeAfter(long delay, TimeUnit unit) { Checks.notNull(unit, "TimeUnit"); try { unit.sleep(delay); // depends on control dependency: [try], data = [none] return complete(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void init(ManageableRepository repository, String workspaceName, BackupConfig config, Calendar timeStamp) { this.repository = repository; this.workspaceName = workspaceName; this.config = config; this.timeStamp = timeStamp; try { url = createStorage(); } catch (FileNotFoundException e) { LOG.error("Full backup initialization failed ", e); notifyError("Full backup initialization failed ", e); } catch (IOException e) { LOG.error("Full backup initialization failed ", e); notifyError("Full backup initialization failed ", e); } } }
public class class_name { public void init(ManageableRepository repository, String workspaceName, BackupConfig config, Calendar timeStamp) { this.repository = repository; this.workspaceName = workspaceName; this.config = config; this.timeStamp = timeStamp; try { url = createStorage(); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException e) { LOG.error("Full backup initialization failed ", e); notifyError("Full backup initialization failed ", e); } // depends on control dependency: [catch], data = [none] catch (IOException e) { LOG.error("Full backup initialization failed ", e); notifyError("Full backup initialization failed ", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <D, J> J toJava(Class<? extends PreferenceTypeAdapter<J, D>> clazz, D value) { @SuppressWarnings("unchecked") PreferenceTypeAdapter<J, D> adapter = cache.get(clazz); if (adapter == null) { adapter = generateAdapter(clazz); } return adapter.toJava(value); } }
public class class_name { public static <D, J> J toJava(Class<? extends PreferenceTypeAdapter<J, D>> clazz, D value) { @SuppressWarnings("unchecked") PreferenceTypeAdapter<J, D> adapter = cache.get(clazz); if (adapter == null) { adapter = generateAdapter(clazz); // depends on control dependency: [if], data = [none] } return adapter.toJava(value); } }
public class class_name { private BufferPool.Buffer getBuffer(final int pos, final boolean forRead) { if ((curBuffer != null) && curBuffer.contains(pos)){ return curBuffer; } for (BufferPool.Buffer b: buffers) { if (forRead) { if (b.contains(pos)) { curBuffer = b; return b; } continue; } if ((b.at(pos))) { curBuffer = b; return b; } } return null; } }
public class class_name { private BufferPool.Buffer getBuffer(final int pos, final boolean forRead) { if ((curBuffer != null) && curBuffer.contains(pos)){ return curBuffer; // depends on control dependency: [if], data = [none] } for (BufferPool.Buffer b: buffers) { if (forRead) { if (b.contains(pos)) { curBuffer = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } continue; } if ((b.at(pos))) { curBuffer = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private void tidyUpMonitoredDirectory(boolean createdDir, File dirToCleanup) { if (createdDir && dirToCleanup != null) { File[] fileListing = dirToCleanup.listFiles(); if (fileListing == null || fileListing.length == 0) { if (!!!dirToCleanup.delete()) { Tr.error(_tc, "MONITOR_DIR_CLEANUP_FAIL", dirToCleanup); } else if (_tc.isDebugEnabled()) { //put the message that we were successful in debug so that we know it worked in automated testing Tr.debug(_tc, "Server deleted the old dropins directory " + dirToCleanup); } } } } }
public class class_name { private void tidyUpMonitoredDirectory(boolean createdDir, File dirToCleanup) { if (createdDir && dirToCleanup != null) { File[] fileListing = dirToCleanup.listFiles(); if (fileListing == null || fileListing.length == 0) { if (!!!dirToCleanup.delete()) { Tr.error(_tc, "MONITOR_DIR_CLEANUP_FAIL", dirToCleanup); // depends on control dependency: [if], data = [none] } else if (_tc.isDebugEnabled()) { //put the message that we were successful in debug so that we know it worked in automated testing Tr.debug(_tc, "Server deleted the old dropins directory " + dirToCleanup); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static int showValidatedTextInputDialog(Window parent, String title, JComponent mainComponent, JTextComponent textComponent, Predicate<String> validInputPredicate) { JButton okButton = new JButton("Ok"); String text = textComponent.getText(); boolean valid = validInputPredicate.test(text); okButton.setEnabled(valid); JButton cancelButton = new JButton("Cancel"); Object[] options = new Object[] { okButton, cancelButton }; JOptionPane optionPane = new JOptionPane(mainComponent, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, okButton); okButton.addActionListener(e -> optionPane.setValue(okButton)); cancelButton.addActionListener(e -> optionPane.setValue(cancelButton)); AncestorListener focussingAncestorListener = new AncestorListener() { @Override public void ancestorAdded(AncestorEvent event) { textComponent.requestFocus(); } @Override public void ancestorRemoved(AncestorEvent event) { // Nothing to do here } @Override public void ancestorMoved(AncestorEvent event) { // Nothing to do here } }; textComponent.addAncestorListener(focussingAncestorListener); DocumentListener documentListener = new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateButtonState(); } @Override public void removeUpdate(DocumentEvent e) { updateButtonState(); } @Override public void changedUpdate(DocumentEvent e) { updateButtonState(); } protected void updateButtonState() { String text = textComponent.getText(); boolean valid = validInputPredicate.test(text); okButton.setEnabled(valid); } }; Document document = textComponent.getDocument(); document.addDocumentListener(documentListener); JDialog dialog = optionPane.createDialog(parent, title); dialog.pack(); dialog.setResizable(true); dialog.setVisible(true); document.removeDocumentListener(documentListener); textComponent.removeAncestorListener(focussingAncestorListener); Object selectedValue = optionPane.getValue(); if (selectedValue == null) { return JOptionPane.CLOSED_OPTION; } return Arrays.asList(options).indexOf(selectedValue); } }
public class class_name { public static int showValidatedTextInputDialog(Window parent, String title, JComponent mainComponent, JTextComponent textComponent, Predicate<String> validInputPredicate) { JButton okButton = new JButton("Ok"); String text = textComponent.getText(); boolean valid = validInputPredicate.test(text); okButton.setEnabled(valid); JButton cancelButton = new JButton("Cancel"); Object[] options = new Object[] { okButton, cancelButton }; JOptionPane optionPane = new JOptionPane(mainComponent, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, okButton); okButton.addActionListener(e -> optionPane.setValue(okButton)); cancelButton.addActionListener(e -> optionPane.setValue(cancelButton)); AncestorListener focussingAncestorListener = new AncestorListener() { @Override public void ancestorAdded(AncestorEvent event) { textComponent.requestFocus(); } @Override public void ancestorRemoved(AncestorEvent event) { // Nothing to do here } @Override public void ancestorMoved(AncestorEvent event) { // Nothing to do here } }; textComponent.addAncestorListener(focussingAncestorListener); DocumentListener documentListener = new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateButtonState(); } @Override public void removeUpdate(DocumentEvent e) { updateButtonState(); } @Override public void changedUpdate(DocumentEvent e) { updateButtonState(); } protected void updateButtonState() { String text = textComponent.getText(); boolean valid = validInputPredicate.test(text); okButton.setEnabled(valid); } }; Document document = textComponent.getDocument(); document.addDocumentListener(documentListener); JDialog dialog = optionPane.createDialog(parent, title); dialog.pack(); dialog.setResizable(true); dialog.setVisible(true); document.removeDocumentListener(documentListener); textComponent.removeAncestorListener(focussingAncestorListener); Object selectedValue = optionPane.getValue(); if (selectedValue == null) { return JOptionPane.CLOSED_OPTION; // depends on control dependency: [if], data = [none] } return Arrays.asList(options).indexOf(selectedValue); } }
public class class_name { protected final IData checkItemIfDeleted(final IData pToCheck) { if (pToCheck == null) { throw new IllegalStateException(new StringBuilder("Data not existing.").toString()); } else if (pToCheck instanceof DeletedData) { return null; } else { return pToCheck; } } }
public class class_name { protected final IData checkItemIfDeleted(final IData pToCheck) { if (pToCheck == null) { throw new IllegalStateException(new StringBuilder("Data not existing.").toString()); } else if (pToCheck instanceof DeletedData) { return null; // depends on control dependency: [if], data = [none] } else { return pToCheck; // depends on control dependency: [if], data = [none] } } }
public class class_name { public final void not_key() throws RecognitionException { Token id=null; try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:808:5: ({...}? =>id= ID ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:808:12: {...}? =>id= ID { if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.NOT)))) ) { if (state.backtracking>0) {state.failed=true; return;} throw new FailedPredicateException(input, "not_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.NOT))"); } id=(Token)match(input,ID,FOLLOW_ID_in_not_key5173); if (state.failed) return; if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public final void not_key() throws RecognitionException { Token id=null; try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:808:5: ({...}? =>id= ID ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:808:12: {...}? =>id= ID { if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.NOT)))) ) { if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] throw new FailedPredicateException(input, "not_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.NOT))"); } id=(Token)match(input,ID,FOLLOW_ID_in_not_key5173); if (state.failed) return; if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); } // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public static boolean isBELScript(final String path) { if (path == null) { return false; } if (path.endsWith(BEL_SCRIPT_EXTENSION)) { return true; } return false; } }
public class class_name { public static boolean isBELScript(final String path) { if (path == null) { return false; // depends on control dependency: [if], data = [none] } if (path.endsWith(BEL_SCRIPT_EXTENSION)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) { // If not security domain is available, or the preferred alias is NULL, // then default to the nested key manager's process for selecting the keystore if (null == domain || domain.getPreferredKeyAlias() == null) { if (LOGGER.isInfoEnabled()) { LOGGER.info("No preferred key alias defined. Defaulting to JSSE certificate selection."); } return parent.chooseClientAlias(keyType, issuers, socket); } String preferredAlias = domain.getPreferredKeyAlias(); String alias = null; if (keyType != null && keyType.length > 0) { for (int i=0; i<keyType.length; i++) { alias = chooseClientAliasForKey(preferredAlias, keyType[i], issuers, socket); if (alias != null && !"".equals(alias)) { if (LOGGER.isInfoEnabled()) { LOGGER.info("Found valid keystore alias: " + alias); } return alias; } } } LOGGER.warn("The requested key alias " + preferredAlias + " was not found in the keystore. No certificate selected. The transaction will probably fail."); return null; } }
public class class_name { public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) { // If not security domain is available, or the preferred alias is NULL, // then default to the nested key manager's process for selecting the keystore if (null == domain || domain.getPreferredKeyAlias() == null) { if (LOGGER.isInfoEnabled()) { LOGGER.info("No preferred key alias defined. Defaulting to JSSE certificate selection."); // depends on control dependency: [if], data = [none] } return parent.chooseClientAlias(keyType, issuers, socket); // depends on control dependency: [if], data = [none] } String preferredAlias = domain.getPreferredKeyAlias(); String alias = null; if (keyType != null && keyType.length > 0) { for (int i=0; i<keyType.length; i++) { alias = chooseClientAliasForKey(preferredAlias, keyType[i], issuers, socket); // depends on control dependency: [for], data = [i] if (alias != null && !"".equals(alias)) { if (LOGGER.isInfoEnabled()) { LOGGER.info("Found valid keystore alias: " + alias); // depends on control dependency: [if], data = [none] } return alias; // depends on control dependency: [if], data = [none] } } } LOGGER.warn("The requested key alias " + preferredAlias + " was not found in the keystore. No certificate selected. The transaction will probably fail."); return null; } }
public class class_name { public void addBorder(int bordersToAdd, int borderStyle, float borderWidth, Color borderColor) { if((bordersToAdd & Rectangle.LEFT) == Rectangle.LEFT) { setBorder(RtfBorder.LEFT_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.TOP) == Rectangle.TOP) { setBorder(RtfBorder.TOP_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.RIGHT) == Rectangle.RIGHT) { setBorder(RtfBorder.RIGHT_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.BOTTOM) == Rectangle.BOTTOM) { setBorder(RtfBorder.BOTTOM_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.BOX) == Rectangle.BOX && this.borderType == RtfBorder.ROW_BORDER) { setBorder(RtfBorder.VERTICAL_BORDER, borderStyle, borderWidth, borderColor); setBorder(RtfBorder.HORIZONTAL_BORDER, borderStyle, borderWidth, borderColor); } } }
public class class_name { public void addBorder(int bordersToAdd, int borderStyle, float borderWidth, Color borderColor) { if((bordersToAdd & Rectangle.LEFT) == Rectangle.LEFT) { setBorder(RtfBorder.LEFT_BORDER, borderStyle, borderWidth, borderColor); // depends on control dependency: [if], data = [none] } if((bordersToAdd & Rectangle.TOP) == Rectangle.TOP) { setBorder(RtfBorder.TOP_BORDER, borderStyle, borderWidth, borderColor); // depends on control dependency: [if], data = [none] } if((bordersToAdd & Rectangle.RIGHT) == Rectangle.RIGHT) { setBorder(RtfBorder.RIGHT_BORDER, borderStyle, borderWidth, borderColor); // depends on control dependency: [if], data = [none] } if((bordersToAdd & Rectangle.BOTTOM) == Rectangle.BOTTOM) { setBorder(RtfBorder.BOTTOM_BORDER, borderStyle, borderWidth, borderColor); // depends on control dependency: [if], data = [none] } if((bordersToAdd & Rectangle.BOX) == Rectangle.BOX && this.borderType == RtfBorder.ROW_BORDER) { setBorder(RtfBorder.VERTICAL_BORDER, borderStyle, borderWidth, borderColor); // depends on control dependency: [if], data = [none] setBorder(RtfBorder.HORIZONTAL_BORDER, borderStyle, borderWidth, borderColor); // depends on control dependency: [if], data = [none] } } }
public class class_name { public java.util.List<String> getDashboardNames() { if (dashboardNames == null) { dashboardNames = new com.amazonaws.internal.SdkInternalList<String>(); } return dashboardNames; } }
public class class_name { public java.util.List<String> getDashboardNames() { if (dashboardNames == null) { dashboardNames = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return dashboardNames; } }
public class class_name { public static void vertical(GrayF64 input, GrayF64 output, int radius, @Nullable DWorkArrays work) { boolean processed = BOverrideConvolveImageMean.invokeNativeVertical(input, output, radius); if( !processed ) { Kernel1D_F64 kernel = FactoryKernel.table1D_F64(radius, true); if (kernel.width > input.height) { ConvolveImageNormalized.vertical(kernel, input, output); } else { InputSanityCheck.checkSameShape(input, output); ConvolveNormalized_JustBorder_SB.vertical(kernel, input, output); if(BoofConcurrency.USE_CONCURRENT) { ImplConvolveMean_MT.vertical(input, output, radius,work); } else { ImplConvolveMean.vertical(input, output, radius,work); } } } } }
public class class_name { public static void vertical(GrayF64 input, GrayF64 output, int radius, @Nullable DWorkArrays work) { boolean processed = BOverrideConvolveImageMean.invokeNativeVertical(input, output, radius); if( !processed ) { Kernel1D_F64 kernel = FactoryKernel.table1D_F64(radius, true); if (kernel.width > input.height) { ConvolveImageNormalized.vertical(kernel, input, output); // depends on control dependency: [if], data = [none] } else { InputSanityCheck.checkSameShape(input, output); // depends on control dependency: [if], data = [none] ConvolveNormalized_JustBorder_SB.vertical(kernel, input, output); // depends on control dependency: [if], data = [none] if(BoofConcurrency.USE_CONCURRENT) { ImplConvolveMean_MT.vertical(input, output, radius,work); // depends on control dependency: [if], data = [none] } else { ImplConvolveMean.vertical(input, output, radius,work); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private List<Match> matchesImpl(List<Entry> desiredLocales, int threshold) { int bestDistance = MAX_DISTANCE; // TreeMap is used to maintain the original ordering captured in the // supportedLocales list. Even though we sort the values before returning, // the stable sort order would change due to passing through a hashing function. Map<String, Match> result = new TreeMap<>(); for (Entry desired : desiredLocales) { List<String> exact = exactMatch.get(desired.locale); if (exact != null) { updateMatch(result, exact.get(0), 0); } for (Entry supported : supportedLocales) { int distance = DISTANCE_TABLE.distance(desired.locale, supported.locale, threshold); if (distance < bestDistance) { updateMatch(result, supported.bundleId, distance); } } } // Stable sort, so an earlier match with equal distance will come first. return result.values().stream() .sorted((a, b) -> Integer.compare(a.distance, b.distance)) .collect(Collectors.toList()); } }
public class class_name { private List<Match> matchesImpl(List<Entry> desiredLocales, int threshold) { int bestDistance = MAX_DISTANCE; // TreeMap is used to maintain the original ordering captured in the // supportedLocales list. Even though we sort the values before returning, // the stable sort order would change due to passing through a hashing function. Map<String, Match> result = new TreeMap<>(); for (Entry desired : desiredLocales) { List<String> exact = exactMatch.get(desired.locale); if (exact != null) { updateMatch(result, exact.get(0), 0); // depends on control dependency: [if], data = [none] } for (Entry supported : supportedLocales) { int distance = DISTANCE_TABLE.distance(desired.locale, supported.locale, threshold); if (distance < bestDistance) { updateMatch(result, supported.bundleId, distance); // depends on control dependency: [if], data = [none] } } } // Stable sort, so an earlier match with equal distance will come first. return result.values().stream() .sorted((a, b) -> Integer.compare(a.distance, b.distance)) .collect(Collectors.toList()); } }
public class class_name { public List<Interceptor<?>> getInterceptors(J2EEName ejbJ2EEName, Method method, InterceptionType interceptionType) { List<Interceptor<?>> interceptors = new ArrayList<Interceptor<?>>(); //find the Interceptor Bindings for the ejb InterceptorBindings ejbInterceptors = allInterceptors.get(ejbJ2EEName); if (ejbInterceptors != null) { //get the method interceptors of the right type org.jboss.weld.interceptor.spi.model.InterceptionType internalInterceptionType = org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType.name()); if (internalInterceptionType.isLifecycleCallback()) { List<Interceptor<?>> lifecycleInterceptors = ejbInterceptors.getLifecycleInterceptors(interceptionType); interceptors.addAll(lifecycleInterceptors); } else { List<Interceptor<?>> methodInterceptors = ejbInterceptors.getMethodInterceptors(interceptionType, method); interceptors.addAll(methodInterceptors); } } return interceptors; } }
public class class_name { public List<Interceptor<?>> getInterceptors(J2EEName ejbJ2EEName, Method method, InterceptionType interceptionType) { List<Interceptor<?>> interceptors = new ArrayList<Interceptor<?>>(); //find the Interceptor Bindings for the ejb InterceptorBindings ejbInterceptors = allInterceptors.get(ejbJ2EEName); if (ejbInterceptors != null) { //get the method interceptors of the right type org.jboss.weld.interceptor.spi.model.InterceptionType internalInterceptionType = org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType.name()); if (internalInterceptionType.isLifecycleCallback()) { List<Interceptor<?>> lifecycleInterceptors = ejbInterceptors.getLifecycleInterceptors(interceptionType); // depends on control dependency: [if], data = [none] interceptors.addAll(lifecycleInterceptors); // depends on control dependency: [if], data = [none] } else { List<Interceptor<?>> methodInterceptors = ejbInterceptors.getMethodInterceptors(interceptionType, method); // depends on control dependency: [if], data = [none] interceptors.addAll(methodInterceptors); // depends on control dependency: [if], data = [none] } } return interceptors; } }
public class class_name { public synchronized void write(ByteBuffer buffer) { if (buffer.hasRemaining()) { _buffers=LazyList.add(_buffers,buffer); this.notify(); } else recycle(buffer); } }
public class class_name { public synchronized void write(ByteBuffer buffer) { if (buffer.hasRemaining()) { _buffers=LazyList.add(_buffers,buffer); // depends on control dependency: [if], data = [none] this.notify(); // depends on control dependency: [if], data = [none] } else recycle(buffer); } }
public class class_name { public void cancel(ScheduledFuture<?> scheduledFuture) { clear(); if (scheduledFuture != null && !scheduledFuture.isDone()) { scheduledFuture.cancel(false); } } }
public class class_name { public void cancel(ScheduledFuture<?> scheduledFuture) { clear(); if (scheduledFuture != null && !scheduledFuture.isDone()) { scheduledFuture.cancel(false); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String repeat(final String source, int count) { StringBand result = new StringBand(count); while (count > 0) { result.append(source); count--; } return result.toString(); } }
public class class_name { public static String repeat(final String source, int count) { StringBand result = new StringBand(count); while (count > 0) { result.append(source); // depends on control dependency: [while], data = [none] count--; // depends on control dependency: [while], data = [none] } return result.toString(); } }
public class class_name { public ChooserDialog withOnLastBackPressedListener(OnBackPressedListener listener) { if (this._onBackPressed instanceof defBackPressed) { ((defBackPressed) this._onBackPressed)._onLastBackPressed = listener; } return this; } }
public class class_name { public ChooserDialog withOnLastBackPressedListener(OnBackPressedListener listener) { if (this._onBackPressed instanceof defBackPressed) { ((defBackPressed) this._onBackPressed)._onLastBackPressed = listener; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public static void removeFromParent(@NonNull final View view) { Condition.INSTANCE.ensureNotNull(view, "The view may not be null"); ViewParent parent = view.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(view); } } }
public class class_name { public static void removeFromParent(@NonNull final View view) { Condition.INSTANCE.ensureNotNull(view, "The view may not be null"); ViewParent parent = view.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(view); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void handleUrlActivated(HyperlinkEvent e, URL url) { try { Desktop.getDesktop().browse(url.toURI()); } catch (Exception ex) { throw new ApplicationException("Error handling URL " + url, ex); } } }
public class class_name { protected void handleUrlActivated(HyperlinkEvent e, URL url) { try { Desktop.getDesktop().browse(url.toURI()); // depends on control dependency: [try], data = [none] } catch (Exception ex) { throw new ApplicationException("Error handling URL " + url, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Modified(id = "exporterServices") void modifiedExporterService(ServiceReference<ExporterService> serviceReference) { try { exportersManager.modified(serviceReference); } catch (InvalidFilterException invalidFilterException) { LOG.error("The ServiceProperty \"" + TARGET_FILTER_PROPERTY + "\" of the ExporterService " + bundleContext.getService(serviceReference) + " doesn't provides a valid Filter." + " To be used, it must provides a correct \"" + TARGET_FILTER_PROPERTY + "\" ServiceProperty.", invalidFilterException ); exportersManager.removeLinks(serviceReference); return; } if (exportersManager.matched(serviceReference)) { exportersManager.updateLinks(serviceReference); } else { exportersManager.removeLinks(serviceReference); } } }
public class class_name { @Modified(id = "exporterServices") void modifiedExporterService(ServiceReference<ExporterService> serviceReference) { try { exportersManager.modified(serviceReference); // depends on control dependency: [try], data = [none] } catch (InvalidFilterException invalidFilterException) { LOG.error("The ServiceProperty \"" + TARGET_FILTER_PROPERTY + "\" of the ExporterService " + bundleContext.getService(serviceReference) + " doesn't provides a valid Filter." + " To be used, it must provides a correct \"" + TARGET_FILTER_PROPERTY + "\" ServiceProperty.", invalidFilterException ); exportersManager.removeLinks(serviceReference); return; } // depends on control dependency: [catch], data = [none] if (exportersManager.matched(serviceReference)) { exportersManager.updateLinks(serviceReference); // depends on control dependency: [if], data = [none] } else { exportersManager.removeLinks(serviceReference); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void install(Application app, IWicketJquerySelectorsSettings settings) { final IWicketJquerySelectorsSettings existingSettings = settings(app); if (existingSettings == null) { if (settings == null) { settings = new WicketJquerySelectorsSettings(); } app.setMetaData(JQUERY_SELECTORS_SETTINGS_METADATA_KEY, settings); LOG.info("initialize wicket jquery selectors with given settings: {}", settings); } } }
public class class_name { public static void install(Application app, IWicketJquerySelectorsSettings settings) { final IWicketJquerySelectorsSettings existingSettings = settings(app); if (existingSettings == null) { if (settings == null) { settings = new WicketJquerySelectorsSettings(); // depends on control dependency: [if], data = [none] } app.setMetaData(JQUERY_SELECTORS_SETTINGS_METADATA_KEY, settings); // depends on control dependency: [if], data = [none] LOG.info("initialize wicket jquery selectors with given settings: {}", settings); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public double membership(double x) { if (Double.isNaN(x)) { return Double.NaN; } double mu = 0.0; for (Activated term : this.terms) { mu = this.aggregation.compute(mu, term.membership(x)); } return mu; } }
public class class_name { @Override public double membership(double x) { if (Double.isNaN(x)) { return Double.NaN; // depends on control dependency: [if], data = [none] } double mu = 0.0; for (Activated term : this.terms) { mu = this.aggregation.compute(mu, term.membership(x)); // depends on control dependency: [for], data = [term] } return mu; } }
public class class_name { @Override public void setToBeDeleted() { super.setToBeDeleted(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setToBeDeleted"); // If there are durable subscriptions associated with the TopicSpace that is to be deleted // then we dereference them at this stage. This will remove entries from the matchspace. synchronized (_consumerDispatchersDurable) { // Iterate over the table of durable subscriptions. Iterator<Object> iter = _consumerDispatchersDurable.values().iterator(); while (iter.hasNext()) { Object obj = iter.next(); // May not be a ConsumerDispatcher instance. eg may be a PendingDurableDelete object. if (obj instanceof ConsumerDispatcher) { ConsumerDispatcher cd = (ConsumerDispatcher) obj; // Does the CD belong to this destination if (cd.getDestination().equals(_baseDestinationHandler)) { // If the ConsumerDispatcher is in the MatchSpace, then dereference it but only if it // doesn't currently have consumers attached (defect 518845) if (cd.isInMatchSpace() && !cd.hasConsumersAttached()) { try { dereferenceSubscriptionConsumerDispatcher( cd, !cd.isDurable(), false); // don't call proxy code at this point } catch (SIResourceException e) { // No FFDC code needed // Trace the exception, we'll have FFDC'ed already and we want to allow // processing to continue. SibTr.exception(tc, e); } } //eof isInMatchSpace } // eof matching DestinationHandlers } // eof instanceof ConsumerDispatcher } // eof while } // eof sync if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setToBeDeleted"); } }
public class class_name { @Override public void setToBeDeleted() { super.setToBeDeleted(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setToBeDeleted"); // If there are durable subscriptions associated with the TopicSpace that is to be deleted // then we dereference them at this stage. This will remove entries from the matchspace. synchronized (_consumerDispatchersDurable) { // Iterate over the table of durable subscriptions. Iterator<Object> iter = _consumerDispatchersDurable.values().iterator(); while (iter.hasNext()) { Object obj = iter.next(); // May not be a ConsumerDispatcher instance. eg may be a PendingDurableDelete object. if (obj instanceof ConsumerDispatcher) { ConsumerDispatcher cd = (ConsumerDispatcher) obj; // Does the CD belong to this destination if (cd.getDestination().equals(_baseDestinationHandler)) { // If the ConsumerDispatcher is in the MatchSpace, then dereference it but only if it // doesn't currently have consumers attached (defect 518845) if (cd.isInMatchSpace() && !cd.hasConsumersAttached()) { try { dereferenceSubscriptionConsumerDispatcher( cd, !cd.isDurable(), false); // don't call proxy code at this point // depends on control dependency: [try], data = [none] } catch (SIResourceException e) { // No FFDC code needed // Trace the exception, we'll have FFDC'ed already and we want to allow // processing to continue. SibTr.exception(tc, e); } // depends on control dependency: [catch], data = [none] } //eof isInMatchSpace } // eof matching DestinationHandlers } // eof instanceof ConsumerDispatcher } // eof while } // eof sync if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setToBeDeleted"); } }
public class class_name { private static TaskInProgress findTaskFromList( Collection<TaskInProgress> tips, String hostName, boolean removeFailedTip) { Iterator<TaskInProgress> iter = tips.iterator(); while (iter.hasNext()) { TaskInProgress tip = iter.next(); // Select a tip if // 1. runnable : still needs to be run and is not completed // 2. ~running : no other node is running it // 3. earlier attempt failed : has not failed on this host // and has failed on all the other hosts // A TIP is removed from the list if // (1) this tip is scheduled // (2) if the passed list is a level 0 (host) cache // (3) when the TIP is non-schedulable (running, killed, complete) if (tip.isRunnable() && !tip.isRunning()) { // check if the tip has failed on this host if (!tip.hasFailedOnMachine(hostName)) { // TODO: check if the tip has failed on all the nodes iter.remove(); return tip; } else if (removeFailedTip) { // the case where we want to remove a failed tip from the host cache // point#3 in the TIP removal logic above iter.remove(); } } else { // see point#3 in the comment above for TIP removal logic iter.remove(); } } return null; } }
public class class_name { private static TaskInProgress findTaskFromList( Collection<TaskInProgress> tips, String hostName, boolean removeFailedTip) { Iterator<TaskInProgress> iter = tips.iterator(); while (iter.hasNext()) { TaskInProgress tip = iter.next(); // Select a tip if // 1. runnable : still needs to be run and is not completed // 2. ~running : no other node is running it // 3. earlier attempt failed : has not failed on this host // and has failed on all the other hosts // A TIP is removed from the list if // (1) this tip is scheduled // (2) if the passed list is a level 0 (host) cache // (3) when the TIP is non-schedulable (running, killed, complete) if (tip.isRunnable() && !tip.isRunning()) { // check if the tip has failed on this host if (!tip.hasFailedOnMachine(hostName)) { // TODO: check if the tip has failed on all the nodes iter.remove(); // depends on control dependency: [if], data = [none] return tip; // depends on control dependency: [if], data = [none] } else if (removeFailedTip) { // the case where we want to remove a failed tip from the host cache // point#3 in the TIP removal logic above iter.remove(); // depends on control dependency: [if], data = [none] } } else { // see point#3 in the comment above for TIP removal logic iter.remove(); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Override public EClass getIfcSurfaceOfLinearExtrusion() { if (ifcSurfaceOfLinearExtrusionEClass == null) { ifcSurfaceOfLinearExtrusionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(675); } return ifcSurfaceOfLinearExtrusionEClass; } }
public class class_name { @Override public EClass getIfcSurfaceOfLinearExtrusion() { if (ifcSurfaceOfLinearExtrusionEClass == null) { ifcSurfaceOfLinearExtrusionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(675); // depends on control dependency: [if], data = [none] } return ifcSurfaceOfLinearExtrusionEClass; } }
public class class_name { public void executeInBackground() { Thread t = new Thread() { public void run() { try{ execute(); }catch(Exception e) { notifyException(e); } } }; t.start(); } }
public class class_name { public void executeInBackground() { Thread t = new Thread() { public void run() { try{ execute(); // depends on control dependency: [try], data = [none] }catch(Exception e) { notifyException(e); } // depends on control dependency: [catch], data = [none] } }; t.start(); } }
public class class_name { final void checkModifiersIfNested(TypeElement type) { ElementKind enclosingKind = type.getEnclosingElement().getKind(); if (enclosingKind.isClass() || enclosingKind.isInterface()) { if (type.getModifiers().contains(Modifier.PRIVATE)) { errorReporter.abortWithError( "@" + simpleAnnotationName + " class must not be private", type); } else if (Visibility.effectiveVisibilityOfElement(type).equals(Visibility.PRIVATE)) { // The previous case, where the class itself is private, is much commoner so it deserves // its own error message, even though it would be caught by the test here too. errorReporter.abortWithError( "@" + simpleAnnotationName + " class must not be nested in a private class", type); } if (!type.getModifiers().contains(Modifier.STATIC)) { errorReporter.abortWithError( "Nested @" + simpleAnnotationName + " class must be static", type); } } // In principle type.getEnclosingElement() could be an ExecutableElement (for a class // declared inside a method), but since RoundEnvironment.getElementsAnnotatedWith doesn't // return such classes we won't see them here. } }
public class class_name { final void checkModifiersIfNested(TypeElement type) { ElementKind enclosingKind = type.getEnclosingElement().getKind(); if (enclosingKind.isClass() || enclosingKind.isInterface()) { if (type.getModifiers().contains(Modifier.PRIVATE)) { errorReporter.abortWithError( "@" + simpleAnnotationName + " class must not be private", type); // depends on control dependency: [if], data = [none] } else if (Visibility.effectiveVisibilityOfElement(type).equals(Visibility.PRIVATE)) { // The previous case, where the class itself is private, is much commoner so it deserves // its own error message, even though it would be caught by the test here too. errorReporter.abortWithError( "@" + simpleAnnotationName + " class must not be nested in a private class", type); // depends on control dependency: [if], data = [none] } if (!type.getModifiers().contains(Modifier.STATIC)) { errorReporter.abortWithError( "Nested @" + simpleAnnotationName + " class must be static", type); // depends on control dependency: [if], data = [none] } } // In principle type.getEnclosingElement() could be an ExecutableElement (for a class // declared inside a method), but since RoundEnvironment.getElementsAnnotatedWith doesn't // return such classes we won't see them here. } }
public class class_name { public static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName) { if (unknownEnumName == null || unknownEnumName.length() == 0) { return null; } for (Enum<?> enumVal : (Enum<?>[]) field.getType().getEnumConstants()) { if (enumVal.name().equals(unknownEnumName)) { return enumVal; } } throw new IllegalArgumentException("Unknwown enum unknown name " + unknownEnumName + " for field " + field); } }
public class class_name { public static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName) { if (unknownEnumName == null || unknownEnumName.length() == 0) { return null; } for (Enum<?> enumVal : (Enum<?>[]) field.getType().getEnumConstants()) { if (enumVal.name().equals(unknownEnumName)) { return enumVal; // depends on control dependency: [if], data = [none] } } throw new IllegalArgumentException("Unknwown enum unknown name " + unknownEnumName + " for field " + field); } }
public class class_name { public String getRandomHoliday(String earliest, String latest) { String dateString = ""; DateTimeFormatter parser = ISODateTimeFormat.date(); DateTime earlyDate = parser.parseDateTime(earliest); DateTime lateDate = parser.parseDateTime(latest); List<Holiday> holidays = new LinkedList<>(); int min = Integer.parseInt(earlyDate.toString().substring(0, 4)); int max = Integer.parseInt(lateDate.toString().substring(0, 4)); int range = max - min + 1; int randomYear = (int) (Math.random() * range) + min; for (Holiday s : EquivalenceClassTransformer.HOLIDAYS) { holidays.add(s); } Collections.shuffle(holidays); for (Holiday holiday : holidays) { dateString = convertToReadableDate(holiday.forYear(randomYear)); if (toDate(dateString).after(toDate(earliest)) && toDate(dateString).before(toDate(latest))) { break; } } return dateString; } }
public class class_name { public String getRandomHoliday(String earliest, String latest) { String dateString = ""; DateTimeFormatter parser = ISODateTimeFormat.date(); DateTime earlyDate = parser.parseDateTime(earliest); DateTime lateDate = parser.parseDateTime(latest); List<Holiday> holidays = new LinkedList<>(); int min = Integer.parseInt(earlyDate.toString().substring(0, 4)); int max = Integer.parseInt(lateDate.toString().substring(0, 4)); int range = max - min + 1; int randomYear = (int) (Math.random() * range) + min; for (Holiday s : EquivalenceClassTransformer.HOLIDAYS) { holidays.add(s); // depends on control dependency: [for], data = [s] } Collections.shuffle(holidays); for (Holiday holiday : holidays) { dateString = convertToReadableDate(holiday.forYear(randomYear)); // depends on control dependency: [for], data = [holiday] if (toDate(dateString).after(toDate(earliest)) && toDate(dateString).before(toDate(latest))) { break; } } return dateString; } }
public class class_name { @Override public String encodeRedirectURL(String url) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "encodeRedirectURL: " + url); } return encodeURL(url); } }
public class class_name { @Override public String encodeRedirectURL(String url) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "encodeRedirectURL: " + url); // depends on control dependency: [if], data = [none] } return encodeURL(url); } }
public class class_name { protected void putSessionValue(String pName, Object value, boolean securityInfo) { if (pName == null) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, methodClassName, methodNames[PUT_SESSION_VALUE], "SessionData.putValErr1"); return; } if (value == null) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, methodClassName, methodNames[PUT_SESSION_VALUE], "SessionData.putValErr2", pName); return; } if (pName.equals(SECURITY_PROP_NAME) && (securityInfo == false)) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT_SESSION_VALUE], "attempt to set security info failed"); } return; } super.setAttribute(pName, value); } }
public class class_name { protected void putSessionValue(String pName, Object value, boolean securityInfo) { if (pName == null) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, methodClassName, methodNames[PUT_SESSION_VALUE], "SessionData.putValErr1"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (value == null) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, methodClassName, methodNames[PUT_SESSION_VALUE], "SessionData.putValErr2", pName); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (pName.equals(SECURITY_PROP_NAME) && (securityInfo == false)) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT_SESSION_VALUE], "attempt to set security info failed"); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } super.setAttribute(pName, value); } }
public class class_name { private Map<Locale, LinkedHashMap<String, String>> removeNullEntries( Map<Locale, LinkedHashMap<String, String>> multilingualContentItems) { for (Locale locale : multilingualContentItems.keySet()) { if (null == multilingualContentItems.get(locale)) { multilingualContentItems.put(locale, new LinkedHashMap<String, String>()); } } return multilingualContentItems; } }
public class class_name { private Map<Locale, LinkedHashMap<String, String>> removeNullEntries( Map<Locale, LinkedHashMap<String, String>> multilingualContentItems) { for (Locale locale : multilingualContentItems.keySet()) { if (null == multilingualContentItems.get(locale)) { multilingualContentItems.put(locale, new LinkedHashMap<String, String>()); // depends on control dependency: [if], data = [none] } } return multilingualContentItems; } }
public class class_name { private FieldAccess genCodeForFieldAccess( SoyType baseType, FieldAccessNode fieldAccessNode, String fieldName) { Preconditions.checkNotNull(baseType); // For unions, attempt to generate the field access code for each member // type, and then see if they all agree. if (baseType.getKind() == SoyType.Kind.UNION) { // TODO(msamuel): We will need to generate fallback code for each variant. UnionType unionType = (UnionType) baseType; FieldAccess fieldAccess = null; for (SoyType memberType : unionType.getMembers()) { if (memberType.getKind() != SoyType.Kind.NULL) { FieldAccess fieldAccessForType = genCodeForFieldAccess(memberType, fieldAccessNode, fieldName); if (fieldAccess == null) { fieldAccess = fieldAccessForType; } else if (!fieldAccess.equals(fieldAccessForType)) { errorReporter.report( fieldAccessNode.getSourceLocation(), UNION_ACCESSOR_MISMATCH, fieldName, baseType); } } } return fieldAccess; } if (baseType.getKind() == SoyType.Kind.PROTO) { SoyProtoType protoType = (SoyProtoType) baseType; FieldDescriptor desc = protoType.getFieldDescriptor(fieldName); Preconditions.checkNotNull( desc, "Error in proto %s, field not found: %s", protoType.getDescriptor().getFullName(), fieldName); return FieldAccess.protoCall(fieldName, desc); } return FieldAccess.id(fieldName); } }
public class class_name { private FieldAccess genCodeForFieldAccess( SoyType baseType, FieldAccessNode fieldAccessNode, String fieldName) { Preconditions.checkNotNull(baseType); // For unions, attempt to generate the field access code for each member // type, and then see if they all agree. if (baseType.getKind() == SoyType.Kind.UNION) { // TODO(msamuel): We will need to generate fallback code for each variant. UnionType unionType = (UnionType) baseType; FieldAccess fieldAccess = null; for (SoyType memberType : unionType.getMembers()) { if (memberType.getKind() != SoyType.Kind.NULL) { FieldAccess fieldAccessForType = genCodeForFieldAccess(memberType, fieldAccessNode, fieldName); if (fieldAccess == null) { fieldAccess = fieldAccessForType; // depends on control dependency: [if], data = [none] } else if (!fieldAccess.equals(fieldAccessForType)) { errorReporter.report( fieldAccessNode.getSourceLocation(), UNION_ACCESSOR_MISMATCH, fieldName, baseType); // depends on control dependency: [if], data = [none] } } } return fieldAccess; // depends on control dependency: [if], data = [none] } if (baseType.getKind() == SoyType.Kind.PROTO) { SoyProtoType protoType = (SoyProtoType) baseType; FieldDescriptor desc = protoType.getFieldDescriptor(fieldName); Preconditions.checkNotNull( desc, "Error in proto %s, field not found: %s", protoType.getDescriptor().getFullName(), fieldName); // depends on control dependency: [if], data = [none] return FieldAccess.protoCall(fieldName, desc); // depends on control dependency: [if], data = [none] } return FieldAccess.id(fieldName); } }
public class class_name { public Routed<T> route(String path) { final String[] tokens = Pattern.removeSlashAtBothEnds(path).split("/"); final Map<String, String> params = new HashMap<String, String>(); boolean matched = true; for (final Pattern<T> pattern : patterns) { final String[] currTokens = pattern.tokens(); final T target = pattern.target(); matched = true; params.clear(); if (tokens.length == currTokens.length) { for (int i = 0; i < currTokens.length; i++) { final String token = tokens[i]; final String currToken = currTokens[i]; if (currToken.length() > 0 && currToken.charAt(0) == ':') { params.put(currToken.substring(1), token); } else if (!currToken.equals(token)) { matched = false; break; } } } else if (currTokens.length > 0 && currTokens[currTokens.length - 1].equals(":*") && tokens.length >= currTokens.length) { for (int i = 0; i < currTokens.length - 1; i++) { final String token = tokens[i]; final String currToken = currTokens[i]; if (currToken.length() > 0 && currToken.charAt(0) == ':') { params.put(currToken.substring(1), token); } else if (!token.equals(token)) { matched = false; break; } } if (matched) { final StringBuilder b = new StringBuilder(tokens[currTokens.length - 1]); for (int i = currTokens.length; i < tokens.length; i++) { b.append('/'); b.append(tokens[i]); } params.put("*", b.toString()); } } else { matched = false; } if (matched) return new Routed<T>(target, false, params); } if (notFound != null) { params.clear(); return new Routed<T>(notFound, true, params); } return null; } }
public class class_name { public Routed<T> route(String path) { final String[] tokens = Pattern.removeSlashAtBothEnds(path).split("/"); final Map<String, String> params = new HashMap<String, String>(); boolean matched = true; for (final Pattern<T> pattern : patterns) { final String[] currTokens = pattern.tokens(); final T target = pattern.target(); matched = true; // depends on control dependency: [for], data = [none] params.clear(); // depends on control dependency: [for], data = [none] if (tokens.length == currTokens.length) { for (int i = 0; i < currTokens.length; i++) { final String token = tokens[i]; final String currToken = currTokens[i]; if (currToken.length() > 0 && currToken.charAt(0) == ':') { params.put(currToken.substring(1), token); // depends on control dependency: [if], data = [none] } else if (!currToken.equals(token)) { matched = false; // depends on control dependency: [if], data = [none] break; } } } else if (currTokens.length > 0 && currTokens[currTokens.length - 1].equals(":*") && tokens.length >= currTokens.length) { for (int i = 0; i < currTokens.length - 1; i++) { final String token = tokens[i]; final String currToken = currTokens[i]; if (currToken.length() > 0 && currToken.charAt(0) == ':') { params.put(currToken.substring(1), token); // depends on control dependency: [if], data = [none] } else if (!token.equals(token)) { matched = false; // depends on control dependency: [if], data = [none] break; } } if (matched) { final StringBuilder b = new StringBuilder(tokens[currTokens.length - 1]); for (int i = currTokens.length; i < tokens.length; i++) { b.append('/'); // depends on control dependency: [for], data = [none] b.append(tokens[i]); // depends on control dependency: [for], data = [i] } params.put("*", b.toString()); // depends on control dependency: [if], data = [none] } } else { matched = false; // depends on control dependency: [if], data = [none] } if (matched) return new Routed<T>(target, false, params); } if (notFound != null) { params.clear(); // depends on control dependency: [if], data = [none] return new Routed<T>(notFound, true, params); // depends on control dependency: [if], data = [(notFound] } return null; } }
public class class_name { @Pure protected final boolean boundsContains(double x, double y, double delta) { final Rectangle2d bounds = getBoundingBox(); assert bounds != null; double dlt = delta; if (dlt < 0) { dlt = -dlt; } final Point2d p = new Point2d(x, y); if (dlt == 0) { return bounds.contains(p); } p.subX(dlt); p.subY(dlt); final Point2d p2 = new Point2d(p.getX() + dlt, p.getY() + dlt); return bounds.contains(p) && bounds.contains(p2); } }
public class class_name { @Pure protected final boolean boundsContains(double x, double y, double delta) { final Rectangle2d bounds = getBoundingBox(); assert bounds != null; double dlt = delta; if (dlt < 0) { dlt = -dlt; // depends on control dependency: [if], data = [none] } final Point2d p = new Point2d(x, y); if (dlt == 0) { return bounds.contains(p); // depends on control dependency: [if], data = [none] } p.subX(dlt); p.subY(dlt); final Point2d p2 = new Point2d(p.getX() + dlt, p.getY() + dlt); return bounds.contains(p) && bounds.contains(p2); } }
public class class_name { public static <T> T firstValue(List<T> list) { if (list != null && !list.isEmpty()) { return list.get(0); } return null; } }
public class class_name { public static <T> T firstValue(List<T> list) { if (list != null && !list.isEmpty()) { return list.get(0); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("Cut")) { consoleTextArea.cut(); } else if (cmd.equals("Copy")) { consoleTextArea.copy(); } else if (cmd.equals("Paste")) { consoleTextArea.paste(); } } }
public class class_name { @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("Cut")) { consoleTextArea.cut(); // depends on control dependency: [if], data = [none] } else if (cmd.equals("Copy")) { consoleTextArea.copy(); // depends on control dependency: [if], data = [none] } else if (cmd.equals("Paste")) { consoleTextArea.paste(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void persist() { OutputStream os = null; try { os = new FileOutputStream(fallbackStorageFile); fallbackStorage.store(os, "Generated"); LOG.debug("fallback storage written to {}", fallbackStorageFile); } catch (final IOException e) { LOG.warn("Cannot persist fallback storage: {}.", fallbackStorageFile, e); } finally { IOUtils.closeQuietly(os); } } }
public class class_name { public void persist() { OutputStream os = null; try { os = new FileOutputStream(fallbackStorageFile); // depends on control dependency: [try], data = [none] fallbackStorage.store(os, "Generated"); // depends on control dependency: [try], data = [none] LOG.debug("fallback storage written to {}", fallbackStorageFile); // depends on control dependency: [try], data = [none] } catch (final IOException e) { LOG.warn("Cannot persist fallback storage: {}.", fallbackStorageFile, e); } finally { // depends on control dependency: [catch], data = [none] IOUtils.closeQuietly(os); } } }
public class class_name { public void marshall(CreateResourceRequest createResourceRequest, ProtocolMarshaller protocolMarshaller) { if (createResourceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createResourceRequest.getRestApiId(), RESTAPIID_BINDING); protocolMarshaller.marshall(createResourceRequest.getParentId(), PARENTID_BINDING); protocolMarshaller.marshall(createResourceRequest.getPathPart(), PATHPART_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateResourceRequest createResourceRequest, ProtocolMarshaller protocolMarshaller) { if (createResourceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createResourceRequest.getRestApiId(), RESTAPIID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createResourceRequest.getParentId(), PARENTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createResourceRequest.getPathPart(), PATHPART_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override @FFDCIgnore({ ExecutionException.class }) public boolean isCancelled() { Future<Future<R>> resultFuture = getResultFuture(); if (resultFuture.isDone()) { if (resultFuture.isCancelled()) { return true; } else { try { Future<R> innerFuture = resultFuture.get(); return innerFuture.isCancelled(); } catch (InterruptedException e) { //outerFuture was done so we should never get an interrupted exception throw new FaultToleranceException(e); } catch (ExecutionException e) { //this is most likely to be caused if an exception is thrown from the business method ... or a TimeoutException //either way, the future was not cancelled return false; } } } else { return false; } } }
public class class_name { @Override @FFDCIgnore({ ExecutionException.class }) public boolean isCancelled() { Future<Future<R>> resultFuture = getResultFuture(); if (resultFuture.isDone()) { if (resultFuture.isCancelled()) { return true; // depends on control dependency: [if], data = [none] } else { try { Future<R> innerFuture = resultFuture.get(); return innerFuture.isCancelled(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { //outerFuture was done so we should never get an interrupted exception throw new FaultToleranceException(e); } catch (ExecutionException e) { // depends on control dependency: [catch], data = [none] //this is most likely to be caused if an exception is thrown from the business method ... or a TimeoutException //either way, the future was not cancelled return false; } // depends on control dependency: [catch], data = [none] } } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void linkSitesToGroups() { //System.out.println("LINK SITES TO GROUPS:" + siteToResidueMap.keySet().size()); //link the map of siteIds : <ResidueNumber> with the sites by using ResidueNumber to get the correct group back. //the return list if ( siteMap == null || siteToResidueMap == null){ logger.info("Sites can not be linked to residues!"); return; } List<Site> sites = null; //check that there are chains with which to associate the groups if (structure.getChains().isEmpty()) { sites = new ArrayList<Site>(siteMap.values()); logger.info("No chains to link Site Groups with - Sites will not be present in the Structure"); return; } //check that the keys in the siteMap and SiteToResidueMap are equal if (! siteMap.keySet().equals(siteToResidueMap.keySet())) { logger.info("Not all sites have been properly described in the PDB " + pdbId + " header - some Sites will not be present in the Structure"); logger.debug(siteMap.keySet() + " | " + siteToResidueMap.keySet()); //return; } //so we have chains - associate the siteResidues-related groups with the ones //already in in the chains for (String key : siteMap.keySet()) { Site currentSite = siteMap.get(key); List<ResidueNumber> linkedGroups = siteToResidueMap.get(key); if ( linkedGroups == null) continue; for (ResidueNumber residueNumber : linkedGroups) { String pdbCode = residueNumber.toString(); String chain = residueNumber.getChainName(); // System.out.println("chain: '" + chain + "'"); // String resNum = resNum.getSeqNum().toString(); // System.out.println("resNum: '" + resNum + "'"); Group linkedGroup = null; try { //TODO: implement findGroup(ResidueNumber resNum) linkedGroup = structure.findGroup(chain, pdbCode); } catch (StructureException ex) { logger.info("Can't find group " + pdbCode + " in chain " + chain + " in order to link up SITE records (PDB ID " + pdbId +")"); continue; } // System.out.println("Adding group: " + linkedGroup.getSeqNum() + " to site " + site.getSiteID()); currentSite.getGroups().add(linkedGroup); } } //System.out.println("SITEMAP: " + siteMap); sites = new ArrayList<Site>(siteMap.values()); structure.setSites(sites); //System.out.println("STRUCTURE SITES: " + structure.getSites().size()); // for (Site site : structure.getSites()) { // System.out.println(site); // } // System.out.println("Linked Site Groups with Chains"); } }
public class class_name { private void linkSitesToGroups() { //System.out.println("LINK SITES TO GROUPS:" + siteToResidueMap.keySet().size()); //link the map of siteIds : <ResidueNumber> with the sites by using ResidueNumber to get the correct group back. //the return list if ( siteMap == null || siteToResidueMap == null){ logger.info("Sites can not be linked to residues!"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } List<Site> sites = null; //check that there are chains with which to associate the groups if (structure.getChains().isEmpty()) { sites = new ArrayList<Site>(siteMap.values()); // depends on control dependency: [if], data = [none] logger.info("No chains to link Site Groups with - Sites will not be present in the Structure"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } //check that the keys in the siteMap and SiteToResidueMap are equal if (! siteMap.keySet().equals(siteToResidueMap.keySet())) { logger.info("Not all sites have been properly described in the PDB " + pdbId + " header - some Sites will not be present in the Structure"); // depends on control dependency: [if], data = [none] logger.debug(siteMap.keySet() + " | " + siteToResidueMap.keySet()); // depends on control dependency: [if], data = [none] //return; } //so we have chains - associate the siteResidues-related groups with the ones //already in in the chains for (String key : siteMap.keySet()) { Site currentSite = siteMap.get(key); List<ResidueNumber> linkedGroups = siteToResidueMap.get(key); if ( linkedGroups == null) continue; for (ResidueNumber residueNumber : linkedGroups) { String pdbCode = residueNumber.toString(); String chain = residueNumber.getChainName(); // System.out.println("chain: '" + chain + "'"); // String resNum = resNum.getSeqNum().toString(); // System.out.println("resNum: '" + resNum + "'"); Group linkedGroup = null; try { //TODO: implement findGroup(ResidueNumber resNum) linkedGroup = structure.findGroup(chain, pdbCode); } catch (StructureException ex) { logger.info("Can't find group " + pdbCode + " in chain " + chain + " in order to link up SITE records (PDB ID " + pdbId +")"); continue; } // System.out.println("Adding group: " + linkedGroup.getSeqNum() + " to site " + site.getSiteID()); currentSite.getGroups().add(linkedGroup); } } //System.out.println("SITEMAP: " + siteMap); sites = new ArrayList<Site>(siteMap.values()); structure.setSites(sites); //System.out.println("STRUCTURE SITES: " + structure.getSites().size()); // for (Site site : structure.getSites()) { // System.out.println(site); // } // System.out.println("Linked Site Groups with Chains"); } }
public class class_name { public void updateImage(FlowPanel container, Image previewImage) { if (!ENABLED) { return; } String path = m_imageInfoProvider.get().getResourcePath(); if (CmsClientStringUtil.checkIsPathOrLinkToSvg(path)) { return; } m_image = previewImage; clearImagePoint(); m_savedFocalPoint = m_imageInfoProvider.get().getFocalPoint(); m_focalPoint = m_savedFocalPoint; m_container = container; previewImage.addLoadHandler(new LoadHandler() { @SuppressWarnings("synthetic-access") public void onLoad(LoadEvent event) { updateScaling(); updatePoint(); } }); } }
public class class_name { public void updateImage(FlowPanel container, Image previewImage) { if (!ENABLED) { return; // depends on control dependency: [if], data = [none] } String path = m_imageInfoProvider.get().getResourcePath(); if (CmsClientStringUtil.checkIsPathOrLinkToSvg(path)) { return; // depends on control dependency: [if], data = [none] } m_image = previewImage; clearImagePoint(); m_savedFocalPoint = m_imageInfoProvider.get().getFocalPoint(); m_focalPoint = m_savedFocalPoint; m_container = container; previewImage.addLoadHandler(new LoadHandler() { @SuppressWarnings("synthetic-access") public void onLoad(LoadEvent event) { updateScaling(); updatePoint(); } }); } }
public class class_name { public boolean respondToDisconnect(int statusCode, String reasonPhrase, ArrayList<Header> additionalHeaders, ArrayList<Header> replaceHeaders, String body) { initErrorInfo(); if (parent.sendReply(transaction, statusCode, reasonPhrase, myTag, null, -1, additionalHeaders, replaceHeaders, body) != null) { return true; } setReturnCode(parent.getReturnCode()); setException(parent.getException()); setErrorMessage("respondToDisconnect(JSIP headers/body) - " + parent.getErrorMessage()); return false; } }
public class class_name { public boolean respondToDisconnect(int statusCode, String reasonPhrase, ArrayList<Header> additionalHeaders, ArrayList<Header> replaceHeaders, String body) { initErrorInfo(); if (parent.sendReply(transaction, statusCode, reasonPhrase, myTag, null, -1, additionalHeaders, replaceHeaders, body) != null) { return true; // depends on control dependency: [if], data = [none] } setReturnCode(parent.getReturnCode()); setException(parent.getException()); setErrorMessage("respondToDisconnect(JSIP headers/body) - " + parent.getErrorMessage()); return false; } }
public class class_name { boolean processBytesFromPeer(ByteBuf data) throws GeneralSecurityException { checkState(unwrapper != null, "protector already created"); try (BufUnwrapper unwrapper = this.unwrapper) { int bytesRead = 0; boolean done = false; for (ByteBuffer nioBuffer : unwrapper.readableNioBuffers(data)) { if (!nioBuffer.hasRemaining()) { // This buffer has been fully read, continue to the next buffer. continue; } int prevPos = nioBuffer.position(); done = internalHandshaker.processBytesFromPeer(nioBuffer); bytesRead += nioBuffer.position() - prevPos; if (done) { break; } } data.readerIndex(data.readerIndex() + bytesRead); return done; } } }
public class class_name { boolean processBytesFromPeer(ByteBuf data) throws GeneralSecurityException { checkState(unwrapper != null, "protector already created"); try (BufUnwrapper unwrapper = this.unwrapper) { int bytesRead = 0; boolean done = false; for (ByteBuffer nioBuffer : unwrapper.readableNioBuffers(data)) { if (!nioBuffer.hasRemaining()) { // This buffer has been fully read, continue to the next buffer. continue; } int prevPos = nioBuffer.position(); done = internalHandshaker.processBytesFromPeer(nioBuffer); // depends on control dependency: [for], data = [nioBuffer] bytesRead += nioBuffer.position() - prevPos; // depends on control dependency: [for], data = [nioBuffer] if (done) { break; } } data.readerIndex(data.readerIndex() + bytesRead); return done; } } }
public class class_name { @Override public void publish(LogRecord record) { // ici on préfère ne pas appeler isLoggable(record) pour éviter un lock synchronized sur getLevel if (record.getLevel().intValue() < THRESHOLD.intValue()) { return; } addErrorLogToCounter(record.getLevel().getName() + ": " + record.getMessage(), record.getThrown()); } }
public class class_name { @Override public void publish(LogRecord record) { // ici on préfère ne pas appeler isLoggable(record) pour éviter un lock synchronized sur getLevel if (record.getLevel().intValue() < THRESHOLD.intValue()) { return; // depends on control dependency: [if], data = [none] } addErrorLogToCounter(record.getLevel().getName() + ": " + record.getMessage(), record.getThrown()); } }
public class class_name { public byte[] sign(byte[] nonce) { try { char[] keyChars = this.readKeyChars(); NKey nkey = NKey.fromSeed(keyChars); byte[] sig = nkey.sign(nonce); nkey.clear(); return sig; } catch (Exception exp) { throw new IllegalStateException("problem signing nonce", exp); } } }
public class class_name { public byte[] sign(byte[] nonce) { try { char[] keyChars = this.readKeyChars(); NKey nkey = NKey.fromSeed(keyChars); byte[] sig = nkey.sign(nonce); nkey.clear(); // depends on control dependency: [try], data = [none] return sig; // depends on control dependency: [try], data = [none] } catch (Exception exp) { throw new IllegalStateException("problem signing nonce", exp); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static public double EScafferF6(double[] x) { double sum = 0.0; for (int i = 1; i < x.length; i++) { sum += ScafferF6(x[i - 1], x[i]); } sum += ScafferF6(x[x.length - 1], x[0]); return (sum); } }
public class class_name { static public double EScafferF6(double[] x) { double sum = 0.0; for (int i = 1; i < x.length; i++) { sum += ScafferF6(x[i - 1], x[i]); // depends on control dependency: [for], data = [i] } sum += ScafferF6(x[x.length - 1], x[0]); return (sum); } }
public class class_name { public void initTraceState(Map<String, Object> state) { Object traceId = state.get(Constants.HAWKULAR_APM_TRACEID); Object transaction = state.get(Constants.HAWKULAR_APM_TXN); Object level = state.get(Constants.HAWKULAR_APM_LEVEL); if (traceId != null) { setTraceId(traceId.toString()); } else { log.severe("Trace id has not been propagated"); } if (transaction != null) { setTransaction(transaction.toString()); } if (level != null) { setReportingLevel(ReportingLevel.valueOf(level.toString())); } } }
public class class_name { public void initTraceState(Map<String, Object> state) { Object traceId = state.get(Constants.HAWKULAR_APM_TRACEID); Object transaction = state.get(Constants.HAWKULAR_APM_TXN); Object level = state.get(Constants.HAWKULAR_APM_LEVEL); if (traceId != null) { setTraceId(traceId.toString()); // depends on control dependency: [if], data = [(traceId] } else { log.severe("Trace id has not been propagated"); // depends on control dependency: [if], data = [none] } if (transaction != null) { setTransaction(transaction.toString()); // depends on control dependency: [if], data = [(transaction] } if (level != null) { setReportingLevel(ReportingLevel.valueOf(level.toString())); // depends on control dependency: [if], data = [(level] } } }
public class class_name { public void enhance(Set<NetcdfDataset.Enhance> mode) { for (Variable v : getVariables()) { VariableEnhanced ve = (VariableEnhanced) v; ve.enhance(mode); } } }
public class class_name { public void enhance(Set<NetcdfDataset.Enhance> mode) { for (Variable v : getVariables()) { VariableEnhanced ve = (VariableEnhanced) v; ve.enhance(mode); // depends on control dependency: [for], data = [v] } } }
public class class_name { protected String findWar(String... paths) { if (paths != null) { for (String path : paths) { if (path != null) { File file = new File(path); if (file.exists()) { if (file.isFile()) { String name = file.getName(); if (isWarFileName(name)) { return file.getPath(); } } if (file.isDirectory()) { // lets look for a war in this directory File[] wars = file.listFiles((dir, name) -> isWarFileName(name)); if (wars != null && wars.length > 0) { return wars[0].getPath(); } } } } } } return null; } }
public class class_name { protected String findWar(String... paths) { if (paths != null) { for (String path : paths) { if (path != null) { File file = new File(path); if (file.exists()) { if (file.isFile()) { String name = file.getName(); if (isWarFileName(name)) { return file.getPath(); // depends on control dependency: [if], data = [none] } } if (file.isDirectory()) { // lets look for a war in this directory File[] wars = file.listFiles((dir, name) -> isWarFileName(name)); if (wars != null && wars.length > 0) { return wars[0].getPath(); // depends on control dependency: [if], data = [none] } } } } } } return null; } }
public class class_name { public void startSeleniumServer(final String args) { if (seleniumProxy != null) { throw new IllegalStateException("There is already a Selenium remote server running"); } try { final RemoteControlConfiguration configuration; LOG.info("Starting server with arguments: '" + args + "'"); //String[] argv = StringUtils.isNotBlank(args) ? StringUtils.split(args) : new String[] {}; String[] argv = StringUtils.split(args); configuration = SeleniumServer.parseLauncherOptions(argv); //checkArgsSanity(configuration); System.setProperty("org.openqa.jetty.http.HttpRequest.maxFormContentSize", "0"); // default max is 200k; zero is infinite seleniumProxy = new SeleniumServer(isSlowConnection(), configuration); seleniumProxy.start(); } catch (Exception e) { //server.stop(); LOG.info("Server stopped"); } } }
public class class_name { public void startSeleniumServer(final String args) { if (seleniumProxy != null) { throw new IllegalStateException("There is already a Selenium remote server running"); } try { final RemoteControlConfiguration configuration; LOG.info("Starting server with arguments: '" + args + "'"); // depends on control dependency: [try], data = [none] //String[] argv = StringUtils.isNotBlank(args) ? StringUtils.split(args) : new String[] {}; String[] argv = StringUtils.split(args); configuration = SeleniumServer.parseLauncherOptions(argv); // depends on control dependency: [try], data = [none] //checkArgsSanity(configuration); System.setProperty("org.openqa.jetty.http.HttpRequest.maxFormContentSize", "0"); // default max is 200k; zero is infinite // depends on control dependency: [try], data = [none] seleniumProxy = new SeleniumServer(isSlowConnection(), configuration); // depends on control dependency: [try], data = [none] seleniumProxy.start(); // depends on control dependency: [try], data = [none] } catch (Exception e) { //server.stop(); LOG.info("Server stopped"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Internal public static <OUT> TypeInfoFactory<OUT> getTypeInfoFactory(Type t) { final Class<?> factoryClass; if (registeredTypeInfoFactories.containsKey(t)) { factoryClass = registeredTypeInfoFactories.get(t); } else { if (!isClassType(t) || !typeToClass(t).isAnnotationPresent(TypeInfo.class)) { return null; } final TypeInfo typeInfoAnnotation = typeToClass(t).getAnnotation(TypeInfo.class); factoryClass = typeInfoAnnotation.value(); // check for valid factory class if (!TypeInfoFactory.class.isAssignableFrom(factoryClass)) { throw new InvalidTypesException("TypeInfo annotation does not specify a valid TypeInfoFactory."); } } // instantiate return (TypeInfoFactory<OUT>) InstantiationUtil.instantiate(factoryClass); } }
public class class_name { @Internal public static <OUT> TypeInfoFactory<OUT> getTypeInfoFactory(Type t) { final Class<?> factoryClass; if (registeredTypeInfoFactories.containsKey(t)) { factoryClass = registeredTypeInfoFactories.get(t); // depends on control dependency: [if], data = [none] } else { if (!isClassType(t) || !typeToClass(t).isAnnotationPresent(TypeInfo.class)) { return null; // depends on control dependency: [if], data = [none] } final TypeInfo typeInfoAnnotation = typeToClass(t).getAnnotation(TypeInfo.class); factoryClass = typeInfoAnnotation.value(); // depends on control dependency: [if], data = [none] // check for valid factory class if (!TypeInfoFactory.class.isAssignableFrom(factoryClass)) { throw new InvalidTypesException("TypeInfo annotation does not specify a valid TypeInfoFactory."); } } // instantiate return (TypeInfoFactory<OUT>) InstantiationUtil.instantiate(factoryClass); } }
public class class_name { protected double difference(int index, double val1, double val2) { //switch (m_Data.attribute(index).type()) { //case Attribute.NOMINAL: if (m_Data.attribute(index).isNominal() == true){ if (isMissingValue(val1) || isMissingValue(val2) || ((int) val1 != (int) val2)) { return 1; } else { return 0; } } else { //case Attribute.NUMERIC: if (isMissingValue(val1) || isMissingValue(val2)) { if (isMissingValue(val1) && isMissingValue(val2)) { if (!m_DontNormalize) //We are doing normalization return 1; else return (m_Ranges[index][R_MAX] - m_Ranges[index][R_MIN]); } else { double diff; if (isMissingValue(val2)) { diff = (!m_DontNormalize) ? norm(val1, index) : val1; } else { diff = (!m_DontNormalize) ? norm(val2, index) : val2; } if (!m_DontNormalize && diff < 0.5) { diff = 1.0 - diff; } else if (m_DontNormalize) { if ((m_Ranges[index][R_MAX]-diff) > (diff-m_Ranges[index][R_MIN])) return m_Ranges[index][R_MAX]-diff; else return diff-m_Ranges[index][R_MIN]; } return diff; } } else { return (!m_DontNormalize) ? (norm(val1, index) - norm(val2, index)) : (val1 - val2); } //default: // return 0; } } }
public class class_name { protected double difference(int index, double val1, double val2) { //switch (m_Data.attribute(index).type()) { //case Attribute.NOMINAL: if (m_Data.attribute(index).isNominal() == true){ if (isMissingValue(val1) || isMissingValue(val2) || ((int) val1 != (int) val2)) { return 1; // depends on control dependency: [if], data = [none] } else { return 0; // depends on control dependency: [if], data = [none] } } else { //case Attribute.NUMERIC: if (isMissingValue(val1) || isMissingValue(val2)) { if (isMissingValue(val1) && isMissingValue(val2)) { if (!m_DontNormalize) //We are doing normalization return 1; else return (m_Ranges[index][R_MAX] - m_Ranges[index][R_MIN]); } else { double diff; if (isMissingValue(val2)) { diff = (!m_DontNormalize) ? norm(val1, index) : val1; // depends on control dependency: [if], data = [none] } else { diff = (!m_DontNormalize) ? norm(val2, index) : val2; // depends on control dependency: [if], data = [none] } if (!m_DontNormalize && diff < 0.5) { diff = 1.0 - diff; // depends on control dependency: [if], data = [none] } else if (m_DontNormalize) { if ((m_Ranges[index][R_MAX]-diff) > (diff-m_Ranges[index][R_MIN])) return m_Ranges[index][R_MAX]-diff; else return diff-m_Ranges[index][R_MIN]; } return diff; // depends on control dependency: [if], data = [none] } } else { return (!m_DontNormalize) ? (norm(val1, index) - norm(val2, index)) : (val1 - val2); // depends on control dependency: [if], data = [none] } //default: // return 0; } } }
public class class_name { @Override @SuppressWarnings("unchecked") public <T> Future<T> submit(Callable<T> task) { Map<String, String> execProps = getExecutionProperties(task); ThreadContextDescriptor contextDescriptor; if (task instanceof ContextualAction) { ContextualAction<Callable<T>> a = (ContextualAction<Callable<T>>) task; contextDescriptor = a.getContextDescriptor(); task = a.getAction(); } else { WSContextService contextSvc = getContextService(); contextDescriptor = contextSvc.captureThreadContext(execProps); } TaskLifeCycleCallback callback = new TaskLifeCycleCallback(this, contextDescriptor); return callback.policyExecutor.submit(task, callback); } }
public class class_name { @Override @SuppressWarnings("unchecked") public <T> Future<T> submit(Callable<T> task) { Map<String, String> execProps = getExecutionProperties(task); ThreadContextDescriptor contextDescriptor; if (task instanceof ContextualAction) { ContextualAction<Callable<T>> a = (ContextualAction<Callable<T>>) task; contextDescriptor = a.getContextDescriptor(); // depends on control dependency: [if], data = [none] task = a.getAction(); // depends on control dependency: [if], data = [none] } else { WSContextService contextSvc = getContextService(); contextDescriptor = contextSvc.captureThreadContext(execProps); // depends on control dependency: [if], data = [none] } TaskLifeCycleCallback callback = new TaskLifeCycleCallback(this, contextDescriptor); return callback.policyExecutor.submit(task, callback); } }
public class class_name { public static Deferred<Tree> fetchTree(final TSDB tsdb, final int tree_id) { if (tree_id < 1 || tree_id > 65535) { throw new IllegalArgumentException("Invalid Tree ID"); } // fetch the whole row final GetRequest get = new GetRequest(tsdb.treeTable(), idToBytes(tree_id)); get.family(TREE_FAMILY); /** * Called from the GetRequest with results from storage. Loops through the * columns and loads the tree definition and rules */ final class FetchTreeCB implements Callback<Deferred<Tree>, ArrayList<KeyValue>> { @Override public Deferred<Tree> call(ArrayList<KeyValue> row) throws Exception { if (row == null || row.isEmpty()) { return Deferred.fromResult(null); } final Tree tree = new Tree(); // WARNING: Since the JSON in storage doesn't store the tree ID, we need // to loadi t from the row key. tree.setTreeId(bytesToId(row.get(0).key())); for (KeyValue column : row) { if (Bytes.memcmp(TREE_QUALIFIER, column.qualifier()) == 0) { // it's *this* tree. We deserialize to a new object and copy // since the columns could be in any order and we may get a rule // before the tree object final Tree local_tree = JSON.parseToObject(column.value(), Tree.class); tree.created = local_tree.created; tree.description = local_tree.description; tree.name = local_tree.name; tree.notes = local_tree.notes; tree.strict_match = local_tree.strict_match; tree.enabled = local_tree.enabled; tree.store_failures = local_tree.store_failures; // Tree rule } else if (Bytes.memcmp(TreeRule.RULE_PREFIX(), column.qualifier(), 0, TreeRule.RULE_PREFIX().length) == 0) { final TreeRule rule = TreeRule.parseFromStorage(column); tree.addRule(rule); } } return Deferred.fromResult(tree); } } // issue the get request return tsdb.getClient().get(get).addCallbackDeferring(new FetchTreeCB()); } }
public class class_name { public static Deferred<Tree> fetchTree(final TSDB tsdb, final int tree_id) { if (tree_id < 1 || tree_id > 65535) { throw new IllegalArgumentException("Invalid Tree ID"); } // fetch the whole row final GetRequest get = new GetRequest(tsdb.treeTable(), idToBytes(tree_id)); get.family(TREE_FAMILY); /** * Called from the GetRequest with results from storage. Loops through the * columns and loads the tree definition and rules */ final class FetchTreeCB implements Callback<Deferred<Tree>, ArrayList<KeyValue>> { @Override public Deferred<Tree> call(ArrayList<KeyValue> row) throws Exception { if (row == null || row.isEmpty()) { return Deferred.fromResult(null); } final Tree tree = new Tree(); // WARNING: Since the JSON in storage doesn't store the tree ID, we need // to loadi t from the row key. tree.setTreeId(bytesToId(row.get(0).key())); for (KeyValue column : row) { if (Bytes.memcmp(TREE_QUALIFIER, column.qualifier()) == 0) { // it's *this* tree. We deserialize to a new object and copy // since the columns could be in any order and we may get a rule // before the tree object final Tree local_tree = JSON.parseToObject(column.value(), Tree.class); tree.created = local_tree.created; // depends on control dependency: [if], data = [none] tree.description = local_tree.description; // depends on control dependency: [if], data = [none] tree.name = local_tree.name; // depends on control dependency: [if], data = [none] tree.notes = local_tree.notes; // depends on control dependency: [if], data = [none] tree.strict_match = local_tree.strict_match; // depends on control dependency: [if], data = [none] tree.enabled = local_tree.enabled; // depends on control dependency: [if], data = [none] tree.store_failures = local_tree.store_failures; // depends on control dependency: [if], data = [none] // Tree rule } else if (Bytes.memcmp(TreeRule.RULE_PREFIX(), column.qualifier(), 0, TreeRule.RULE_PREFIX().length) == 0) { final TreeRule rule = TreeRule.parseFromStorage(column); tree.addRule(rule); // depends on control dependency: [if], data = [none] } } return Deferred.fromResult(tree); } } // issue the get request return tsdb.getClient().get(get).addCallbackDeferring(new FetchTreeCB()); } }
public class class_name { public void insertHrefBefore(String newHref, String refHref) { String refHrefEncoded = encodeHref(refHref); String newHrefEncoded = encodeHref(newHref); if (isDuplicate(newHrefEncoded)) return; Element child = getFirstChild(root, "href"); //$NON-NLS-1$ while (child != null) { if (refHrefEncoded.equals(getFirstText(child))) { insertBefore(child, "href", newHrefEncoded); //$NON-NLS-1$ return; } child = getNextSibling(child, "href"); //$NON-NLS-1$ } Assert.isTrue(false, Policy.bind("assert.noHrefRef")); //$NON-NLS-1$ } }
public class class_name { public void insertHrefBefore(String newHref, String refHref) { String refHrefEncoded = encodeHref(refHref); String newHrefEncoded = encodeHref(newHref); if (isDuplicate(newHrefEncoded)) return; Element child = getFirstChild(root, "href"); //$NON-NLS-1$ while (child != null) { if (refHrefEncoded.equals(getFirstText(child))) { insertBefore(child, "href", newHrefEncoded); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } child = getNextSibling(child, "href"); //$NON-NLS-1$ // depends on control dependency: [while], data = [(child] } Assert.isTrue(false, Policy.bind("assert.noHrefRef")); //$NON-NLS-1$ } }
public class class_name { @Override public boolean removeAll(IntSet c) { if (c == null || c.isEmpty() || isEmpty()) { return false; } if (c == this) { clear(); return true; } final FastSet other = convert(c); final int[] localWords = words; // faster final int[] localOtherWords = other.words; // faster // Perform logical (a & !b) on words in common boolean modified = false; for (int i = Math.min(firstEmptyWord, other.firstEmptyWord) - 1; i >= 0; i--) { int before = localWords[i]; localWords[i] &= ~localOtherWords[i]; modified = modified || before != localWords[i]; } if (modified) { fixFirstEmptyWord(); size = -1; } return modified; } }
public class class_name { @Override public boolean removeAll(IntSet c) { if (c == null || c.isEmpty() || isEmpty()) { return false; // depends on control dependency: [if], data = [none] } if (c == this) { clear(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } final FastSet other = convert(c); final int[] localWords = words; // faster final int[] localOtherWords = other.words; // faster // Perform logical (a & !b) on words in common boolean modified = false; for (int i = Math.min(firstEmptyWord, other.firstEmptyWord) - 1; i >= 0; i--) { int before = localWords[i]; localWords[i] &= ~localOtherWords[i]; // depends on control dependency: [for], data = [i] modified = modified || before != localWords[i]; // depends on control dependency: [for], data = [i] } if (modified) { fixFirstEmptyWord(); // depends on control dependency: [if], data = [none] size = -1; // depends on control dependency: [if], data = [none] } return modified; } }
public class class_name { private NotificationTargetInformation toNotificationTargetInformation(RESTRequest request, String objectName) { //Handle incoming routing context (if applicable) String[] routingContext = RESTHelper.getRoutingContext(request, false); if (routingContext != null) { return new NotificationTargetInformation(objectName, routingContext[0], routingContext[2], routingContext[1]); } return new NotificationTargetInformation(objectName); } }
public class class_name { private NotificationTargetInformation toNotificationTargetInformation(RESTRequest request, String objectName) { //Handle incoming routing context (if applicable) String[] routingContext = RESTHelper.getRoutingContext(request, false); if (routingContext != null) { return new NotificationTargetInformation(objectName, routingContext[0], routingContext[2], routingContext[1]); // depends on control dependency: [if], data = [none] } return new NotificationTargetInformation(objectName); } }
public class class_name { public static void addCells(StringBuilder builder, String... cells) { if(builder == null || cells == null || cells.length == 0) return; for (String cell : cells) { addCell(builder,cell); } } }
public class class_name { public static void addCells(StringBuilder builder, String... cells) { if(builder == null || cells == null || cells.length == 0) return; for (String cell : cells) { addCell(builder,cell); // depends on control dependency: [for], data = [cell] } } }
public class class_name { public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsElevateWordCQ> queryLambda, ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsElevateWordCA> aggsLambda) { ElevateWordCQ cq = new ElevateWordCQ(); if (queryLambda != null) { queryLambda.callback(cq); } FilterAggregationBuilder builder = regFilterA(name, cq.getQuery()); if (opLambda != null) { opLambda.callback(builder); } if (aggsLambda != null) { ElevateWordCA ca = new ElevateWordCA(); aggsLambda.callback(ca); ca.getAggregationBuilderList().forEach(builder::subAggregation); } } }
public class class_name { public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsElevateWordCQ> queryLambda, ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsElevateWordCA> aggsLambda) { ElevateWordCQ cq = new ElevateWordCQ(); if (queryLambda != null) { queryLambda.callback(cq); // depends on control dependency: [if], data = [none] } FilterAggregationBuilder builder = regFilterA(name, cq.getQuery()); if (opLambda != null) { opLambda.callback(builder); // depends on control dependency: [if], data = [none] } if (aggsLambda != null) { ElevateWordCA ca = new ElevateWordCA(); aggsLambda.callback(ca); // depends on control dependency: [if], data = [none] ca.getAggregationBuilderList().forEach(builder::subAggregation); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setExceptions(java.util.Collection<RootCauseException> exceptions) { if (exceptions == null) { this.exceptions = null; return; } this.exceptions = new java.util.ArrayList<RootCauseException>(exceptions); } }
public class class_name { public void setExceptions(java.util.Collection<RootCauseException> exceptions) { if (exceptions == null) { this.exceptions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.exceptions = new java.util.ArrayList<RootCauseException>(exceptions); } }
public class class_name { @Programmatic public ApplicationRole newRole( final String name, final String description) { ApplicationRole role = findByName(name); if (role == null){ role = getApplicationRoleFactory().newApplicationRole(); role.setName(name); role.setDescription(description); container.persist(role); } return role; } }
public class class_name { @Programmatic public ApplicationRole newRole( final String name, final String description) { ApplicationRole role = findByName(name); if (role == null){ role = getApplicationRoleFactory().newApplicationRole(); // depends on control dependency: [if], data = [none] role.setName(name); // depends on control dependency: [if], data = [none] role.setDescription(description); // depends on control dependency: [if], data = [none] container.persist(role); // depends on control dependency: [if], data = [(role] } return role; } }
public class class_name { public void displayNewModelPage(CmsModelPageEntry modelPageData, boolean isModelGroup) { CmsModelPageTreeItem treeItem = new CmsModelPageTreeItem(modelPageData, isModelGroup, false); CmsSitemapHoverbar.installOn( m_controller, treeItem, modelPageData.getStructureId(), modelPageData.getSitePath(), modelPageData.getSitePath() != null); m_modelPageTreeItems.put(modelPageData.getStructureId(), treeItem); if (isModelGroup) { m_modelGroupRoot.addChild(treeItem); } else { m_modelPageRoot.addChild(treeItem); } } }
public class class_name { public void displayNewModelPage(CmsModelPageEntry modelPageData, boolean isModelGroup) { CmsModelPageTreeItem treeItem = new CmsModelPageTreeItem(modelPageData, isModelGroup, false); CmsSitemapHoverbar.installOn( m_controller, treeItem, modelPageData.getStructureId(), modelPageData.getSitePath(), modelPageData.getSitePath() != null); m_modelPageTreeItems.put(modelPageData.getStructureId(), treeItem); if (isModelGroup) { m_modelGroupRoot.addChild(treeItem); // depends on control dependency: [if], data = [none] } else { m_modelPageRoot.addChild(treeItem); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override protected File cloneRepository(File dest) { BaseRepository repo = Repository.clone(RepositoryConfiguration.DEFAULT, dest, getUrl()); // set branch name String branchName = MASTER;; String branch = getBranch(); if (StringUtils.isNotBlank(branch)) { branchName = branch; } String tag = getTag(); if (StringUtils.isNotBlank(tag)) { branchName = tag; } BranchCommand.on(repo).set(branchName); return dest; } }
public class class_name { @Override protected File cloneRepository(File dest) { BaseRepository repo = Repository.clone(RepositoryConfiguration.DEFAULT, dest, getUrl()); // set branch name String branchName = MASTER;; String branch = getBranch(); if (StringUtils.isNotBlank(branch)) { branchName = branch; // depends on control dependency: [if], data = [none] } String tag = getTag(); if (StringUtils.isNotBlank(tag)) { branchName = tag; // depends on control dependency: [if], data = [none] } BranchCommand.on(repo).set(branchName); return dest; } }
public class class_name { protected void computeWeights(int numSamples, double numSigmas) { weights = new float[ numSamples*numSamples ]; float w[] = new float[ numSamples ]; for( int i = 0; i < numSamples; i++ ) { float x = i/(float)(numSamples-1); w[i] = (float) UtilGaussian.computePDF(0, 1, 2f*numSigmas * (x - 0.5f)); } for( int y = 0; y < numSamples; y++ ) { for( int x = 0; x < numSamples; x++ ) { weights[y*numSamples + x] = w[y]*w[x]; } } } }
public class class_name { protected void computeWeights(int numSamples, double numSigmas) { weights = new float[ numSamples*numSamples ]; float w[] = new float[ numSamples ]; for( int i = 0; i < numSamples; i++ ) { float x = i/(float)(numSamples-1); w[i] = (float) UtilGaussian.computePDF(0, 1, 2f*numSigmas * (x - 0.5f)); // depends on control dependency: [for], data = [i] } for( int y = 0; y < numSamples; y++ ) { for( int x = 0; x < numSamples; x++ ) { weights[y*numSamples + x] = w[y]*w[x]; // depends on control dependency: [for], data = [x] } } } }
public class class_name { static Map<String, Object> processAttributes(Map<String, Object> attributes, boolean isCovered) { if (isCovered) { return processAttributesForCovering(attributes); } else { return processAttributesForIncremental(attributes); } } }
public class class_name { static Map<String, Object> processAttributes(Map<String, Object> attributes, boolean isCovered) { if (isCovered) { return processAttributesForCovering(attributes); // depends on control dependency: [if], data = [none] } else { return processAttributesForIncremental(attributes); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Map<String, Object> removeUnusedMapEntries( AtlasVertex instanceVertex, String propertyName, Map<String, Object> currentMap, Map<String, Object> newMap, IDataType elementType, AttributeInfo attributeInfo) throws AtlasException { Map<String, Object> additionalMap = new HashMap<>(); for (String currentKey : currentMap.keySet()) { boolean shouldDeleteKey = !newMap.containsKey(currentKey); if (GraphHelper.isReference(elementType)) { //Delete the edge reference if its not part of new edges created/updated AtlasEdge currentEdge = (AtlasEdge)currentMap.get(currentKey); if (!newMap.values().contains(currentEdge)) { boolean deleted = deleteHandler.deleteEdgeReference(currentEdge, elementType.getTypeCategory(), attributeInfo.isComposite, true); if (!deleted) { additionalMap.put(currentKey, currentEdge); shouldDeleteKey = false; } } } if (shouldDeleteKey) { String propertyNameForKey = GraphHelper.getQualifiedNameForMapKey(propertyName, currentKey); GraphHelper.setProperty(instanceVertex, propertyNameForKey, null); } } return additionalMap; } }
public class class_name { private Map<String, Object> removeUnusedMapEntries( AtlasVertex instanceVertex, String propertyName, Map<String, Object> currentMap, Map<String, Object> newMap, IDataType elementType, AttributeInfo attributeInfo) throws AtlasException { Map<String, Object> additionalMap = new HashMap<>(); for (String currentKey : currentMap.keySet()) { boolean shouldDeleteKey = !newMap.containsKey(currentKey); if (GraphHelper.isReference(elementType)) { //Delete the edge reference if its not part of new edges created/updated AtlasEdge currentEdge = (AtlasEdge)currentMap.get(currentKey); if (!newMap.values().contains(currentEdge)) { boolean deleted = deleteHandler.deleteEdgeReference(currentEdge, elementType.getTypeCategory(), attributeInfo.isComposite, true); if (!deleted) { additionalMap.put(currentKey, currentEdge); // depends on control dependency: [if], data = [none] shouldDeleteKey = false; // depends on control dependency: [if], data = [none] } } } if (shouldDeleteKey) { String propertyNameForKey = GraphHelper.getQualifiedNameForMapKey(propertyName, currentKey); GraphHelper.setProperty(instanceVertex, propertyNameForKey, null); } } return additionalMap; } }
public class class_name { public int[] getNonZeroIndices() { if (vectorOffset == 0) return sparseVector.getNonZeroIndices(); // If the sparse vector is a sub-view, calculate which indices are // reflected in this view else { int[] full = sparseVector.getNonZeroIndices(); Arrays.sort(full); int startIndex = 0; int endIndex = full.length; for (int i = 0; i < full.length; ++i) { if (full[i] < vectorOffset) startIndex++; else if (full[i] > vectorOffset + vectorLength) { endIndex = i - 1; break; } } if (startIndex == endIndex) return new int[0]; int[] range = new int[endIndex - startIndex]; System.arraycopy(full, startIndex, range, 0, range.length); return range; } } }
public class class_name { public int[] getNonZeroIndices() { if (vectorOffset == 0) return sparseVector.getNonZeroIndices(); // If the sparse vector is a sub-view, calculate which indices are // reflected in this view else { int[] full = sparseVector.getNonZeroIndices(); Arrays.sort(full); // depends on control dependency: [if], data = [none] int startIndex = 0; int endIndex = full.length; for (int i = 0; i < full.length; ++i) { if (full[i] < vectorOffset) startIndex++; else if (full[i] > vectorOffset + vectorLength) { endIndex = i - 1; // depends on control dependency: [if], data = [none] break; } } if (startIndex == endIndex) return new int[0]; int[] range = new int[endIndex - startIndex]; System.arraycopy(full, startIndex, range, 0, range.length); // depends on control dependency: [if], data = [none] return range; // depends on control dependency: [if], data = [none] } } }
public class class_name { void add(BucketUpdate.KeyUpdate update, int entryLength, long originalOffset) { val existing = this.updates.get(update.getKey()); if (existing == null || update.supersedes(existing)) { this.updates.put(update.getKey(), update); } // Update remaining counters, regardless of whether we considered this update or not. this.totalUpdateCount.incrementAndGet(); long lastOffset = update.getOffset() + entryLength; this.lastIndexedOffset.updateAndGet(e -> Math.max(lastOffset, e)); if (originalOffset >= 0) { this.highestCopiedOffset.updateAndGet(e -> Math.max(e, originalOffset + entryLength)); } } }
public class class_name { void add(BucketUpdate.KeyUpdate update, int entryLength, long originalOffset) { val existing = this.updates.get(update.getKey()); if (existing == null || update.supersedes(existing)) { this.updates.put(update.getKey(), update); // depends on control dependency: [if], data = [none] } // Update remaining counters, regardless of whether we considered this update or not. this.totalUpdateCount.incrementAndGet(); long lastOffset = update.getOffset() + entryLength; this.lastIndexedOffset.updateAndGet(e -> Math.max(lastOffset, e)); if (originalOffset >= 0) { this.highestCopiedOffset.updateAndGet(e -> Math.max(e, originalOffset + entryLength)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Nonnull public static String constructMessage( @Nullable Throwable e, @Nullable String newMessage, @Nullable Object... messageParams) { String message; if (newMessage == null) { if (e == null) { message = UNKNOWN_PROBLEM; } else { message = e.getMessage(); } } else { message = String.format(newMessage, messageParams); } return message; } }
public class class_name { @Nonnull public static String constructMessage( @Nullable Throwable e, @Nullable String newMessage, @Nullable Object... messageParams) { String message; if (newMessage == null) { if (e == null) { message = UNKNOWN_PROBLEM; // depends on control dependency: [if], data = [none] } else { message = e.getMessage(); // depends on control dependency: [if], data = [none] } } else { message = String.format(newMessage, messageParams); // depends on control dependency: [if], data = [(newMessage] } return message; } }
public class class_name { private List<StorableProperty<?>>[] caseMatches(int caseCount) { List<StorableProperty<?>>[] cases = new List[caseCount]; for (StorableProperty<?> prop : mAllProperties.values()) { int hashCode = prop.getName().hashCode(); int caseValue = (hashCode & 0x7fffffff) % caseCount; List matches = cases[caseValue]; if (matches == null) { matches = cases[caseValue] = new ArrayList<StorableProperty<?>>(); } matches.add(prop); } return cases; } }
public class class_name { private List<StorableProperty<?>>[] caseMatches(int caseCount) { List<StorableProperty<?>>[] cases = new List[caseCount]; for (StorableProperty<?> prop : mAllProperties.values()) { int hashCode = prop.getName().hashCode(); int caseValue = (hashCode & 0x7fffffff) % caseCount; List matches = cases[caseValue]; if (matches == null) { matches = cases[caseValue] = new ArrayList<StorableProperty<?>>(); // depends on control dependency: [if], data = [none] } matches.add(prop); // depends on control dependency: [for], data = [prop] } return cases; } }
public class class_name { @POST @Consumes("multipart/form-data") @RequiresPermissions(I18nPermissions.KEY_WRITE) public Response importTranslations(FormDataMultiPart multiPart) { WebAssertions.assertNotNull(multiPart, "Missing input file"); int importedKeys = 0; for (BodyPart bodyPart : multiPart.getBodyParts()) { importedKeys += importFile(bodyPart); } String importedKeysMessage = String.format(LOADED_KEYS_MESSAGE, importedKeys); LOGGER.debug(importedKeysMessage); return Response.ok(importedKeysMessage, MediaType.TEXT_PLAIN_TYPE).build(); } }
public class class_name { @POST @Consumes("multipart/form-data") @RequiresPermissions(I18nPermissions.KEY_WRITE) public Response importTranslations(FormDataMultiPart multiPart) { WebAssertions.assertNotNull(multiPart, "Missing input file"); int importedKeys = 0; for (BodyPart bodyPart : multiPart.getBodyParts()) { importedKeys += importFile(bodyPart); // depends on control dependency: [for], data = [bodyPart] } String importedKeysMessage = String.format(LOADED_KEYS_MESSAGE, importedKeys); LOGGER.debug(importedKeysMessage); return Response.ok(importedKeysMessage, MediaType.TEXT_PLAIN_TYPE).build(); } }
public class class_name { private List<ScannerPlugin<?, ?>> getScannerPluginsForType(final Class<?> type) { List<ScannerPlugin<?, ?>> plugins = scannerPluginsPerType.get(type); if (plugins == null) { // The list of all scanner plugins which accept the given type final List<ScannerPlugin<?, ?>> candidates = new LinkedList<>(); // The map of scanner plugins which produce a descriptor type final Map<Class<? extends Descriptor>, Set<ScannerPlugin<?, ?>>> pluginsByDescriptor = new HashMap<>(); for (ScannerPlugin<?, ?> scannerPlugin : scannerPlugins.values()) { Class<?> scannerPluginType = scannerPlugin.getType(); if (scannerPluginType.isAssignableFrom(type)) { Class<? extends Descriptor> descriptorType = scannerPlugin.getDescriptorType(); Set<ScannerPlugin<?, ?>> pluginsForDescriptorType = pluginsByDescriptor.get(descriptorType); if (pluginsForDescriptorType == null) { pluginsForDescriptorType = new HashSet<>(); pluginsByDescriptor.put(descriptorType, pluginsForDescriptorType); } pluginsForDescriptorType.add(scannerPlugin); candidates.add(scannerPlugin); } } // Order plugins by the values of their optional @Requires // annotation plugins = DependencyResolver.newInstance(candidates, new DependencyProvider<ScannerPlugin<?, ?>>() { @Override public Set<ScannerPlugin<?, ?>> getDependencies(ScannerPlugin<?, ?> dependent) { Set<ScannerPlugin<?, ?>> dependencies = new HashSet<>(); Requires annotation = dependent.getClass().getAnnotation(Requires.class); if (annotation != null) { for (Class<? extends Descriptor> descriptorType : annotation.value()) { Set<ScannerPlugin<?, ?>> pluginsByDescriptorType = pluginsByDescriptor.get(descriptorType); if (pluginsByDescriptorType != null) { for (ScannerPlugin<?, ?> scannerPlugin : pluginsByDescriptorType) { if (!scannerPlugin.equals(dependent)) { dependencies.add(scannerPlugin); } } } } } return dependencies; } }).resolve(); scannerPluginsPerType.put(type, plugins); } return plugins; } }
public class class_name { private List<ScannerPlugin<?, ?>> getScannerPluginsForType(final Class<?> type) { List<ScannerPlugin<?, ?>> plugins = scannerPluginsPerType.get(type); if (plugins == null) { // The list of all scanner plugins which accept the given type final List<ScannerPlugin<?, ?>> candidates = new LinkedList<>(); // The map of scanner plugins which produce a descriptor type final Map<Class<? extends Descriptor>, Set<ScannerPlugin<?, ?>>> pluginsByDescriptor = new HashMap<>(); for (ScannerPlugin<?, ?> scannerPlugin : scannerPlugins.values()) { Class<?> scannerPluginType = scannerPlugin.getType(); if (scannerPluginType.isAssignableFrom(type)) { Class<? extends Descriptor> descriptorType = scannerPlugin.getDescriptorType(); Set<ScannerPlugin<?, ?>> pluginsForDescriptorType = pluginsByDescriptor.get(descriptorType); if (pluginsForDescriptorType == null) { pluginsForDescriptorType = new HashSet<>(); // depends on control dependency: [if], data = [none] pluginsByDescriptor.put(descriptorType, pluginsForDescriptorType); // depends on control dependency: [if], data = [none] } pluginsForDescriptorType.add(scannerPlugin); candidates.add(scannerPlugin); } } // Order plugins by the values of their optional @Requires // annotation plugins = DependencyResolver.newInstance(candidates, new DependencyProvider<ScannerPlugin<?, ?>>() { @Override public Set<ScannerPlugin<?, ?>> getDependencies(ScannerPlugin<?, ?> dependent) { Set<ScannerPlugin<?, ?>> dependencies = new HashSet<>(); Requires annotation = dependent.getClass().getAnnotation(Requires.class); if (annotation != null) { for (Class<? extends Descriptor> descriptorType : annotation.value()) { Set<ScannerPlugin<?, ?>> pluginsByDescriptorType = pluginsByDescriptor.get(descriptorType); if (pluginsByDescriptorType != null) { for (ScannerPlugin<?, ?> scannerPlugin : pluginsByDescriptorType) { if (!scannerPlugin.equals(dependent)) { dependencies.add(scannerPlugin); // depends on control dependency: [if], data = [none] } } } } } return dependencies; } }).resolve(); scannerPluginsPerType.put(type, plugins); } return plugins; } }
public class class_name { protected void handleTunnelRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException { try { String query = request.getQueryString(); if (query == null) throw new GuacamoleClientException("No query string provided."); // If connect operation, call doConnect() and return tunnel UUID // in response. if (query.equals("connect")) { GuacamoleTunnel tunnel = doConnect(request); if (tunnel != null) { // Register newly-created tunnel registerTunnel(tunnel); try { // Ensure buggy browsers do not cache response response.setHeader("Cache-Control", "no-cache"); // Send UUID to client response.getWriter().print(tunnel.getUUID().toString()); } catch (IOException e) { throw new GuacamoleServerException(e); } } // Failed to connect else throw new GuacamoleResourceNotFoundException("No tunnel created."); } // If read operation, call doRead() with tunnel UUID, ignoring any // characters following the tunnel UUID. else if (query.startsWith(READ_PREFIX)) doRead(request, response, query.substring( READ_PREFIX_LENGTH, READ_PREFIX_LENGTH + UUID_LENGTH)); // If write operation, call doWrite() with tunnel UUID, ignoring any // characters following the tunnel UUID. else if (query.startsWith(WRITE_PREFIX)) doWrite(request, response, query.substring( WRITE_PREFIX_LENGTH, WRITE_PREFIX_LENGTH + UUID_LENGTH)); // Otherwise, invalid operation else throw new GuacamoleClientException("Invalid tunnel operation: " + query); } // Catch any thrown guacamole exception and attempt to pass within the // HTTP response, logging each error appropriately. catch (GuacamoleClientException e) { logger.warn("HTTP tunnel request rejected: {}", e.getMessage()); sendError(response, e.getStatus().getGuacamoleStatusCode(), e.getStatus().getHttpStatusCode(), e.getMessage()); } catch (GuacamoleException e) { logger.error("HTTP tunnel request failed: {}", e.getMessage()); logger.debug("Internal error in HTTP tunnel.", e); sendError(response, e.getStatus().getGuacamoleStatusCode(), e.getStatus().getHttpStatusCode(), "Internal server error."); } } }
public class class_name { protected void handleTunnelRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException { try { String query = request.getQueryString(); if (query == null) throw new GuacamoleClientException("No query string provided."); // If connect operation, call doConnect() and return tunnel UUID // in response. if (query.equals("connect")) { GuacamoleTunnel tunnel = doConnect(request); if (tunnel != null) { // Register newly-created tunnel registerTunnel(tunnel); // depends on control dependency: [if], data = [(tunnel] try { // Ensure buggy browsers do not cache response response.setHeader("Cache-Control", "no-cache"); // depends on control dependency: [try], data = [none] // Send UUID to client response.getWriter().print(tunnel.getUUID().toString()); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new GuacamoleServerException(e); } // depends on control dependency: [catch], data = [none] } // Failed to connect else throw new GuacamoleResourceNotFoundException("No tunnel created."); } // If read operation, call doRead() with tunnel UUID, ignoring any // characters following the tunnel UUID. else if (query.startsWith(READ_PREFIX)) doRead(request, response, query.substring( READ_PREFIX_LENGTH, READ_PREFIX_LENGTH + UUID_LENGTH)); // If write operation, call doWrite() with tunnel UUID, ignoring any // characters following the tunnel UUID. else if (query.startsWith(WRITE_PREFIX)) doWrite(request, response, query.substring( WRITE_PREFIX_LENGTH, WRITE_PREFIX_LENGTH + UUID_LENGTH)); // Otherwise, invalid operation else throw new GuacamoleClientException("Invalid tunnel operation: " + query); } // Catch any thrown guacamole exception and attempt to pass within the // HTTP response, logging each error appropriately. catch (GuacamoleClientException e) { logger.warn("HTTP tunnel request rejected: {}", e.getMessage()); sendError(response, e.getStatus().getGuacamoleStatusCode(), e.getStatus().getHttpStatusCode(), e.getMessage()); } catch (GuacamoleException e) { logger.error("HTTP tunnel request failed: {}", e.getMessage()); logger.debug("Internal error in HTTP tunnel.", e); sendError(response, e.getStatus().getGuacamoleStatusCode(), e.getStatus().getHttpStatusCode(), "Internal server error."); } } }
public class class_name { public String getUserName(Subject subject) { // Subject subject = null; try { // subject = WSSubject.getRunAsSubject(); WSCredential wsCred = getWSCredential(subject); if (wsCred == null) { wsCred = getPrivateWSCredential(subject); } return wsCred != null ? wsCred.getSecurityName() : null; } catch (Exception e) { // ffdc return null; } } }
public class class_name { public String getUserName(Subject subject) { // Subject subject = null; try { // subject = WSSubject.getRunAsSubject(); WSCredential wsCred = getWSCredential(subject); if (wsCred == null) { wsCred = getPrivateWSCredential(subject); // depends on control dependency: [if], data = [none] } return wsCred != null ? wsCred.getSecurityName() : null; // depends on control dependency: [try], data = [none] } catch (Exception e) { // ffdc return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean hasCircleReference(Map<AVObject, Boolean> markMap) { if (null == markMap) { return false; } markMap.put(this, true); boolean rst = false; for (ObjectFieldOperation op: operations.values()) { rst = rst || op.checkCircleReference(markMap); } return rst; } }
public class class_name { public boolean hasCircleReference(Map<AVObject, Boolean> markMap) { if (null == markMap) { return false; // depends on control dependency: [if], data = [none] } markMap.put(this, true); boolean rst = false; for (ObjectFieldOperation op: operations.values()) { rst = rst || op.checkCircleReference(markMap); // depends on control dependency: [for], data = [op] } return rst; } }
public class class_name { public ServiceCall<Profile> profile(ProfileOptions profileOptions) { Validator.notNull(profileOptions, "profileOptions cannot be null"); String[] pathSegments = { "v3/profile" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("personality_insights", "v3", "profile"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); if (profileOptions.contentLanguage() != null) { builder.header("Content-Language", profileOptions.contentLanguage()); } if (profileOptions.acceptLanguage() != null) { builder.header("Accept-Language", profileOptions.acceptLanguage()); } if (profileOptions.contentType() != null) { builder.header("Content-Type", profileOptions.contentType()); } if (profileOptions.rawScores() != null) { builder.query("raw_scores", String.valueOf(profileOptions.rawScores())); } if (profileOptions.csvHeaders() != null) { builder.query("csv_headers", String.valueOf(profileOptions.csvHeaders())); } if (profileOptions.consumptionPreferences() != null) { builder.query("consumption_preferences", String.valueOf(profileOptions.consumptionPreferences())); } builder.bodyContent(profileOptions.contentType(), profileOptions.content(), null, profileOptions.body()); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Profile.class)); } }
public class class_name { public ServiceCall<Profile> profile(ProfileOptions profileOptions) { Validator.notNull(profileOptions, "profileOptions cannot be null"); String[] pathSegments = { "v3/profile" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("personality_insights", "v3", "profile"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); if (profileOptions.contentLanguage() != null) { builder.header("Content-Language", profileOptions.contentLanguage()); // depends on control dependency: [if], data = [none] } if (profileOptions.acceptLanguage() != null) { builder.header("Accept-Language", profileOptions.acceptLanguage()); // depends on control dependency: [if], data = [none] } if (profileOptions.contentType() != null) { builder.header("Content-Type", profileOptions.contentType()); // depends on control dependency: [if], data = [none] } if (profileOptions.rawScores() != null) { builder.query("raw_scores", String.valueOf(profileOptions.rawScores())); // depends on control dependency: [if], data = [(profileOptions.rawScores()] } if (profileOptions.csvHeaders() != null) { builder.query("csv_headers", String.valueOf(profileOptions.csvHeaders())); // depends on control dependency: [if], data = [(profileOptions.csvHeaders()] } if (profileOptions.consumptionPreferences() != null) { builder.query("consumption_preferences", String.valueOf(profileOptions.consumptionPreferences())); // depends on control dependency: [if], data = [(profileOptions.consumptionPreferences()] } builder.bodyContent(profileOptions.contentType(), profileOptions.content(), null, profileOptions.body()); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Profile.class)); } }
public class class_name { @Override public void actionCommit() { List errors = new ArrayList(); try { // get the correct module String moduleName = getParamModule(); CmsModule module = (CmsModule)OpenCms.getModuleManager().getModule(moduleName).clone(); // get the current dependencies from the module List oldDependencies = module.getDependencies(); // now loop through the dependencies and create the new list of dependencies List newDependencies = new ArrayList(); Iterator i = oldDependencies.iterator(); while (i.hasNext()) { CmsModuleDependency dep = (CmsModuleDependency)i.next(); if (!dep.getName().equals(m_dependency.getName())) { newDependencies.add(dep); } } // update the dependencies newDependencies.add(m_dependency); module.setDependencies(newDependencies); // update the module OpenCms.getModuleManager().updateModule(getCms(), module); // refresh the list Map objects = (Map)getSettings().getListObject(); if (objects != null) { objects.remove(CmsModulesList.class.getName()); objects.remove(CmsModulesDependenciesList.class.getName()); } } catch (CmsConfigurationException ce) { errors.add(ce); } catch (CmsSecurityException se) { errors.add(se); } // set the list of errors to display when saving failed setCommitErrors(errors); } }
public class class_name { @Override public void actionCommit() { List errors = new ArrayList(); try { // get the correct module String moduleName = getParamModule(); CmsModule module = (CmsModule)OpenCms.getModuleManager().getModule(moduleName).clone(); // get the current dependencies from the module List oldDependencies = module.getDependencies(); // now loop through the dependencies and create the new list of dependencies List newDependencies = new ArrayList(); Iterator i = oldDependencies.iterator(); while (i.hasNext()) { CmsModuleDependency dep = (CmsModuleDependency)i.next(); if (!dep.getName().equals(m_dependency.getName())) { newDependencies.add(dep); // depends on control dependency: [if], data = [none] } } // update the dependencies newDependencies.add(m_dependency); // depends on control dependency: [try], data = [none] module.setDependencies(newDependencies); // depends on control dependency: [try], data = [none] // update the module OpenCms.getModuleManager().updateModule(getCms(), module); // depends on control dependency: [try], data = [none] // refresh the list Map objects = (Map)getSettings().getListObject(); if (objects != null) { objects.remove(CmsModulesList.class.getName()); // depends on control dependency: [if], data = [none] objects.remove(CmsModulesDependenciesList.class.getName()); // depends on control dependency: [if], data = [none] } } catch (CmsConfigurationException ce) { errors.add(ce); } catch (CmsSecurityException se) { // depends on control dependency: [catch], data = [none] errors.add(se); } // depends on control dependency: [catch], data = [none] // set the list of errors to display when saving failed setCommitErrors(errors); } }
public class class_name { protected void deactivate(ComponentContext compcontext) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Deactivating " + this.getClass().getName()); } setInstance(null); this.beanValidation.deactivate(compcontext); } }
public class class_name { protected void deactivate(ComponentContext compcontext) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Deactivating " + this.getClass().getName()); // depends on control dependency: [if], data = [none] } setInstance(null); this.beanValidation.deactivate(compcontext); } }