code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public synchronized void start() throws SocketException { if (!isRunning()) { socket.set(new DatagramSocket(ANNOUNCEMENT_PORT)); startTime.set(System.currentTimeMillis()); deliverLifecycleAnnouncement(logger, true); final byte[] buffer = new byte[512]; final DatagramPacket packet = new DatagramPacket(buffer, buffer.length); Thread receiver = new Thread(null, new Runnable() { @Override public void run() { boolean received; while (isRunning()) { try { if (getCurrentDevices().isEmpty()) { socket.get().setSoTimeout(60000); // We have no devices to check for timeout; block for a whole minute to check for shutdown } else { socket.get().setSoTimeout(1000); // Check every second to see if a device has vanished } socket.get().receive(packet); received = !ignoredAddresses.contains(packet.getAddress()); } catch (SocketTimeoutException ste) { received = false; } catch (IOException e) { // Don't log a warning if the exception was due to the socket closing at shutdown. if (isRunning()) { // We did not expect to have a problem; log a warning and shut down. logger.warn("Problem reading from DeviceAnnouncement socket, stopping", e); stop(); } received = false; } try { if (received && (packet.getLength() == 54)) { final Util.PacketType kind = Util.validateHeader(packet, ANNOUNCEMENT_PORT); if (kind == Util.PacketType.DEVICE_KEEP_ALIVE) { // Looks like the kind of packet we need if (packet.getLength() < 54) { logger.warn("Ignoring too-short " + kind.name + " packet; expected 54 bytes, but only got " + packet.getLength() + "."); } else { if (packet.getLength() > 54) { logger.warn("Processing too-long " + kind.name + " packet; expected 54 bytes, but got " + packet.getLength() + "."); } DeviceAnnouncement announcement = new DeviceAnnouncement(packet); final boolean foundNewDevice = isDeviceNew(announcement); updateDevices(announcement); if (foundNewDevice) { deliverFoundAnnouncement(announcement); } } } } expireDevices(); } catch (Throwable t) { logger.warn("Problem processing DeviceAnnouncement packet", t); } } } }, "beat-link DeviceFinder receiver"); receiver.setDaemon(true); receiver.start(); } } }
public class class_name { public synchronized void start() throws SocketException { if (!isRunning()) { socket.set(new DatagramSocket(ANNOUNCEMENT_PORT)); startTime.set(System.currentTimeMillis()); deliverLifecycleAnnouncement(logger, true); final byte[] buffer = new byte[512]; final DatagramPacket packet = new DatagramPacket(buffer, buffer.length); Thread receiver = new Thread(null, new Runnable() { @Override public void run() { boolean received; while (isRunning()) { try { if (getCurrentDevices().isEmpty()) { socket.get().setSoTimeout(60000); // We have no devices to check for timeout; block for a whole minute to check for shutdown // depends on control dependency: [if], data = [none] } else { socket.get().setSoTimeout(1000); // Check every second to see if a device has vanished // depends on control dependency: [if], data = [none] } socket.get().receive(packet); // depends on control dependency: [try], data = [none] received = !ignoredAddresses.contains(packet.getAddress()); // depends on control dependency: [try], data = [none] } catch (SocketTimeoutException ste) { received = false; } catch (IOException e) { // depends on control dependency: [catch], data = [none] // Don't log a warning if the exception was due to the socket closing at shutdown. if (isRunning()) { // We did not expect to have a problem; log a warning and shut down. logger.warn("Problem reading from DeviceAnnouncement socket, stopping", e); // depends on control dependency: [if], data = [none] stop(); // depends on control dependency: [if], data = [none] } received = false; } // depends on control dependency: [catch], data = [none] try { if (received && (packet.getLength() == 54)) { final Util.PacketType kind = Util.validateHeader(packet, ANNOUNCEMENT_PORT); if (kind == Util.PacketType.DEVICE_KEEP_ALIVE) { // Looks like the kind of packet we need if (packet.getLength() < 54) { logger.warn("Ignoring too-short " + kind.name + " packet; expected 54 bytes, but only got " + packet.getLength() + "."); // depends on control dependency: [if], data = [none] } else { if (packet.getLength() > 54) { logger.warn("Processing too-long " + kind.name + " packet; expected 54 bytes, but got " + packet.getLength() + "."); // depends on control dependency: [if], data = [none] } DeviceAnnouncement announcement = new DeviceAnnouncement(packet); final boolean foundNewDevice = isDeviceNew(announcement); updateDevices(announcement); // depends on control dependency: [if], data = [none] if (foundNewDevice) { deliverFoundAnnouncement(announcement); // depends on control dependency: [if], data = [none] } } } } expireDevices(); // depends on control dependency: [try], data = [none] } catch (Throwable t) { logger.warn("Problem processing DeviceAnnouncement packet", t); } // depends on control dependency: [catch], data = [none] } } }, "beat-link DeviceFinder receiver"); receiver.setDaemon(true); receiver.start(); } } }
public class class_name { @Override public String getFxmlPath() { final StringBuilder sb = new StringBuilder(); if (!absolutePath().isEmpty()) { sb.append(absolutePath()).append(Resources.PATH_SEP); } sb.append(fxmlName()); return sb.toString(); } }
public class class_name { @Override public String getFxmlPath() { final StringBuilder sb = new StringBuilder(); if (!absolutePath().isEmpty()) { sb.append(absolutePath()).append(Resources.PATH_SEP); // depends on control dependency: [if], data = [none] } sb.append(fxmlName()); return sb.toString(); } }
public class class_name { public void executeDeleteRecord(OIdentifiable record, final int iVersion, final boolean iRequired, final OPERATION_MODE iMode, boolean prohibitTombstones) { checkOpenness(); checkIfActive(); final ORecordId rid = (ORecordId) record.getIdentity(); if (rid == null) throw new ODatabaseException( "Cannot delete record because it has no identity. Probably was created from scratch or contains projections of fields rather than a full record"); if (!rid.isValid()) return; record = record.getRecord(); if (record == null) return; final OMicroTransaction microTx = beginMicroTransaction(); try { microTx.deleteRecord(record.getRecord(), iMode); } catch (Exception e) { endMicroTransaction(false); throw e; } endMicroTransaction(true); return; } }
public class class_name { public void executeDeleteRecord(OIdentifiable record, final int iVersion, final boolean iRequired, final OPERATION_MODE iMode, boolean prohibitTombstones) { checkOpenness(); checkIfActive(); final ORecordId rid = (ORecordId) record.getIdentity(); if (rid == null) throw new ODatabaseException( "Cannot delete record because it has no identity. Probably was created from scratch or contains projections of fields rather than a full record"); if (!rid.isValid()) return; record = record.getRecord(); if (record == null) return; final OMicroTransaction microTx = beginMicroTransaction(); try { microTx.deleteRecord(record.getRecord(), iMode); // depends on control dependency: [try], data = [none] } catch (Exception e) { endMicroTransaction(false); throw e; } // depends on control dependency: [catch], data = [none] endMicroTransaction(true); return; } }
public class class_name { public void firePutNotification(Iterator<RegistryListener<K, V>> listeners, K putKey, V putValue) { while (listeners.hasNext() ) { listeners.next().onPutEntry(putKey, putValue); } } }
public class class_name { public void firePutNotification(Iterator<RegistryListener<K, V>> listeners, K putKey, V putValue) { while (listeners.hasNext() ) { listeners.next().onPutEntry(putKey, putValue); // depends on control dependency: [while], data = [none] } } }
public class class_name { private BeanReferences[] buildDefaultReferences(final Executable methodOrCtor) { final boolean useParamo = petiteConfig.getUseParamo(); final PetiteReferenceType[] lookupReferences = petiteConfig.getLookupReferences(); MethodParameter[] methodParameters = null; if (useParamo) { methodParameters = Paramo.resolveParameters(methodOrCtor); } final Class[] paramTypes = methodOrCtor.getParameterTypes(); final BeanReferences[] references = new BeanReferences[paramTypes.length]; for (int j = 0; j < paramTypes.length; j++) { String[] ref = new String[lookupReferences.length]; references[j] = BeanReferences.of(ref); for (int i = 0; i < ref.length; i++) { switch (lookupReferences[i]) { case NAME: ref[i] = methodParameters != null ? methodParameters[j].getName() : null; break; case TYPE_SHORT_NAME: ref[i] = StringUtil.uncapitalize(paramTypes[j].getSimpleName()); break; case TYPE_FULL_NAME: ref[i] = paramTypes[j].getName(); break; } } } return references; } }
public class class_name { private BeanReferences[] buildDefaultReferences(final Executable methodOrCtor) { final boolean useParamo = petiteConfig.getUseParamo(); final PetiteReferenceType[] lookupReferences = petiteConfig.getLookupReferences(); MethodParameter[] methodParameters = null; if (useParamo) { methodParameters = Paramo.resolveParameters(methodOrCtor); // depends on control dependency: [if], data = [none] } final Class[] paramTypes = methodOrCtor.getParameterTypes(); final BeanReferences[] references = new BeanReferences[paramTypes.length]; for (int j = 0; j < paramTypes.length; j++) { String[] ref = new String[lookupReferences.length]; references[j] = BeanReferences.of(ref); // depends on control dependency: [for], data = [j] for (int i = 0; i < ref.length; i++) { switch (lookupReferences[i]) { case NAME: ref[i] = methodParameters != null ? methodParameters[j].getName() : null; break; case TYPE_SHORT_NAME: ref[i] = StringUtil.uncapitalize(paramTypes[j].getSimpleName()); break; case TYPE_FULL_NAME: ref[i] = paramTypes[j].getName(); break; } } } return references; } }
public class class_name { public List<FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>> getAllMapEntry() { List<FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>> list = new ArrayList<FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>>(); List<Node> nodeList = childNode.get("map-entry"); for(Node node: nodeList) { FacesConfigMapEntryType<FacesConfigMapEntriesType<T>> type = new FacesConfigMapEntryTypeImpl<FacesConfigMapEntriesType<T>>(this, "map-entry", childNode, node); list.add(type); } return list; } }
public class class_name { public List<FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>> getAllMapEntry() { List<FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>> list = new ArrayList<FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>>(); List<Node> nodeList = childNode.get("map-entry"); for(Node node: nodeList) { FacesConfigMapEntryType<FacesConfigMapEntriesType<T>> type = new FacesConfigMapEntryTypeImpl<FacesConfigMapEntriesType<T>>(this, "map-entry", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { protected Observable<DocumentFragment<Lookup>> doMultiLookup(final long timeout, final TimeUnit timeUnit) { if (specs.isEmpty()) { throw new IllegalArgumentException("At least one Lookup Command is necessary for lookupIn"); } boolean seenNonXattr = false; for (LookupSpec spec : specs) { if (spec.xattr() && seenNonXattr) { throw new XattrOrderingException("Xattr-based commands must always come first in the builder!"); } else if (!spec.xattr()) { seenNonXattr = true; } } final LookupSpec[] lookupSpecs = specs.toArray(new LookupSpec[specs.size()]); return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() { @Override public Observable<DocumentFragment<Lookup>> call() { final SubMultiLookupRequest request = new SubMultiLookupRequest( docId, bucketName, SubMultiLookupDocOptionsBuilder.builder().accessDeleted(accessDeleted), lookupSpecs ); addRequestSpan(environment, request, "subdoc_multi_lookup"); return applyTimeout(deferAndWatch(new Func1<Subscriber, Observable<MultiLookupResponse>>() { @Override public Observable<MultiLookupResponse> call(Subscriber s) { request.subscriber(s); return core.send(request); } }).filter(new Func1<MultiLookupResponse, Boolean>() { @Override public Boolean call(MultiLookupResponse response) { if (response.status().isSuccess() || response.status() == ResponseStatus.SUBDOC_MULTI_PATH_FAILURE) { return true; } if (response.content() != null && response.content().refCnt() > 0) { response.content().release(); } throw SubdocHelper.commonSubdocErrors(response.status(), docId, "MULTI-LOOKUP"); } }).flatMap(new Func1<MultiLookupResponse, Observable<DocumentFragment<Lookup>>>() { @Override public Observable<DocumentFragment<Lookup>> call(final MultiLookupResponse mlr) { return Observable .from(mlr.responses()).map(multiCoreResultToLookupResult) .toList() .map(new Func1<List<SubdocOperationResult<Lookup>>, DocumentFragment<Lookup>>() { @Override public DocumentFragment<Lookup> call(List<SubdocOperationResult<Lookup>> lookupResults) { return new DocumentFragment<Lookup>(docId, mlr.cas(), null, lookupResults); } }).doOnTerminate(new Action0() { @Override public void call() { if (environment.operationTracingEnabled()) { environment.tracer().scopeManager() .activate(mlr.request().span(), true) .close(); } } }); } }), request, environment, timeout, timeUnit); } }); } }
public class class_name { protected Observable<DocumentFragment<Lookup>> doMultiLookup(final long timeout, final TimeUnit timeUnit) { if (specs.isEmpty()) { throw new IllegalArgumentException("At least one Lookup Command is necessary for lookupIn"); } boolean seenNonXattr = false; for (LookupSpec spec : specs) { if (spec.xattr() && seenNonXattr) { throw new XattrOrderingException("Xattr-based commands must always come first in the builder!"); } else if (!spec.xattr()) { seenNonXattr = true; // depends on control dependency: [if], data = [none] } } final LookupSpec[] lookupSpecs = specs.toArray(new LookupSpec[specs.size()]); return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() { @Override public Observable<DocumentFragment<Lookup>> call() { final SubMultiLookupRequest request = new SubMultiLookupRequest( docId, bucketName, SubMultiLookupDocOptionsBuilder.builder().accessDeleted(accessDeleted), lookupSpecs ); addRequestSpan(environment, request, "subdoc_multi_lookup"); return applyTimeout(deferAndWatch(new Func1<Subscriber, Observable<MultiLookupResponse>>() { @Override public Observable<MultiLookupResponse> call(Subscriber s) { request.subscriber(s); return core.send(request); } }).filter(new Func1<MultiLookupResponse, Boolean>() { @Override public Boolean call(MultiLookupResponse response) { if (response.status().isSuccess() || response.status() == ResponseStatus.SUBDOC_MULTI_PATH_FAILURE) { return true; // depends on control dependency: [if], data = [none] } if (response.content() != null && response.content().refCnt() > 0) { response.content().release(); // depends on control dependency: [if], data = [none] } throw SubdocHelper.commonSubdocErrors(response.status(), docId, "MULTI-LOOKUP"); } }).flatMap(new Func1<MultiLookupResponse, Observable<DocumentFragment<Lookup>>>() { @Override public Observable<DocumentFragment<Lookup>> call(final MultiLookupResponse mlr) { return Observable .from(mlr.responses()).map(multiCoreResultToLookupResult) .toList() .map(new Func1<List<SubdocOperationResult<Lookup>>, DocumentFragment<Lookup>>() { @Override public DocumentFragment<Lookup> call(List<SubdocOperationResult<Lookup>> lookupResults) { return new DocumentFragment<Lookup>(docId, mlr.cas(), null, lookupResults); } }).doOnTerminate(new Action0() { @Override public void call() { if (environment.operationTracingEnabled()) { environment.tracer().scopeManager() .activate(mlr.request().span(), true) .close(); // depends on control dependency: [if], data = [none] } } }); } }), request, environment, timeout, timeUnit); } }); } }
public class class_name { boolean documentVersion(String version) { if (!lazyInitDocumentation()) { return true; } if (documentation.version != null) { return false; } documentation.version = version; return true; } }
public class class_name { boolean documentVersion(String version) { if (!lazyInitDocumentation()) { return true; // depends on control dependency: [if], data = [none] } if (documentation.version != null) { return false; // depends on control dependency: [if], data = [none] } documentation.version = version; return true; } }
public class class_name { protected void resetNextIndex(MemberState member) { if (member.getMatchIndex() != 0) { member.setNextIndex(member.getMatchIndex() + 1); } else { member.setNextIndex(context.getLog().firstIndex()); } logger.trace("{} - Reset next index for {} to {}", context.getCluster().member().address(), member, member.getNextIndex()); } }
public class class_name { protected void resetNextIndex(MemberState member) { if (member.getMatchIndex() != 0) { member.setNextIndex(member.getMatchIndex() + 1); // depends on control dependency: [if], data = [(member.getMatchIndex()] } else { member.setNextIndex(context.getLog().firstIndex()); // depends on control dependency: [if], data = [none] } logger.trace("{} - Reset next index for {} to {}", context.getCluster().member().address(), member, member.getNextIndex()); } }
public class class_name { public static List<Map<String, Object>> nest(String key, Dictionary<String, Object> map) { List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); String patternString = MessageFormat.format("^{0}\\.([0-9]*)\\.(.*)", Pattern.quote(key)); Pattern pattern = Pattern.compile(patternString); for (Enumeration<String> e = map.keys(); e.hasMoreElements();) { String k = e.nextElement(); Matcher matcher = pattern.matcher(k); if (matcher.matches()) { int base = 0; processMatch(result, map.get(k), matcher, base); } } return result; } }
public class class_name { public static List<Map<String, Object>> nest(String key, Dictionary<String, Object> map) { List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); String patternString = MessageFormat.format("^{0}\\.([0-9]*)\\.(.*)", Pattern.quote(key)); Pattern pattern = Pattern.compile(patternString); for (Enumeration<String> e = map.keys(); e.hasMoreElements();) { String k = e.nextElement(); Matcher matcher = pattern.matcher(k); if (matcher.matches()) { int base = 0; processMatch(result, map.get(k), matcher, base); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { @Override public Map<String, List<CloudInstance>> getCloudInstances(CloudInstanceRepository repository) { DescribeInstancesResult instanceResult; if (null == settings.getFilters() || settings.getFilters().isEmpty() ) { instanceResult = ec2Client.describeInstances(); } else { instanceResult = ec2Client.describeInstances(buildFilterRequest(settings.getFilters())); } DescribeAutoScalingInstancesResult autoScaleResult = autoScalingClient.describeAutoScalingInstances(); List<AutoScalingInstanceDetails> autoScalingInstanceDetails = autoScaleResult.getAutoScalingInstances(); Map<String, String> autoScaleMap = new HashMap<>(); for (AutoScalingInstanceDetails ai : autoScalingInstanceDetails) { autoScaleMap.put(ai.getInstanceId(), ai.getAutoScalingGroupName()); } Map<String, List<Instance>> ownerInstanceMap = new HashMap<>(); List<Instance> instanceList = new ArrayList<>(); List<Reservation> reservations = instanceResult.getReservations(); for (Reservation currRes : reservations) { List<Instance> currInstanceList = currRes.getInstances(); if (CollectionUtils.isEmpty(ownerInstanceMap.get(currRes.getOwnerId()))) { ownerInstanceMap.put(currRes.getOwnerId(), currRes.getInstances()); } else { ownerInstanceMap.get(currRes.getOwnerId()).addAll(currRes.getInstances()); } instanceList.addAll(currInstanceList); } Map<String, List<CloudInstance>> returnList = new HashMap<>(); int i = 0; for (String acct : ownerInstanceMap.keySet()) { ArrayList<CloudInstance> rawDataList = new ArrayList<>(); for (Instance currInstance : ownerInstanceMap.get(acct)) { i = i + 1; LOGGER.info("Collecting instance details for " + i + " of " + instanceList.size() + ". Instance ID=" + currInstance.getInstanceId()); CloudInstance object = getCloudInstanceDetails(acct, currInstance, autoScaleMap, repository); rawDataList.add(object); } if (CollectionUtils.isEmpty(returnList.get(acct))) { returnList.put(acct, rawDataList); } else { returnList.get(acct).addAll(rawDataList); } } return returnList; } }
public class class_name { @Override public Map<String, List<CloudInstance>> getCloudInstances(CloudInstanceRepository repository) { DescribeInstancesResult instanceResult; if (null == settings.getFilters() || settings.getFilters().isEmpty() ) { instanceResult = ec2Client.describeInstances(); // depends on control dependency: [if], data = [none] } else { instanceResult = ec2Client.describeInstances(buildFilterRequest(settings.getFilters())); // depends on control dependency: [if], data = [none] } DescribeAutoScalingInstancesResult autoScaleResult = autoScalingClient.describeAutoScalingInstances(); List<AutoScalingInstanceDetails> autoScalingInstanceDetails = autoScaleResult.getAutoScalingInstances(); Map<String, String> autoScaleMap = new HashMap<>(); for (AutoScalingInstanceDetails ai : autoScalingInstanceDetails) { autoScaleMap.put(ai.getInstanceId(), ai.getAutoScalingGroupName()); // depends on control dependency: [for], data = [ai] } Map<String, List<Instance>> ownerInstanceMap = new HashMap<>(); List<Instance> instanceList = new ArrayList<>(); List<Reservation> reservations = instanceResult.getReservations(); for (Reservation currRes : reservations) { List<Instance> currInstanceList = currRes.getInstances(); if (CollectionUtils.isEmpty(ownerInstanceMap.get(currRes.getOwnerId()))) { ownerInstanceMap.put(currRes.getOwnerId(), currRes.getInstances()); // depends on control dependency: [if], data = [none] } else { ownerInstanceMap.get(currRes.getOwnerId()).addAll(currRes.getInstances()); // depends on control dependency: [if], data = [none] } instanceList.addAll(currInstanceList); // depends on control dependency: [for], data = [none] } Map<String, List<CloudInstance>> returnList = new HashMap<>(); int i = 0; for (String acct : ownerInstanceMap.keySet()) { ArrayList<CloudInstance> rawDataList = new ArrayList<>(); for (Instance currInstance : ownerInstanceMap.get(acct)) { i = i + 1; // depends on control dependency: [for], data = [none] LOGGER.info("Collecting instance details for " + i + " of " + instanceList.size() + ". Instance ID=" + currInstance.getInstanceId()); // depends on control dependency: [for], data = [none] CloudInstance object = getCloudInstanceDetails(acct, currInstance, autoScaleMap, repository); rawDataList.add(object); // depends on control dependency: [for], data = [none] } if (CollectionUtils.isEmpty(returnList.get(acct))) { returnList.put(acct, rawDataList); // depends on control dependency: [if], data = [none] } else { returnList.get(acct).addAll(rawDataList); // depends on control dependency: [if], data = [none] } } return returnList; } }
public class class_name { private int findBitRate(int bitrateIndex, int version, int layer) { int ind = -1; if (version == MPEG_V_1) { if (layer == MPEG_L_1) { ind = 0; } else if (layer == MPEG_L_2) { ind = 1; } else if (layer == MPEG_L_3) { ind = 2; } } else if ((version == MPEG_V_2) || (version == MPEG_V_25)) { if (layer == MPEG_L_1) { ind = 3; } else if ((layer == MPEG_L_2) || (layer == MPEG_L_3)) { ind = 4; } } if ((ind != -1) && (bitrateIndex >= 0) && (bitrateIndex <= 15)) { return bitrateTable[bitrateIndex][ind]; } return -1; } }
public class class_name { private int findBitRate(int bitrateIndex, int version, int layer) { int ind = -1; if (version == MPEG_V_1) { if (layer == MPEG_L_1) { ind = 0; // depends on control dependency: [if], data = [none] } else if (layer == MPEG_L_2) { ind = 1; // depends on control dependency: [if], data = [none] } else if (layer == MPEG_L_3) { ind = 2; // depends on control dependency: [if], data = [none] } } else if ((version == MPEG_V_2) || (version == MPEG_V_25)) { if (layer == MPEG_L_1) { ind = 3; // depends on control dependency: [if], data = [none] } else if ((layer == MPEG_L_2) || (layer == MPEG_L_3)) { ind = 4; // depends on control dependency: [if], data = [none] } } if ((ind != -1) && (bitrateIndex >= 0) && (bitrateIndex <= 15)) { return bitrateTable[bitrateIndex][ind]; // depends on control dependency: [if], data = [none] } return -1; } }
public class class_name { public OrientGraphNoTx getNoTx() { final OrientGraphNoTx g; if (pool == null) { g = (OrientGraphNoTx) getNoTxGraphImplFactory().getGraph(getDatabase(), user, password, settings); } else { // USE THE POOL g = (OrientGraphNoTx) getNoTxGraphImplFactory().getGraph(pool, settings); } initGraph(g); return g; } }
public class class_name { public OrientGraphNoTx getNoTx() { final OrientGraphNoTx g; if (pool == null) { g = (OrientGraphNoTx) getNoTxGraphImplFactory().getGraph(getDatabase(), user, password, settings); // depends on control dependency: [if], data = [none] } else { // USE THE POOL g = (OrientGraphNoTx) getNoTxGraphImplFactory().getGraph(pool, settings); // depends on control dependency: [if], data = [(pool] } initGraph(g); return g; } }
public class class_name { public static long memoryAddress(ByteBuffer buffer) { assert buffer.isDirect(); if (PlatformDependent.hasUnsafe()) { return PlatformDependent.directBufferAddress(buffer); } return memoryAddress0(buffer); } }
public class class_name { public static long memoryAddress(ByteBuffer buffer) { assert buffer.isDirect(); if (PlatformDependent.hasUnsafe()) { return PlatformDependent.directBufferAddress(buffer); // depends on control dependency: [if], data = [none] } return memoryAddress0(buffer); } }
public class class_name { public void updateModulesFromUpdateBean() throws Exception { // read here how the list of modules to be installed is passed from the setup bean to the // setup thread, and finally to the shell process that executes the setup script: // 1) the list with the package names of the modules to be installed is saved by setInstallModules // 2) the setup thread gets initialized in a JSP of the setup wizard // 3) the instance of the setup bean is passed to the setup thread by setAdditionalShellCommand // 4) the setup bean is passed to the shell by startSetup // 5) because the setup bean implements I_CmsShellCommands, the shell constructor can pass the shell's CmsObject back to the setup bean // 6) thus, the setup bean can do things with the Cms if (m_cms != null) { I_CmsReport report = new CmsShellReport(m_cms.getRequestContext().getLocale()); // remove obsolete modules in any case for (String moduleToRemove : getModulesToDelete()) { removeModule(moduleToRemove, report); } // check if there are any modules to install if (m_installModules != null) { Set<String> utdModules = new HashSet<String>(getUptodateModules()); List<String> installList = Lists.newArrayList(m_installModules); for (String name : installList) { if (!utdModules.contains(name)) { String filename = m_moduleFilenames.get(name); try { updateModule(name, filename, report); } catch (Exception e) { // log a exception during module import, but make sure the next module is still imported e.printStackTrace(System.err); } } else { report.println( Messages.get().container(Messages.RPT_MODULE_UPTODATE_1, name), I_CmsReport.FORMAT_HEADLINE); } } } } } }
public class class_name { public void updateModulesFromUpdateBean() throws Exception { // read here how the list of modules to be installed is passed from the setup bean to the // setup thread, and finally to the shell process that executes the setup script: // 1) the list with the package names of the modules to be installed is saved by setInstallModules // 2) the setup thread gets initialized in a JSP of the setup wizard // 3) the instance of the setup bean is passed to the setup thread by setAdditionalShellCommand // 4) the setup bean is passed to the shell by startSetup // 5) because the setup bean implements I_CmsShellCommands, the shell constructor can pass the shell's CmsObject back to the setup bean // 6) thus, the setup bean can do things with the Cms if (m_cms != null) { I_CmsReport report = new CmsShellReport(m_cms.getRequestContext().getLocale()); // remove obsolete modules in any case for (String moduleToRemove : getModulesToDelete()) { removeModule(moduleToRemove, report); } // check if there are any modules to install if (m_installModules != null) { Set<String> utdModules = new HashSet<String>(getUptodateModules()); List<String> installList = Lists.newArrayList(m_installModules); for (String name : installList) { if (!utdModules.contains(name)) { String filename = m_moduleFilenames.get(name); try { updateModule(name, filename, report); // depends on control dependency: [try], data = [none] } catch (Exception e) { // log a exception during module import, but make sure the next module is still imported e.printStackTrace(System.err); } // depends on control dependency: [catch], data = [none] } else { report.println( Messages.get().container(Messages.RPT_MODULE_UPTODATE_1, name), I_CmsReport.FORMAT_HEADLINE); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public GVRAndroidResource openResource(String filePath) throws IOException { // Error tolerance: Remove initial '/' introduced by file::///filename // In this case, the path is interpreted as relative to defaultPath, // which is the root of the filesystem. if (filePath.startsWith(File.separator)) { filePath = filePath.substring(File.separator.length()); } filePath = adaptFilePath(filePath); String path; int resourceId; GVRAndroidResource resourceKey; switch (volumeType) { case ANDROID_ASSETS: // Resolve '..' and '.' path = getFullPath(defaultPath, filePath); path = new File(path).getCanonicalPath(); if (path.startsWith(File.separator)) { path = path.substring(1); } resourceKey = new GVRAndroidResource(gvrContext, path); break; case ANDROID_RESOURCE: path = FileNameUtils.getBaseName(filePath); resourceId = gvrContext.getContext().getResources().getIdentifier(path, "raw", gvrContext.getContext().getPackageName()); if (resourceId == 0) { throw new FileNotFoundException(filePath + " resource not found"); } resourceKey = new GVRAndroidResource(gvrContext, resourceId); break; case LINUX_FILESYSTEM: resourceKey = new GVRAndroidResource( getFullPath(defaultPath, filePath)); break; case ANDROID_SDCARD: String linuxPath = Environment.getExternalStorageDirectory() .getAbsolutePath(); resourceKey = new GVRAndroidResource( getFullPath(linuxPath, defaultPath, filePath)); break; case INPUT_STREAM: resourceKey = new GVRAndroidResource(getFullPath(defaultPath, filePath), volumeInputStream); break; case NETWORK: resourceKey = new GVRAndroidResource(gvrContext, getFullURL(defaultPath, filePath), enableUrlLocalCache); break; default: throw new IOException( String.format("Unrecognized volumeType %s", volumeType)); } return addResource(resourceKey); } }
public class class_name { public GVRAndroidResource openResource(String filePath) throws IOException { // Error tolerance: Remove initial '/' introduced by file::///filename // In this case, the path is interpreted as relative to defaultPath, // which is the root of the filesystem. if (filePath.startsWith(File.separator)) { filePath = filePath.substring(File.separator.length()); } filePath = adaptFilePath(filePath); String path; int resourceId; GVRAndroidResource resourceKey; switch (volumeType) { case ANDROID_ASSETS: // Resolve '..' and '.' path = getFullPath(defaultPath, filePath); path = new File(path).getCanonicalPath(); if (path.startsWith(File.separator)) { path = path.substring(1); // depends on control dependency: [if], data = [none] } resourceKey = new GVRAndroidResource(gvrContext, path); break; case ANDROID_RESOURCE: path = FileNameUtils.getBaseName(filePath); resourceId = gvrContext.getContext().getResources().getIdentifier(path, "raw", gvrContext.getContext().getPackageName()); if (resourceId == 0) { throw new FileNotFoundException(filePath + " resource not found"); } resourceKey = new GVRAndroidResource(gvrContext, resourceId); break; case LINUX_FILESYSTEM: resourceKey = new GVRAndroidResource( getFullPath(defaultPath, filePath)); break; case ANDROID_SDCARD: String linuxPath = Environment.getExternalStorageDirectory() .getAbsolutePath(); resourceKey = new GVRAndroidResource( getFullPath(linuxPath, defaultPath, filePath)); break; case INPUT_STREAM: resourceKey = new GVRAndroidResource(getFullPath(defaultPath, filePath), volumeInputStream); break; case NETWORK: resourceKey = new GVRAndroidResource(gvrContext, getFullURL(defaultPath, filePath), enableUrlLocalCache); break; default: throw new IOException( String.format("Unrecognized volumeType %s", volumeType)); } return addResource(resourceKey); } }
public class class_name { public void setDigest(String algorithm) { try { // Reuse extant digest if its sha1 algorithm. if (this.digest == null || !this.digest.getAlgorithm().equals(algorithm)) { setDigest(MessageDigest.getInstance(algorithm)); } } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } } }
public class class_name { public void setDigest(String algorithm) { try { // Reuse extant digest if its sha1 algorithm. if (this.digest == null || !this.digest.getAlgorithm().equals(algorithm)) { setDigest(MessageDigest.getInstance(algorithm)); // depends on control dependency: [if], data = [none] } } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(DeleteEmailIdentityRequest deleteEmailIdentityRequest, ProtocolMarshaller protocolMarshaller) { if (deleteEmailIdentityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteEmailIdentityRequest.getEmailIdentity(), EMAILIDENTITY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteEmailIdentityRequest deleteEmailIdentityRequest, ProtocolMarshaller protocolMarshaller) { if (deleteEmailIdentityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteEmailIdentityRequest.getEmailIdentity(), EMAILIDENTITY_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void validate() { if (isValid != null) { return; } ParsingValidator v = new ParsingValidator(useSchema ? Languages.W3C_XML_SCHEMA_NS_URI : Languages.XML_DTD_NS_URI); List<Source> schemaSourceList = new ArrayList<Source>(); if (systemId != null) { schemaSourceList.add(new StreamSource(systemId)); } addSchemaSources(schemaSource, schemaSourceList); v.setSchemaSources(schemaSourceList.toArray(new Source[0])); try { ValidationResult r = v.validateInstance(new SAXSource(validationInputSource)); isValid = r.isValid() ? Boolean.TRUE : Boolean.FALSE; for (ValidationProblem p : r.getProblems()) { validationProblem(p); } } catch (org.xmlunit.ConfigurationException e) { throw new ConfigurationException(e.getCause()); } catch (org.xmlunit.XMLUnitException e) { throw new XMLUnitRuntimeException(e.getMessage(), e.getCause()); } if (usingDoctypeReader && isValid == Boolean.FALSE) { try { messages.append("\nContent was: ") .append(getOriginalContent(validationInputSource)); } catch (IOException e) { // silent but deadly? } } } }
public class class_name { private void validate() { if (isValid != null) { return; // depends on control dependency: [if], data = [none] } ParsingValidator v = new ParsingValidator(useSchema ? Languages.W3C_XML_SCHEMA_NS_URI : Languages.XML_DTD_NS_URI); List<Source> schemaSourceList = new ArrayList<Source>(); if (systemId != null) { schemaSourceList.add(new StreamSource(systemId)); // depends on control dependency: [if], data = [(systemId] } addSchemaSources(schemaSource, schemaSourceList); v.setSchemaSources(schemaSourceList.toArray(new Source[0])); try { ValidationResult r = v.validateInstance(new SAXSource(validationInputSource)); isValid = r.isValid() ? Boolean.TRUE : Boolean.FALSE; // depends on control dependency: [try], data = [none] for (ValidationProblem p : r.getProblems()) { validationProblem(p); // depends on control dependency: [for], data = [p] } } catch (org.xmlunit.ConfigurationException e) { throw new ConfigurationException(e.getCause()); } catch (org.xmlunit.XMLUnitException e) { // depends on control dependency: [catch], data = [none] throw new XMLUnitRuntimeException(e.getMessage(), e.getCause()); } // depends on control dependency: [catch], data = [none] if (usingDoctypeReader && isValid == Boolean.FALSE) { try { messages.append("\nContent was: ") .append(getOriginalContent(validationInputSource)); // depends on control dependency: [try], data = [none] } catch (IOException e) { // silent but deadly? } // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected final void notifyChanged() { for (int i = mObservers.size() - 1; i >= 0; i--) { mObservers.get(i).onChanged(); } } }
public class class_name { protected final void notifyChanged() { for (int i = mObservers.size() - 1; i >= 0; i--) { mObservers.get(i).onChanged(); // depends on control dependency: [for], data = [i] } } }
public class class_name { private void onInsert(EventLog log) { if (insertEvents == null) { insertEvents = new ConcurrentHashMap<Object, EventLog>(); } insertEvents.put(log.getEntityId(), log); } }
public class class_name { private void onInsert(EventLog log) { if (insertEvents == null) { insertEvents = new ConcurrentHashMap<Object, EventLog>(); // depends on control dependency: [if], data = [none] } insertEvents.put(log.getEntityId(), log); } }
public class class_name { private ModuleBootstrap[] readRegisteredPlugins(ApplicationConfig config, String pluginsPackage) { try { ClassLocator locator = new ClassLocator(pluginsPackage); return locateAll(locator, ModuleBootstrap.class, impl -> impl.bootstrap(config)); } catch (IllegalArgumentException e) { logger.warn("Did not find any " + ModuleBootstrap.class.getSimpleName() + " implementations", e); return null; } } }
public class class_name { private ModuleBootstrap[] readRegisteredPlugins(ApplicationConfig config, String pluginsPackage) { try { ClassLocator locator = new ClassLocator(pluginsPackage); return locateAll(locator, ModuleBootstrap.class, impl -> impl.bootstrap(config)); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { logger.warn("Did not find any " + ModuleBootstrap.class.getSimpleName() + " implementations", e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean isNamespaceAvailable(String databaseName) { try { for (NamespaceDescriptor ns : admin.listNamespaceDescriptors()) { if (ns.getName().equals(databaseName)) { return true; } } return false; } catch (IOException ioex) { logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex); throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem."); } } }
public class class_name { private boolean isNamespaceAvailable(String databaseName) { try { for (NamespaceDescriptor ns : admin.listNamespaceDescriptors()) { if (ns.getName().equals(databaseName)) { return true; // depends on control dependency: [if], data = [none] } } return false; } catch (IOException ioex) { logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex); throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem."); } } }
public class class_name { public static boolean startsWithIgnoreCase(final String str, final String prefix, final int offset) { if (str == null || prefix == null) { return (str == null && prefix == null); } if(str.length() < offset) { return false; } final String subStr = str.substring(offset); return startsWithIgnoreCase(subStr, prefix); } }
public class class_name { public static boolean startsWithIgnoreCase(final String str, final String prefix, final int offset) { if (str == null || prefix == null) { return (str == null && prefix == null); // depends on control dependency: [if], data = [(str] } if(str.length() < offset) { return false; // depends on control dependency: [if], data = [none] } final String subStr = str.substring(offset); return startsWithIgnoreCase(subStr, prefix); } }
public class class_name { public void setCores(java.util.Collection<Core> cores) { if (cores == null) { this.cores = null; return; } this.cores = new java.util.ArrayList<Core>(cores); } }
public class class_name { public void setCores(java.util.Collection<Core> cores) { if (cores == null) { this.cores = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.cores = new java.util.ArrayList<Core>(cores); } }
public class class_name { protected void disconnect() { if (channel != null) { try { channel.close(); } catch (Throwable cause) { logger.warn("Unexpected error occurred while closing AMQP channel!", cause); } finally { channel = null; } } if (client != null) { try { client.close(); } catch (Throwable cause) { logger.warn("Unexpected error occurred while closing AMQP client!", cause); } finally { client = null; } } } }
public class class_name { protected void disconnect() { if (channel != null) { try { channel.close(); // depends on control dependency: [try], data = [none] } catch (Throwable cause) { logger.warn("Unexpected error occurred while closing AMQP channel!", cause); } finally { // depends on control dependency: [catch], data = [none] channel = null; } } if (client != null) { try { client.close(); // depends on control dependency: [try], data = [none] } catch (Throwable cause) { logger.warn("Unexpected error occurred while closing AMQP client!", cause); } finally { // depends on control dependency: [catch], data = [none] client = null; } } } }
public class class_name { public final static void returnSelector(Selector s) { synchronized (selectors) { selectors.push(s); if (selectors.size() == 1) { selectors.notify(); } } } }
public class class_name { public final static void returnSelector(Selector s) { synchronized (selectors) { selectors.push(s); if (selectors.size() == 1) { selectors.notify(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @SuppressWarnings("unchecked") // Explicit check for value class agreement public V createValue() { if (null == valueclass) { final Class<?> cls = kids[0].createValue().getClass(); for (RecordReader<K,? extends V> rr : kids) { if (!cls.equals(rr.createValue().getClass())) { throw new ClassCastException("Child value classes fail to agree"); } } valueclass = cls.asSubclass(Writable.class); ivalue = createInternalValue(); } return (V) ReflectionUtils.newInstance(valueclass, null); } }
public class class_name { @SuppressWarnings("unchecked") // Explicit check for value class agreement public V createValue() { if (null == valueclass) { final Class<?> cls = kids[0].createValue().getClass(); for (RecordReader<K,? extends V> rr : kids) { if (!cls.equals(rr.createValue().getClass())) { throw new ClassCastException("Child value classes fail to agree"); } } valueclass = cls.asSubclass(Writable.class); // depends on control dependency: [if], data = [none] ivalue = createInternalValue(); // depends on control dependency: [if], data = [none] } return (V) ReflectionUtils.newInstance(valueclass, null); } }
public class class_name { public void marshall(PinpointDestination pinpointDestination, ProtocolMarshaller protocolMarshaller) { if (pinpointDestination == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(pinpointDestination.getApplicationArn(), APPLICATIONARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PinpointDestination pinpointDestination, ProtocolMarshaller protocolMarshaller) { if (pinpointDestination == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(pinpointDestination.getApplicationArn(), APPLICATIONARN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public IPAddressString adjustPrefixBySegment(boolean nextSegment) { if(isPrefixOnly()) { // Use IPv4 segment boundaries int bitsPerSegment = IPv4Address.BITS_PER_SEGMENT; int existingPrefixLength = getNetworkPrefixLength(); int newBits; if(nextSegment) { int adjustment = existingPrefixLength % bitsPerSegment; newBits = Math.min(IPv6Address.BIT_COUNT, existingPrefixLength + bitsPerSegment - adjustment); } else { int adjustment = ((existingPrefixLength - 1) % bitsPerSegment) + 1; newBits = Math.max(0, existingPrefixLength - adjustment); } return new IPAddressString(IPAddressNetwork.getPrefixString(newBits), validationOptions); } IPAddress address = getAddress(); if(address == null) { return null; } Integer prefix = address.getNetworkPrefixLength(); if(!nextSegment && prefix != null && prefix == 0 && address.isMultiple() && address.isPrefixBlock()) { return new IPAddressString(IPAddress.SEGMENT_WILDCARD_STR, validationOptions); } return address.adjustPrefixBySegment(nextSegment).toAddressString(); } }
public class class_name { public IPAddressString adjustPrefixBySegment(boolean nextSegment) { if(isPrefixOnly()) { // Use IPv4 segment boundaries int bitsPerSegment = IPv4Address.BITS_PER_SEGMENT; int existingPrefixLength = getNetworkPrefixLength(); int newBits; if(nextSegment) { int adjustment = existingPrefixLength % bitsPerSegment; newBits = Math.min(IPv6Address.BIT_COUNT, existingPrefixLength + bitsPerSegment - adjustment); // depends on control dependency: [if], data = [none] } else { int adjustment = ((existingPrefixLength - 1) % bitsPerSegment) + 1; newBits = Math.max(0, existingPrefixLength - adjustment); // depends on control dependency: [if], data = [none] } return new IPAddressString(IPAddressNetwork.getPrefixString(newBits), validationOptions); // depends on control dependency: [if], data = [none] } IPAddress address = getAddress(); if(address == null) { return null; // depends on control dependency: [if], data = [none] } Integer prefix = address.getNetworkPrefixLength(); if(!nextSegment && prefix != null && prefix == 0 && address.isMultiple() && address.isPrefixBlock()) { return new IPAddressString(IPAddress.SEGMENT_WILDCARD_STR, validationOptions); // depends on control dependency: [if], data = [none] } return address.adjustPrefixBySegment(nextSegment).toAddressString(); } }
public class class_name { public void setMaxConcurrentThreadCount(String pMaxConcurrentThreadCount) { if (!StringUtil.isEmpty(pMaxConcurrentThreadCount)) { try { maxConcurrentThreadCount = Integer.parseInt(pMaxConcurrentThreadCount); } catch (NumberFormatException nfe) { // Use default } } } }
public class class_name { public void setMaxConcurrentThreadCount(String pMaxConcurrentThreadCount) { if (!StringUtil.isEmpty(pMaxConcurrentThreadCount)) { try { maxConcurrentThreadCount = Integer.parseInt(pMaxConcurrentThreadCount); // depends on control dependency: [try], data = [none] } catch (NumberFormatException nfe) { // Use default } // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected Properties getAdapterArchives() { SortedProperties result = new SortedProperties(); List<Adapter> adapters = getAdapterServices(); String key; for (Adapter adapter : adapters) { String serviceKey = "adapter[" + adapter.getName() + "]"; /// "ServiceType" complexType // enabled key = serviceKey + "/enabled"; result.setProperty(key, adapter.isEnabled()); // bindings result.putAll(getBindings(adapter)); // NVPairs result.putAll(getNVPairs(adapter)); // failureCount key = serviceKey + "/failureCount"; result.setProperty(key, adapter.getFailureCount()); // failureInterval key = serviceKey + "/failureInterval"; result.setProperty(key, adapter.getFailureInterval()); // monitor // plugins // not supported (too complex) } return result; } }
public class class_name { protected Properties getAdapterArchives() { SortedProperties result = new SortedProperties(); List<Adapter> adapters = getAdapterServices(); String key; for (Adapter adapter : adapters) { String serviceKey = "adapter[" + adapter.getName() + "]"; /// "ServiceType" complexType // enabled key = serviceKey + "/enabled"; // depends on control dependency: [for], data = [none] result.setProperty(key, adapter.isEnabled()); // depends on control dependency: [for], data = [adapter] // bindings result.putAll(getBindings(adapter)); // depends on control dependency: [for], data = [adapter] // NVPairs result.putAll(getNVPairs(adapter)); // depends on control dependency: [for], data = [adapter] // failureCount key = serviceKey + "/failureCount"; // depends on control dependency: [for], data = [none] result.setProperty(key, adapter.getFailureCount()); // depends on control dependency: [for], data = [adapter] // failureInterval key = serviceKey + "/failureInterval"; // depends on control dependency: [for], data = [none] result.setProperty(key, adapter.getFailureInterval()); // depends on control dependency: [for], data = [adapter] // monitor // plugins // not supported (too complex) } return result; } }
public class class_name { protected synchronized void initChannelFactory(Class<?> type, ChannelFactory factory, Map<Object, Object> properties) throws ChannelFactoryException { // if no properties were provided, then we must retrieve them from // channelFactoriesProperties using the factory type as the key; if // the properties were provided, make sure that they are in // channelFactoriesProperties for potential future use // ChannelFactoryDataImpl cfd = findOrCreateChannelFactoryData(type); cfd.setChannelFactory(factory); if (properties != null) { cfd.setProperties(properties); } try { factory.init(cfd); } catch (ChannelFactoryException ce) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Factory " + factory + " threw ChannelFactoryException " + ce.getMessage()); } throw ce; } catch (Throwable e) { FFDCFilter.processException(e, getClass().getName() + ".initChannelFactory", "770", this, new Object[] { factory }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Factory " + factory + " threw non-ChannelFactoryException " + e.getMessage()); } throw new ChannelFactoryException(e); } } }
public class class_name { protected synchronized void initChannelFactory(Class<?> type, ChannelFactory factory, Map<Object, Object> properties) throws ChannelFactoryException { // if no properties were provided, then we must retrieve them from // channelFactoriesProperties using the factory type as the key; if // the properties were provided, make sure that they are in // channelFactoriesProperties for potential future use // ChannelFactoryDataImpl cfd = findOrCreateChannelFactoryData(type); cfd.setChannelFactory(factory); if (properties != null) { cfd.setProperties(properties); } try { factory.init(cfd); } catch (ChannelFactoryException ce) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Factory " + factory + " threw ChannelFactoryException " + ce.getMessage()); // depends on control dependency: [if], data = [none] } throw ce; } catch (Throwable e) { FFDCFilter.processException(e, getClass().getName() + ".initChannelFactory", "770", this, new Object[] { factory }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Factory " + factory + " threw non-ChannelFactoryException " + e.getMessage()); // depends on control dependency: [if], data = [none] } throw new ChannelFactoryException(e); } } }
public class class_name { public boolean contentEquals(CharSequence a) { if (a == null || a.length() != length()) { return false; } if (a.getClass() == AsciiString.class) { return equals(a); } for (int i = arrayOffset(), j = 0; j < a.length(); ++i, ++j) { if (b2c(value[i]) != a.charAt(j)) { return false; } } return true; } }
public class class_name { public boolean contentEquals(CharSequence a) { if (a == null || a.length() != length()) { return false; // depends on control dependency: [if], data = [none] } if (a.getClass() == AsciiString.class) { return equals(a); // depends on control dependency: [if], data = [none] } for (int i = arrayOffset(), j = 0; j < a.length(); ++i, ++j) { if (b2c(value[i]) != a.charAt(j)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private String getContentType(String dataHeader) { String token = "Content-Type:"; int start = dataHeader.indexOf(token); if (start == -1) { return StrUtil.EMPTY; } start += token.length(); return dataHeader.substring(start); } }
public class class_name { private String getContentType(String dataHeader) { String token = "Content-Type:"; int start = dataHeader.indexOf(token); if (start == -1) { return StrUtil.EMPTY; // depends on control dependency: [if], data = [none] } start += token.length(); return dataHeader.substring(start); } }
public class class_name { public void open() { if (!isAttached()) { RootPanel.get().add(this); } windowCount++; if(windowOverlay != null && !windowOverlay.isAttached()) { RootPanel.get().add(windowOverlay); } if (fullsceenOnMobile && Window.matchMedia(Resolution.ALL_MOBILE.asMediaQuery())) { setMaximize(true); } if (openAnimation == null) { getOpenMixin().setOn(true); OpenEvent.fire(this, true); } else { setOpacity(0); Scheduler.get().scheduleDeferred(() -> { getOpenMixin().setOn(true); openAnimation.animate(this, () -> OpenEvent.fire(this, true)); }); } } }
public class class_name { public void open() { if (!isAttached()) { RootPanel.get().add(this); // depends on control dependency: [if], data = [none] } windowCount++; if(windowOverlay != null && !windowOverlay.isAttached()) { RootPanel.get().add(windowOverlay); // depends on control dependency: [if], data = [(windowOverlay] } if (fullsceenOnMobile && Window.matchMedia(Resolution.ALL_MOBILE.asMediaQuery())) { setMaximize(true); // depends on control dependency: [if], data = [none] } if (openAnimation == null) { getOpenMixin().setOn(true); // depends on control dependency: [if], data = [none] OpenEvent.fire(this, true); // depends on control dependency: [if], data = [none] } else { setOpacity(0); // depends on control dependency: [if], data = [none] Scheduler.get().scheduleDeferred(() -> { getOpenMixin().setOn(true); // depends on control dependency: [if], data = [none] openAnimation.animate(this, () -> OpenEvent.fire(this, true)); // depends on control dependency: [if], data = [none] }); } } }
public class class_name { private static Configuration injectTransactionManager(TransactionManagerLookupDelegator transactionManagerLookupDelegator, Configuration configuration) { if ( configuration.transaction().transactionMode() == TransactionMode.TRANSACTIONAL ) { ConfigurationBuilder builder = new ConfigurationBuilder().read( configuration ); builder.transaction() .transactionManagerLookup( transactionManagerLookupDelegator ); return builder.build(); } return configuration; } }
public class class_name { private static Configuration injectTransactionManager(TransactionManagerLookupDelegator transactionManagerLookupDelegator, Configuration configuration) { if ( configuration.transaction().transactionMode() == TransactionMode.TRANSACTIONAL ) { ConfigurationBuilder builder = new ConfigurationBuilder().read( configuration ); builder.transaction() .transactionManagerLookup( transactionManagerLookupDelegator ); // depends on control dependency: [if], data = [none] return builder.build(); // depends on control dependency: [if], data = [none] } return configuration; } }
public class class_name { public static String getTimeRangeString(Date fromDate, Date toDate) { if (fromDate == null && toDate == null) { return null; } StringBuilder sbr = new StringBuilder(); if (fromDate != null) { sbr.append(format(fromDate)); } sbr.append(","); if (toDate != null) { sbr.append(format(toDate)); } return sbr.toString(); } }
public class class_name { public static String getTimeRangeString(Date fromDate, Date toDate) { if (fromDate == null && toDate == null) { return null; // depends on control dependency: [if], data = [none] } StringBuilder sbr = new StringBuilder(); if (fromDate != null) { sbr.append(format(fromDate)); // depends on control dependency: [if], data = [(fromDate] } sbr.append(","); if (toDate != null) { sbr.append(format(toDate)); // depends on control dependency: [if], data = [(toDate] } return sbr.toString(); } }
public class class_name { private static String getCharsetFromBOM(final byte[] byteData) { BOMInputStream bomIn = new BOMInputStream(new ByteArrayInputStream( byteData)); try { ByteOrderMark bom = bomIn.getBOM(); if (bom != null) { return bom.getCharsetName(); } } catch (IOException e) { return null; } return null; } }
public class class_name { private static String getCharsetFromBOM(final byte[] byteData) { BOMInputStream bomIn = new BOMInputStream(new ByteArrayInputStream( byteData)); try { ByteOrderMark bom = bomIn.getBOM(); if (bom != null) { return bom.getCharsetName(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { return null; } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public static Optional<ModelAndView> hasDelegationRequestFailed(final HttpServletRequest request, final int status) { val params = request.getParameterMap(); if (Stream.of("error", "error_code", "error_description", "error_message").anyMatch(params::containsKey)) { val model = new HashMap<String, Object>(); if (params.containsKey("error_code")) { model.put("code", StringEscapeUtils.escapeHtml4(request.getParameter("error_code"))); } else { model.put("code", status); } model.put("error", StringEscapeUtils.escapeHtml4(request.getParameter("error"))); model.put("reason", StringEscapeUtils.escapeHtml4(request.getParameter("error_reason"))); if (params.containsKey("error_description")) { model.put("description", StringEscapeUtils.escapeHtml4(request.getParameter("error_description"))); } else if (params.containsKey("error_message")) { model.put("description", StringEscapeUtils.escapeHtml4(request.getParameter("error_message"))); } model.put(CasProtocolConstants.PARAMETER_SERVICE, request.getAttribute(CasProtocolConstants.PARAMETER_SERVICE)); model.put("client", StringEscapeUtils.escapeHtml4(request.getParameter("client_name"))); LOGGER.debug("Delegation request has failed. Details are [{}]", model); return Optional.of(new ModelAndView("casPac4jStopWebflow", model)); } return Optional.empty(); } }
public class class_name { public static Optional<ModelAndView> hasDelegationRequestFailed(final HttpServletRequest request, final int status) { val params = request.getParameterMap(); if (Stream.of("error", "error_code", "error_description", "error_message").anyMatch(params::containsKey)) { val model = new HashMap<String, Object>(); if (params.containsKey("error_code")) { model.put("code", StringEscapeUtils.escapeHtml4(request.getParameter("error_code"))); // depends on control dependency: [if], data = [none] } else { model.put("code", status); // depends on control dependency: [if], data = [none] } model.put("error", StringEscapeUtils.escapeHtml4(request.getParameter("error"))); // depends on control dependency: [if], data = [none] model.put("reason", StringEscapeUtils.escapeHtml4(request.getParameter("error_reason"))); // depends on control dependency: [if], data = [none] if (params.containsKey("error_description")) { model.put("description", StringEscapeUtils.escapeHtml4(request.getParameter("error_description"))); // depends on control dependency: [if], data = [none] } else if (params.containsKey("error_message")) { model.put("description", StringEscapeUtils.escapeHtml4(request.getParameter("error_message"))); // depends on control dependency: [if], data = [none] } model.put(CasProtocolConstants.PARAMETER_SERVICE, request.getAttribute(CasProtocolConstants.PARAMETER_SERVICE)); // depends on control dependency: [if], data = [none] model.put("client", StringEscapeUtils.escapeHtml4(request.getParameter("client_name"))); // depends on control dependency: [if], data = [none] LOGGER.debug("Delegation request has failed. Details are [{}]", model); return Optional.of(new ModelAndView("casPac4jStopWebflow", model)); // depends on control dependency: [if], data = [none] } return Optional.empty(); } }
public class class_name { public void error(Throwable exception) { if (logger.isLoggable(SEVERE)) { logger.log(SEVERE, exception.getMessage(), exception); } } }
public class class_name { public void error(Throwable exception) { if (logger.isLoggable(SEVERE)) { logger.log(SEVERE, exception.getMessage(), exception); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected Object addComponent(ComponentJob componentJob) { final AbstractBeanJobBuilder<?, ?, ?> builder; if (componentJob instanceof FilterJob) { builder = addFilter((FilterBeanDescriptor<?, ?>) componentJob.getDescriptor()); } else if (componentJob instanceof TransformerJob) { builder = addTransformer((TransformerBeanDescriptor<?>) componentJob.getDescriptor()); } else if (componentJob instanceof AnalyzerJob) { builder = addAnalyzer((AnalyzerBeanDescriptor<?>) componentJob.getDescriptor()); } else { throw new UnsupportedOperationException("Unknown component job type: " + componentJob); } builder.setName(componentJob.getName()); if (componentJob instanceof ConfigurableBeanJob<?>) { ConfigurableBeanJob<?> configurableBeanJob = (ConfigurableBeanJob<?>) componentJob; builder.setConfiguredProperties(configurableBeanJob.getConfiguration()); } if (componentJob instanceof InputColumnSourceJob) { InputColumn<?>[] output = ((InputColumnSourceJob) componentJob).getOutput(); TransformerJobBuilder<?> transformerJobBuilder = (TransformerJobBuilder<?>) builder; List<MutableInputColumn<?>> outputColumns = transformerJobBuilder.getOutputColumns(); assert output.length == outputColumns.size(); for (int i = 0; i < output.length; i++) { MutableInputColumn<?> mutableOutputColumn = outputColumns.get(i); mutableOutputColumn.setName(output[i].getName()); } } return builder; } }
public class class_name { protected Object addComponent(ComponentJob componentJob) { final AbstractBeanJobBuilder<?, ?, ?> builder; if (componentJob instanceof FilterJob) { builder = addFilter((FilterBeanDescriptor<?, ?>) componentJob.getDescriptor()); // depends on control dependency: [if], data = [none] } else if (componentJob instanceof TransformerJob) { builder = addTransformer((TransformerBeanDescriptor<?>) componentJob.getDescriptor()); // depends on control dependency: [if], data = [none] } else if (componentJob instanceof AnalyzerJob) { builder = addAnalyzer((AnalyzerBeanDescriptor<?>) componentJob.getDescriptor()); // depends on control dependency: [if], data = [none] } else { throw new UnsupportedOperationException("Unknown component job type: " + componentJob); } builder.setName(componentJob.getName()); if (componentJob instanceof ConfigurableBeanJob<?>) { ConfigurableBeanJob<?> configurableBeanJob = (ConfigurableBeanJob<?>) componentJob; builder.setConfiguredProperties(configurableBeanJob.getConfiguration()); // depends on control dependency: [if], data = [)] } if (componentJob instanceof InputColumnSourceJob) { InputColumn<?>[] output = ((InputColumnSourceJob) componentJob).getOutput(); TransformerJobBuilder<?> transformerJobBuilder = (TransformerJobBuilder<?>) builder; List<MutableInputColumn<?>> outputColumns = transformerJobBuilder.getOutputColumns(); // depends on control dependency: [if], data = [none] assert output.length == outputColumns.size(); for (int i = 0; i < output.length; i++) { MutableInputColumn<?> mutableOutputColumn = outputColumns.get(i); mutableOutputColumn.setName(output[i].getName()); // depends on control dependency: [for], data = [i] } } return builder; } }
public class class_name { @SuppressWarnings("unchecked") protected void initInputReaders() throws Exception { final int numInputs = getNumTaskInputs(); final MutableReader<?>[] inputReaders = new MutableReader[numInputs]; int numGates = 0; for (int i = 0; i < numInputs; i++) { // ---------------- create the input readers --------------------- // in case where a logical input unions multiple physical inputs, create a union reader final int groupSize = this.config.getGroupSize(i); numGates += groupSize; if (groupSize == 1) { // non-union case inputReaders[i] = new MutableRecordReader<IOReadableWritable>(this); } else if (groupSize > 1){ // union case MutableRecordReader<IOReadableWritable>[] readers = new MutableRecordReader[groupSize]; for (int j = 0; j < groupSize; ++j) { readers[j] = new MutableRecordReader<IOReadableWritable>(this); } inputReaders[i] = new MutableUnionRecordReader<IOReadableWritable>(readers); } else { throw new Exception("Illegal input group size in task configuration: " + groupSize); } } this.inputReaders = inputReaders; // final sanity check if (numGates != this.config.getNumInputs()) { throw new Exception("Illegal configuration: Number of input gates and group sizes are not consistent."); } } }
public class class_name { @SuppressWarnings("unchecked") protected void initInputReaders() throws Exception { final int numInputs = getNumTaskInputs(); final MutableReader<?>[] inputReaders = new MutableReader[numInputs]; int numGates = 0; for (int i = 0; i < numInputs; i++) { // ---------------- create the input readers --------------------- // in case where a logical input unions multiple physical inputs, create a union reader final int groupSize = this.config.getGroupSize(i); numGates += groupSize; if (groupSize == 1) { // non-union case inputReaders[i] = new MutableRecordReader<IOReadableWritable>(this); } else if (groupSize > 1){ // union case MutableRecordReader<IOReadableWritable>[] readers = new MutableRecordReader[groupSize]; for (int j = 0; j < groupSize; ++j) { readers[j] = new MutableRecordReader<IOReadableWritable>(this); // depends on control dependency: [for], data = [j] } inputReaders[i] = new MutableUnionRecordReader<IOReadableWritable>(readers); } else { throw new Exception("Illegal input group size in task configuration: " + groupSize); } } this.inputReaders = inputReaders; // final sanity check if (numGates != this.config.getNumInputs()) { throw new Exception("Illegal configuration: Number of input gates and group sizes are not consistent."); } } }
public class class_name { @Override public void afterSingletonsInstantiated() { try { initializeMethodSecurityInterceptor(); } catch (Exception e) { throw new RuntimeException(e); } PermissionEvaluator permissionEvaluator = getSingleBeanOrNull( PermissionEvaluator.class); if (permissionEvaluator != null) { this.defaultMethodExpressionHandler .setPermissionEvaluator(permissionEvaluator); } RoleHierarchy roleHierarchy = getSingleBeanOrNull(RoleHierarchy.class); if (roleHierarchy != null) { this.defaultMethodExpressionHandler.setRoleHierarchy(roleHierarchy); } AuthenticationTrustResolver trustResolver = getSingleBeanOrNull( AuthenticationTrustResolver.class); if (trustResolver != null) { this.defaultMethodExpressionHandler.setTrustResolver(trustResolver); } GrantedAuthorityDefaults grantedAuthorityDefaults = getSingleBeanOrNull( GrantedAuthorityDefaults.class); if (grantedAuthorityDefaults != null) { this.defaultMethodExpressionHandler.setDefaultRolePrefix( grantedAuthorityDefaults.getRolePrefix()); } } }
public class class_name { @Override public void afterSingletonsInstantiated() { try { initializeMethodSecurityInterceptor(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] PermissionEvaluator permissionEvaluator = getSingleBeanOrNull( PermissionEvaluator.class); if (permissionEvaluator != null) { this.defaultMethodExpressionHandler .setPermissionEvaluator(permissionEvaluator); // depends on control dependency: [if], data = [none] } RoleHierarchy roleHierarchy = getSingleBeanOrNull(RoleHierarchy.class); if (roleHierarchy != null) { this.defaultMethodExpressionHandler.setRoleHierarchy(roleHierarchy); // depends on control dependency: [if], data = [(roleHierarchy] } AuthenticationTrustResolver trustResolver = getSingleBeanOrNull( AuthenticationTrustResolver.class); if (trustResolver != null) { this.defaultMethodExpressionHandler.setTrustResolver(trustResolver); // depends on control dependency: [if], data = [(trustResolver] } GrantedAuthorityDefaults grantedAuthorityDefaults = getSingleBeanOrNull( GrantedAuthorityDefaults.class); if (grantedAuthorityDefaults != null) { this.defaultMethodExpressionHandler.setDefaultRolePrefix( grantedAuthorityDefaults.getRolePrefix()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public StartBuildRequest withSecondarySourcesOverride(ProjectSource... secondarySourcesOverride) { if (this.secondarySourcesOverride == null) { setSecondarySourcesOverride(new java.util.ArrayList<ProjectSource>(secondarySourcesOverride.length)); } for (ProjectSource ele : secondarySourcesOverride) { this.secondarySourcesOverride.add(ele); } return this; } }
public class class_name { public StartBuildRequest withSecondarySourcesOverride(ProjectSource... secondarySourcesOverride) { if (this.secondarySourcesOverride == null) { setSecondarySourcesOverride(new java.util.ArrayList<ProjectSource>(secondarySourcesOverride.length)); // depends on control dependency: [if], data = [none] } for (ProjectSource ele : secondarySourcesOverride) { this.secondarySourcesOverride.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static int i(String msg) { // This is a quick check to avoid the expensive stack trace reflection. if (!activated) { return 0; } String caller = LogHelper.getCaller(); if (caller != null) { return i(caller, msg); } return 0; } }
public class class_name { public static int i(String msg) { // This is a quick check to avoid the expensive stack trace reflection. if (!activated) { return 0; // depends on control dependency: [if], data = [none] } String caller = LogHelper.getCaller(); if (caller != null) { return i(caller, msg); // depends on control dependency: [if], data = [(caller] } return 0; } }
public class class_name { public final void decreaseScheduledBytesAndMessages(WriteRequest request) { Object message = request.getMessage(); if (message instanceof IoBuffer) { IoBuffer b = (IoBuffer) message; if (b.hasRemaining()) { increaseScheduledWriteBytes(-((IoBuffer) message).remaining()); } } } }
public class class_name { public final void decreaseScheduledBytesAndMessages(WriteRequest request) { Object message = request.getMessage(); if (message instanceof IoBuffer) { IoBuffer b = (IoBuffer) message; if (b.hasRemaining()) { increaseScheduledWriteBytes(-((IoBuffer) message).remaining()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static Properties sanitize(Properties properties) { // convert any non-String keys/values to Strings Properties sanitizedEntries = new Properties(); for (Iterator<?> itr = properties.entrySet().iterator(); itr.hasNext(); ) { Map.Entry entry = (Map.Entry) itr.next(); if (!(entry.getKey() instanceof String)) { String key = sanitize(entry.getKey()); if (!properties.containsKey(key)) { sanitizedEntries.setProperty(key, sanitize(entry.getValue())); } itr.remove(); } else if (!(entry.getValue() instanceof String)) { entry.setValue(sanitize(entry.getValue())); } } properties.putAll(sanitizedEntries); return properties; } }
public class class_name { public static Properties sanitize(Properties properties) { // convert any non-String keys/values to Strings Properties sanitizedEntries = new Properties(); for (Iterator<?> itr = properties.entrySet().iterator(); itr.hasNext(); ) { Map.Entry entry = (Map.Entry) itr.next(); if (!(entry.getKey() instanceof String)) { String key = sanitize(entry.getKey()); if (!properties.containsKey(key)) { sanitizedEntries.setProperty(key, sanitize(entry.getValue())); // depends on control dependency: [if], data = [none] } itr.remove(); // depends on control dependency: [if], data = [none] } else if (!(entry.getValue() instanceof String)) { entry.setValue(sanitize(entry.getValue())); // depends on control dependency: [if], data = [none] } } properties.putAll(sanitizedEntries); return properties; } }
public class class_name { public static Pair<ResolvedType, Boolean> groundTargetTypeOfLambda(LambdaExpr lambdaExpr, ResolvedType T, TypeSolver typeSolver) { // The ground target type is derived from T as follows: // boolean used18_5_3 = false; boolean wildcardParameterized = T.asReferenceType().typeParametersValues().stream() .anyMatch(tp -> tp.isWildcard()); if (wildcardParameterized) { // - If T is a wildcard-parameterized functional interface type and the lambda expression is explicitly typed, // then the ground target type is inferred as described in §18.5.3. if (ExpressionHelper.isExplicitlyTyped(lambdaExpr)) { used18_5_3 = true; throw new UnsupportedOperationException(); } // - If T is a wildcard-parameterized functional interface type and the lambda expression is implicitly typed, // then the ground target type is the non-wildcard parameterization (§9.9) of T. else { return new Pair<>(nonWildcardParameterizationOf(T.asReferenceType(), typeSolver), used18_5_3); } } // - Otherwise, the ground target type is T. return new Pair<>(T, used18_5_3); } }
public class class_name { public static Pair<ResolvedType, Boolean> groundTargetTypeOfLambda(LambdaExpr lambdaExpr, ResolvedType T, TypeSolver typeSolver) { // The ground target type is derived from T as follows: // boolean used18_5_3 = false; boolean wildcardParameterized = T.asReferenceType().typeParametersValues().stream() .anyMatch(tp -> tp.isWildcard()); if (wildcardParameterized) { // - If T is a wildcard-parameterized functional interface type and the lambda expression is explicitly typed, // then the ground target type is inferred as described in §18.5.3. if (ExpressionHelper.isExplicitlyTyped(lambdaExpr)) { used18_5_3 = true; // depends on control dependency: [if], data = [none] throw new UnsupportedOperationException(); } // - If T is a wildcard-parameterized functional interface type and the lambda expression is implicitly typed, // then the ground target type is the non-wildcard parameterization (§9.9) of T. else { return new Pair<>(nonWildcardParameterizationOf(T.asReferenceType(), typeSolver), used18_5_3); // depends on control dependency: [if], data = [none] } } // - Otherwise, the ground target type is T. return new Pair<>(T, used18_5_3); } }
public class class_name { public void marshall(GetPatchBaselineForPatchGroupRequest getPatchBaselineForPatchGroupRequest, ProtocolMarshaller protocolMarshaller) { if (getPatchBaselineForPatchGroupRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getPatchBaselineForPatchGroupRequest.getPatchGroup(), PATCHGROUP_BINDING); protocolMarshaller.marshall(getPatchBaselineForPatchGroupRequest.getOperatingSystem(), OPERATINGSYSTEM_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetPatchBaselineForPatchGroupRequest getPatchBaselineForPatchGroupRequest, ProtocolMarshaller protocolMarshaller) { if (getPatchBaselineForPatchGroupRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getPatchBaselineForPatchGroupRequest.getPatchGroup(), PATCHGROUP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getPatchBaselineForPatchGroupRequest.getOperatingSystem(), OPERATINGSYSTEM_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private final void internalInfo(Object source, Class sourceClass, String methodName, String messageIdentifier, Object object) { if (usePrintWriterForTrace) { if (printWriter != null) { StringBuffer stringBuffer = new StringBuffer(new java.util.Date().toString()); stringBuffer.append(" I "); stringBuffer.append(sourceClass.getName()); stringBuffer.append("."); stringBuffer.append(methodName); printWriter.println(stringBuffer.toString()); printWriter.println("\t\t"+NLS.format(messageIdentifier, object)); printWriter.flush(); } } if (object != null) { Tr.info(traceComponent, messageIdentifier, object); } else { Tr.info(traceComponent, messageIdentifier); } } }
public class class_name { private final void internalInfo(Object source, Class sourceClass, String methodName, String messageIdentifier, Object object) { if (usePrintWriterForTrace) { if (printWriter != null) { StringBuffer stringBuffer = new StringBuffer(new java.util.Date().toString()); stringBuffer.append(" I "); // depends on control dependency: [if], data = [none] stringBuffer.append(sourceClass.getName()); // depends on control dependency: [if], data = [none] stringBuffer.append("."); // depends on control dependency: [if], data = [none] stringBuffer.append(methodName); // depends on control dependency: [if], data = [none] printWriter.println(stringBuffer.toString()); // depends on control dependency: [if], data = [none] printWriter.println("\t\t"+NLS.format(messageIdentifier, object)); // depends on control dependency: [if], data = [none] printWriter.flush(); // depends on control dependency: [if], data = [none] } } if (object != null) { Tr.info(traceComponent, messageIdentifier, object); // depends on control dependency: [if], data = [none] } else { Tr.info(traceComponent, messageIdentifier); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void debug(String message) { if(this.logger.isDebugEnabled()) { this.logger.debug(buildMessage(message)); } } }
public class class_name { @Override public void debug(String message) { if(this.logger.isDebugEnabled()) { this.logger.debug(buildMessage(message)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static SourceLineAnnotation fromVisitedMethod(MethodGen methodGen, String sourceFile) { LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool()); String className = methodGen.getClassName(); int codeSize = methodGen.getInstructionList().getLength(); if (lineNumberTable == null) { return createUnknown(className, sourceFile, 0, codeSize - 1); } return forEntireMethod(className, sourceFile, lineNumberTable, codeSize); } }
public class class_name { public static SourceLineAnnotation fromVisitedMethod(MethodGen methodGen, String sourceFile) { LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool()); String className = methodGen.getClassName(); int codeSize = methodGen.getInstructionList().getLength(); if (lineNumberTable == null) { return createUnknown(className, sourceFile, 0, codeSize - 1); // depends on control dependency: [if], data = [none] } return forEntireMethod(className, sourceFile, lineNumberTable, codeSize); } }
public class class_name { public String getStringValue(String name) { // Check if datum exists for name DbDatum datum = getDatum(name); if (datum == null) return null; // Else get string value String[] array = datum.extractStringArray(); String str = ""; for (int i = 0; i < array.length; i++) { str += array[i]; if (i < array.length - 1) str += "\n"; } return str; } }
public class class_name { public String getStringValue(String name) { // Check if datum exists for name DbDatum datum = getDatum(name); if (datum == null) return null; // Else get string value String[] array = datum.extractStringArray(); String str = ""; for (int i = 0; i < array.length; i++) { str += array[i]; // depends on control dependency: [for], data = [i] if (i < array.length - 1) str += "\n"; } return str; } }
public class class_name { protected Tree<FeatureStructure> populateTree(JCas jcas) { Tree<FeatureStructure> tree = new Tree<FeatureStructure>(jcas.getDocumentAnnotationFs()); for (TOP a : JCasUtil.select(jcas, annotationTypes.get(0))) { tree.add(populateTree(jcas, a, 1)); } return tree; } }
public class class_name { protected Tree<FeatureStructure> populateTree(JCas jcas) { Tree<FeatureStructure> tree = new Tree<FeatureStructure>(jcas.getDocumentAnnotationFs()); for (TOP a : JCasUtil.select(jcas, annotationTypes.get(0))) { tree.add(populateTree(jcas, a, 1)); // depends on control dependency: [for], data = [a] } return tree; } }
public class class_name { public static long loadOrAddRefPlanFragment(byte[] planHash, byte[] plan, String stmtText) { Sha1Wrapper key = new Sha1Wrapper(planHash); synchronized (FragInfo.class) { FragInfo frag = m_plansByHash.get(key); if (frag == null) { frag = new FragInfo(key, plan, m_nextFragId++, stmtText); m_plansByHash.put(frag.hash, frag); m_plansById.put(frag.fragId, frag); if (m_plansById.size() > ExecutionEngine.EE_PLAN_CACHE_SIZE) { evictLRUfragment(); } } // Bit of a hack to work around an issue where a statement-less adhoc // fragment could be identical to a statement-needing regular procedure. // This doesn't really address the broader issue that fragment hashes // are not 1-1 with SQL statements. if (frag.stmtText == null) { frag.stmtText = stmtText; } // The fragment MAY be in the LRU map. // An incremented refCount is a lazy way to keep it safe from eviction // without having to update the map. // This optimizes for popular fragments in a small or stable cache that may be reused // many times before the eviction process needs to take any notice. frag.refCount++; return frag.fragId; } } }
public class class_name { public static long loadOrAddRefPlanFragment(byte[] planHash, byte[] plan, String stmtText) { Sha1Wrapper key = new Sha1Wrapper(planHash); synchronized (FragInfo.class) { FragInfo frag = m_plansByHash.get(key); if (frag == null) { frag = new FragInfo(key, plan, m_nextFragId++, stmtText); // depends on control dependency: [if], data = [none] m_plansByHash.put(frag.hash, frag); // depends on control dependency: [if], data = [(frag] m_plansById.put(frag.fragId, frag); // depends on control dependency: [if], data = [(frag] if (m_plansById.size() > ExecutionEngine.EE_PLAN_CACHE_SIZE) { evictLRUfragment(); // depends on control dependency: [if], data = [none] } } // Bit of a hack to work around an issue where a statement-less adhoc // fragment could be identical to a statement-needing regular procedure. // This doesn't really address the broader issue that fragment hashes // are not 1-1 with SQL statements. if (frag.stmtText == null) { frag.stmtText = stmtText; // depends on control dependency: [if], data = [none] } // The fragment MAY be in the LRU map. // An incremented refCount is a lazy way to keep it safe from eviction // without having to update the map. // This optimizes for popular fragments in a small or stable cache that may be reused // many times before the eviction process needs to take any notice. frag.refCount++; return frag.fragId; } } }
public class class_name { public void marshall(AdminCreateUserConfigType adminCreateUserConfigType, ProtocolMarshaller protocolMarshaller) { if (adminCreateUserConfigType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(adminCreateUserConfigType.getAllowAdminCreateUserOnly(), ALLOWADMINCREATEUSERONLY_BINDING); protocolMarshaller.marshall(adminCreateUserConfigType.getUnusedAccountValidityDays(), UNUSEDACCOUNTVALIDITYDAYS_BINDING); protocolMarshaller.marshall(adminCreateUserConfigType.getInviteMessageTemplate(), INVITEMESSAGETEMPLATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AdminCreateUserConfigType adminCreateUserConfigType, ProtocolMarshaller protocolMarshaller) { if (adminCreateUserConfigType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(adminCreateUserConfigType.getAllowAdminCreateUserOnly(), ALLOWADMINCREATEUSERONLY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(adminCreateUserConfigType.getUnusedAccountValidityDays(), UNUSEDACCOUNTVALIDITYDAYS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(adminCreateUserConfigType.getInviteMessageTemplate(), INVITEMESSAGETEMPLATE_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 public void replaceUnsolvedElements(NamedConcreteElement element) { super.replaceUnsolvedElements(element); XsdNamedElements elem = element.getElement(); String elemName = elem.getRawName(); boolean isComplexOrSimpleType = elem instanceof XsdComplexType || elem instanceof XsdSimpleType; if (this.base instanceof UnsolvedReference && isComplexOrSimpleType && ((UnsolvedReference) this.base).getRef().equals(elemName)){ this.base = element; } if (this.childElement instanceof UnsolvedReference && elem instanceof XsdGroup && ((UnsolvedReference) this.childElement).getRef().equals(elemName)){ this.childElement = element; } visitor.replaceUnsolvedAttributes(element); } }
public class class_name { @Override public void replaceUnsolvedElements(NamedConcreteElement element) { super.replaceUnsolvedElements(element); XsdNamedElements elem = element.getElement(); String elemName = elem.getRawName(); boolean isComplexOrSimpleType = elem instanceof XsdComplexType || elem instanceof XsdSimpleType; if (this.base instanceof UnsolvedReference && isComplexOrSimpleType && ((UnsolvedReference) this.base).getRef().equals(elemName)){ this.base = element; // depends on control dependency: [if], data = [none] } if (this.childElement instanceof UnsolvedReference && elem instanceof XsdGroup && ((UnsolvedReference) this.childElement).getRef().equals(elemName)){ this.childElement = element; // depends on control dependency: [if], data = [none] } visitor.replaceUnsolvedAttributes(element); } }
public class class_name { protected void releaseProxyReadBuffer() { WsByteBuffer buffer = connLink.getReadInterface().getBuffer(); if (null != buffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Releasing proxy read buffer: " + buffer); } buffer.release(); connLink.getReadInterface().setBuffer(null); } } }
public class class_name { protected void releaseProxyReadBuffer() { WsByteBuffer buffer = connLink.getReadInterface().getBuffer(); if (null != buffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Releasing proxy read buffer: " + buffer); // depends on control dependency: [if], data = [none] } buffer.release(); // depends on control dependency: [if], data = [none] connLink.getReadInterface().setBuffer(null); // depends on control dependency: [if], data = [(null] } } }
public class class_name { public SkippableIterator getSkippableIterator() { return new SkippableIterator() { int pos = 0; int p = 0; public SkippableIterator init() { this.p = SparseBitmap.this.buffer.get(0); return this; } @Override public void advance() { this.pos += 2; if (this.pos < SparseBitmap.this.buffer.size()) this.p += SparseBitmap.this.buffer.get(this.pos) + 1; } @Override public void advanceUntil(int min) { advance(); while (hasValue() && (getCurrentWordOffset() < min)) { advance(); } } @Override public int getCurrentWord() { return SparseBitmap.this.buffer.get(this.pos + 1); } @Override public int getCurrentWordOffset() { return this.p; } @Override public boolean hasValue() { return this.pos < SparseBitmap.this.buffer.size(); } }.init(); } }
public class class_name { public SkippableIterator getSkippableIterator() { return new SkippableIterator() { int pos = 0; int p = 0; public SkippableIterator init() { this.p = SparseBitmap.this.buffer.get(0); return this; } @Override public void advance() { this.pos += 2; if (this.pos < SparseBitmap.this.buffer.size()) this.p += SparseBitmap.this.buffer.get(this.pos) + 1; } @Override public void advanceUntil(int min) { advance(); while (hasValue() && (getCurrentWordOffset() < min)) { advance(); // depends on control dependency: [while], data = [none] } } @Override public int getCurrentWord() { return SparseBitmap.this.buffer.get(this.pos + 1); } @Override public int getCurrentWordOffset() { return this.p; } @Override public boolean hasValue() { return this.pos < SparseBitmap.this.buffer.size(); } }.init(); } }
public class class_name { public synchronized void setFailure(Exception paramE) { if (done) return; // can't mark done twice e = paramE; done = true; notifyAll(); // if we have a callback to call, schedule // it on a different thread. Who knows what this // thread is doing. if (callback != null) { QueueBuffer.executor.submit(new Callable<Void>() { public Void call() throws Exception { callback.onError(e); return null; } }); } } }
public class class_name { public synchronized void setFailure(Exception paramE) { if (done) return; // can't mark done twice e = paramE; done = true; notifyAll(); // if we have a callback to call, schedule // it on a different thread. Who knows what this // thread is doing. if (callback != null) { QueueBuffer.executor.submit(new Callable<Void>() { public Void call() throws Exception { callback.onError(e); return null; } }); // depends on control dependency: [if], data = [none] } } }
public class class_name { private InternalFeature convertFeature(Object feature, Geometry geometry, VectorLayer layer, CrsTransform transformation, List<StyleFilter> styles, LabelStyleInfo labelStyle, int featureIncludes) throws GeomajasException { FeatureModel featureModel = layer.getFeatureModel(); InternalFeature res = new InternalFeatureImpl(); res.setId(featureModel.getId(feature)); res.setLayer(layer); res.setGeometry(geometry); // in layer coordinate space for security checks res = attributeService.getAttributes(layer, res, feature); // includes security checks if (null != res) { // add and clear data according to the feature includes // unfortunately the data needs to be there for the security tests and can only be removed later if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_LABEL) != 0) { // value expression takes preference over attribute name String valueExpression = labelStyle.getLabelValueExpression(); if (valueExpression != null) { res.setLabel(featureExpressionService.evaluate(valueExpression, res).toString()); } else { // must have an attribute name ! String labelAttr = labelStyle.getLabelAttributeName(); if (LabelStyleInfo.ATTRIBUTE_NAME_ID.equalsIgnoreCase(labelAttr)) { res.setLabel(featureModel.getId(feature)); } else { Attribute<?> attribute = res.getAttributes().get(labelAttr); if (null != attribute && null != attribute.getValue()) { res.setLabel(attribute.getValue().toString()); } } } } // If allowed, add the geometry (transformed!) to the InternalFeature: if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_GEOMETRY) != 0) { Geometry transformed; if (null != transformation) { transformed = geoService.transform(geometry, transformation); } else { transformed = geometry; } res.setGeometry(transformed); } else { res.setGeometry(null); } // If allowed, add the style definition to the InternalFeature: if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_STYLE) != 0) { // We calculate the style on the (almost complete) internal feature to allow synthetic attributes. res.setStyleDefinition(findStyleFilter(res, styles).getStyleDefinition()); } // If allowed, add the attributes to the InternalFeature: if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_ATTRIBUTES) == 0) { res.setAttributes(null); } } return res; } }
public class class_name { private InternalFeature convertFeature(Object feature, Geometry geometry, VectorLayer layer, CrsTransform transformation, List<StyleFilter> styles, LabelStyleInfo labelStyle, int featureIncludes) throws GeomajasException { FeatureModel featureModel = layer.getFeatureModel(); InternalFeature res = new InternalFeatureImpl(); res.setId(featureModel.getId(feature)); res.setLayer(layer); res.setGeometry(geometry); // in layer coordinate space for security checks res = attributeService.getAttributes(layer, res, feature); // includes security checks if (null != res) { // add and clear data according to the feature includes // unfortunately the data needs to be there for the security tests and can only be removed later if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_LABEL) != 0) { // value expression takes preference over attribute name String valueExpression = labelStyle.getLabelValueExpression(); if (valueExpression != null) { res.setLabel(featureExpressionService.evaluate(valueExpression, res).toString()); // depends on control dependency: [if], data = [(valueExpression] } else { // must have an attribute name ! String labelAttr = labelStyle.getLabelAttributeName(); if (LabelStyleInfo.ATTRIBUTE_NAME_ID.equalsIgnoreCase(labelAttr)) { res.setLabel(featureModel.getId(feature)); // depends on control dependency: [if], data = [none] } else { Attribute<?> attribute = res.getAttributes().get(labelAttr); if (null != attribute && null != attribute.getValue()) { res.setLabel(attribute.getValue().toString()); // depends on control dependency: [if], data = [none] } } } } // If allowed, add the geometry (transformed!) to the InternalFeature: if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_GEOMETRY) != 0) { Geometry transformed; if (null != transformation) { transformed = geoService.transform(geometry, transformation); // depends on control dependency: [if], data = [transformation)] } else { transformed = geometry; // depends on control dependency: [if], data = [none] } res.setGeometry(transformed); // depends on control dependency: [if], data = [none] } else { res.setGeometry(null); // depends on control dependency: [if], data = [none] } // If allowed, add the style definition to the InternalFeature: if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_STYLE) != 0) { // We calculate the style on the (almost complete) internal feature to allow synthetic attributes. res.setStyleDefinition(findStyleFilter(res, styles).getStyleDefinition()); // depends on control dependency: [if], data = [none] } // If allowed, add the attributes to the InternalFeature: if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_ATTRIBUTES) == 0) { res.setAttributes(null); // depends on control dependency: [if], data = [none] } } return res; } }
public class class_name { public static <ReqT, RespT> RespT blockingUnaryCall(ClientCall<ReqT, RespT> call, ReqT req) { try { return getUnchecked(futureUnaryCall(call, req)); } catch (RuntimeException e) { throw cancelThrow(call, e); } catch (Error e) { throw cancelThrow(call, e); } } }
public class class_name { public static <ReqT, RespT> RespT blockingUnaryCall(ClientCall<ReqT, RespT> call, ReqT req) { try { return getUnchecked(futureUnaryCall(call, req)); // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { throw cancelThrow(call, e); } catch (Error e) { // depends on control dependency: [catch], data = [none] throw cancelThrow(call, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setType(MsgType type) { this.type = type; if (type == MsgType.flash) { this.mclass = MClassType.flash; } else { this.mclass = MClassType.normal; } } }
public class class_name { public void setType(MsgType type) { this.type = type; if (type == MsgType.flash) { this.mclass = MClassType.flash; // depends on control dependency: [if], data = [none] } else { this.mclass = MClassType.normal; // depends on control dependency: [if], data = [none] } } }
public class class_name { private final String getOperationText(final BinaryOperation exp) { final String text; if (exp instanceof AdditionOperation) { text = " + "; } else if (exp instanceof SubtractionOperation) { text = " - "; } else if (exp instanceof MultiplicationOperation) { text = " * "; } else if (exp instanceof DivisionOperation) { text = " / "; } else { LOGGER.warn("Unsupported expression of type {}", exp.getClass()); text = ""; } return text; } }
public class class_name { private final String getOperationText(final BinaryOperation exp) { final String text; if (exp instanceof AdditionOperation) { text = " + "; // depends on control dependency: [if], data = [none] } else if (exp instanceof SubtractionOperation) { text = " - "; // depends on control dependency: [if], data = [none] } else if (exp instanceof MultiplicationOperation) { text = " * "; // depends on control dependency: [if], data = [none] } else if (exp instanceof DivisionOperation) { text = " / "; // depends on control dependency: [if], data = [none] } else { LOGGER.warn("Unsupported expression of type {}", exp.getClass()); // depends on control dependency: [if], data = [none] text = ""; // depends on control dependency: [if], data = [none] } return text; } }
public class class_name { public static Trie fromString(Path.ID id) { if(id instanceof Trie) { return ((Trie)id); } Trie r = ROOT; for(int i=0;i!=id.size();++i) { r = r.append(id.get(i)); } return r; } }
public class class_name { public static Trie fromString(Path.ID id) { if(id instanceof Trie) { return ((Trie)id); // depends on control dependency: [if], data = [none] } Trie r = ROOT; for(int i=0;i!=id.size();++i) { r = r.append(id.get(i)); // depends on control dependency: [for], data = [i] } return r; } }
public class class_name { public void populateMetadata(final Target target) { removeAllItems(); if (target == null) { return; } selectedTargetId = target.getId(); final List<TargetMetadata> targetMetadataList = targetManagement .findMetaDataByControllerId(PageRequest.of(0, MAX_METADATA_QUERY), target.getControllerId()) .getContent(); if (targetMetadataList != null && !targetMetadataList.isEmpty()) { targetMetadataList.forEach(this::setMetadataProperties); } } }
public class class_name { public void populateMetadata(final Target target) { removeAllItems(); if (target == null) { return; // depends on control dependency: [if], data = [none] } selectedTargetId = target.getId(); final List<TargetMetadata> targetMetadataList = targetManagement .findMetaDataByControllerId(PageRequest.of(0, MAX_METADATA_QUERY), target.getControllerId()) .getContent(); if (targetMetadataList != null && !targetMetadataList.isEmpty()) { targetMetadataList.forEach(this::setMetadataProperties); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Location getLocation(Object obj, String description) { if (obj instanceof Location) { return (Location) obj; } if (obj instanceof Locatable) { return ((Locatable) obj).getLocation(); } if (obj instanceof SAXParseException) { SAXParseException spe = (SAXParseException) obj; if (spe.getSystemId() != null) { return new LocationImpl(description, spe.getSystemId(), spe.getLineNumber(), spe.getColumnNumber()); } else { return LocationImpl.UNKNOWN; } } if (obj instanceof TransformerException) { TransformerException ex = (TransformerException) obj; SourceLocator locator = ex.getLocator(); if (locator != null && locator.getSystemId() != null) { return new LocationImpl(description, locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); } else { return LocationImpl.UNKNOWN; } } if (obj instanceof Locator) { Locator locator = (Locator) obj; if (locator.getSystemId() != null) { return new LocationImpl(description, locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); } else { return LocationImpl.UNKNOWN; } } if (obj instanceof Element) { return LocationAttributes.getLocation((Element) obj); } List<WeakReference<LocationFinder>> currentFinders = finders; int size = currentFinders.size(); for (int i = 0; i < size; i++) { WeakReference<LocationFinder> ref = currentFinders.get(i); LocationFinder finder = ref.get(); if (finder == null) { synchronized (LocationFinder.class) { List<WeakReference<LocationFinder>> newFinders = new ArrayList<WeakReference<LocationFinder>>( finders); newFinders.remove(ref); finders = newFinders; } } Location result = finder.getLocation(obj, description); if (result != null) { return result; } } if (obj instanceof Throwable) { Throwable t = (Throwable) obj; StackTraceElement[] stack = t.getStackTrace(); if (stack != null && stack.length > 0) { StackTraceElement trace = stack[0]; if (trace.getLineNumber() >= 0) { String uri = trace.getClassName(); if (trace.getFileName() != null) { uri = uri.replace('.', '/'); uri = uri.substring(0, uri.lastIndexOf('/') + 1); uri = uri + trace.getFileName(); URL url = ClassLoaderUtil.getResource(uri, LocationUtils.class); if (url != null) { uri = url.toString(); } } if (description == null) { StringBuilder sb = new StringBuilder(); sb.append("Class: ").append(trace.getClassName()).append("\n"); sb.append("File: ").append(trace.getFileName()).append("\n"); sb.append("Method: ").append(trace.getMethodName()).append("\n"); sb.append("Line: ").append(trace.getLineNumber()); description = sb.toString(); } return new LocationImpl(description, uri, trace.getLineNumber(), -1); } } } return LocationImpl.UNKNOWN; } }
public class class_name { public static Location getLocation(Object obj, String description) { if (obj instanceof Location) { return (Location) obj; // depends on control dependency: [if], data = [none] } if (obj instanceof Locatable) { return ((Locatable) obj).getLocation(); // depends on control dependency: [if], data = [none] } if (obj instanceof SAXParseException) { SAXParseException spe = (SAXParseException) obj; if (spe.getSystemId() != null) { return new LocationImpl(description, spe.getSystemId(), spe.getLineNumber(), spe.getColumnNumber()); // depends on control dependency: [if], data = [none] } else { return LocationImpl.UNKNOWN; // depends on control dependency: [if], data = [none] } } if (obj instanceof TransformerException) { TransformerException ex = (TransformerException) obj; SourceLocator locator = ex.getLocator(); if (locator != null && locator.getSystemId() != null) { return new LocationImpl(description, locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); // depends on control dependency: [if], data = [none] } else { return LocationImpl.UNKNOWN; // depends on control dependency: [if], data = [none] } } if (obj instanceof Locator) { Locator locator = (Locator) obj; if (locator.getSystemId() != null) { return new LocationImpl(description, locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); // depends on control dependency: [if], data = [none] } else { return LocationImpl.UNKNOWN; // depends on control dependency: [if], data = [none] } } if (obj instanceof Element) { return LocationAttributes.getLocation((Element) obj); // depends on control dependency: [if], data = [none] } List<WeakReference<LocationFinder>> currentFinders = finders; int size = currentFinders.size(); for (int i = 0; i < size; i++) { WeakReference<LocationFinder> ref = currentFinders.get(i); LocationFinder finder = ref.get(); if (finder == null) { synchronized (LocationFinder.class) { // depends on control dependency: [if], data = [none] List<WeakReference<LocationFinder>> newFinders = new ArrayList<WeakReference<LocationFinder>>( finders); newFinders.remove(ref); finders = newFinders; } } Location result = finder.getLocation(obj, description); if (result != null) { return result; // depends on control dependency: [if], data = [none] } } if (obj instanceof Throwable) { Throwable t = (Throwable) obj; StackTraceElement[] stack = t.getStackTrace(); if (stack != null && stack.length > 0) { StackTraceElement trace = stack[0]; if (trace.getLineNumber() >= 0) { String uri = trace.getClassName(); if (trace.getFileName() != null) { uri = uri.replace('.', '/'); // depends on control dependency: [if], data = [none] uri = uri.substring(0, uri.lastIndexOf('/') + 1); // depends on control dependency: [if], data = [none] uri = uri + trace.getFileName(); // depends on control dependency: [if], data = [none] URL url = ClassLoaderUtil.getResource(uri, LocationUtils.class); if (url != null) { uri = url.toString(); // depends on control dependency: [if], data = [none] } } if (description == null) { StringBuilder sb = new StringBuilder(); sb.append("Class: ").append(trace.getClassName()).append("\n"); // depends on control dependency: [if], data = [none] sb.append("File: ").append(trace.getFileName()).append("\n"); // depends on control dependency: [if], data = [none] sb.append("Method: ").append(trace.getMethodName()).append("\n"); // depends on control dependency: [if], data = [none] sb.append("Line: ").append(trace.getLineNumber()); // depends on control dependency: [if], data = [none] description = sb.toString(); // depends on control dependency: [if], data = [none] } return new LocationImpl(description, uri, trace.getLineNumber(), -1); // depends on control dependency: [if], data = [none] } } } return LocationImpl.UNKNOWN; } }
public class class_name { final void set(ClassWriter cw, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { int i = convert(cw, nLocal, local, inputLocals); while (i < local.length) { inputLocals[i++] = TOP; } int nStackTop = 0; for (int j = 0; j < nStack; ++j) { if (stack[j] == Opcodes.LONG || stack[j] == Opcodes.DOUBLE) { ++nStackTop; } } inputStack = new int[nStack + nStackTop]; convert(cw, nStack, stack, inputStack); outputStackTop = 0; initializationCount = 0; } }
public class class_name { final void set(ClassWriter cw, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { int i = convert(cw, nLocal, local, inputLocals); while (i < local.length) { inputLocals[i++] = TOP; // depends on control dependency: [while], data = [none] } int nStackTop = 0; for (int j = 0; j < nStack; ++j) { if (stack[j] == Opcodes.LONG || stack[j] == Opcodes.DOUBLE) { ++nStackTop; // depends on control dependency: [if], data = [none] } } inputStack = new int[nStack + nStackTop]; convert(cw, nStack, stack, inputStack); outputStackTop = 0; initializationCount = 0; } }
public class class_name { private Integer getFrequency(Project.Calendars.Calendar.Exceptions.Exception exception) { Integer period = NumberHelper.getInteger(exception.getPeriod()); if (period == null) { period = Integer.valueOf(1); } return period; } }
public class class_name { private Integer getFrequency(Project.Calendars.Calendar.Exceptions.Exception exception) { Integer period = NumberHelper.getInteger(exception.getPeriod()); if (period == null) { period = Integer.valueOf(1); // depends on control dependency: [if], data = [none] } return period; } }
public class class_name { @Nonnull @ReturnsMutableCopy public static byte [] encodeCharToBytes (@Nonnull final char [] aCharArray, @Nonnegative final int nOfs, @Nonnegative final int nLen, @Nonnull final Charset aCharset) { ValueEnforcer.isArrayOfsLen (aCharArray, nOfs, nLen); final CharsetEncoder aEncoder = aCharset.newEncoder (); // We need to perform double, not float, arithmetic; otherwise // we lose low order bits when nLen is larger than 2^24. final int nEncodedLen = (int) (nLen * (double) aEncoder.maxBytesPerChar ()); final byte [] aByteArray = new byte [nEncodedLen]; if (nLen == 0) return aByteArray; aEncoder.onMalformedInput (CodingErrorAction.REPLACE).onUnmappableCharacter (CodingErrorAction.REPLACE).reset (); final CharBuffer aSrcBuf = CharBuffer.wrap (aCharArray, nOfs, nLen); final ByteBuffer aDstBuf = ByteBuffer.wrap (aByteArray); try { CoderResult aRes = aEncoder.encode (aSrcBuf, aDstBuf, true); if (!aRes.isUnderflow ()) aRes.throwException (); aRes = aEncoder.flush (aDstBuf); if (!aRes.isUnderflow ()) aRes.throwException (); } catch (final CharacterCodingException x) { throw new IllegalStateException (x); } final int nDstLen = aDstBuf.position (); if (nDstLen == aByteArray.length) return aByteArray; return Arrays.copyOf (aByteArray, nDstLen); } }
public class class_name { @Nonnull @ReturnsMutableCopy public static byte [] encodeCharToBytes (@Nonnull final char [] aCharArray, @Nonnegative final int nOfs, @Nonnegative final int nLen, @Nonnull final Charset aCharset) { ValueEnforcer.isArrayOfsLen (aCharArray, nOfs, nLen); final CharsetEncoder aEncoder = aCharset.newEncoder (); // We need to perform double, not float, arithmetic; otherwise // we lose low order bits when nLen is larger than 2^24. final int nEncodedLen = (int) (nLen * (double) aEncoder.maxBytesPerChar ()); final byte [] aByteArray = new byte [nEncodedLen]; if (nLen == 0) return aByteArray; aEncoder.onMalformedInput (CodingErrorAction.REPLACE).onUnmappableCharacter (CodingErrorAction.REPLACE).reset (); final CharBuffer aSrcBuf = CharBuffer.wrap (aCharArray, nOfs, nLen); final ByteBuffer aDstBuf = ByteBuffer.wrap (aByteArray); try { CoderResult aRes = aEncoder.encode (aSrcBuf, aDstBuf, true); if (!aRes.isUnderflow ()) aRes.throwException (); aRes = aEncoder.flush (aDstBuf); // depends on control dependency: [try], data = [none] if (!aRes.isUnderflow ()) aRes.throwException (); } catch (final CharacterCodingException x) { throw new IllegalStateException (x); } // depends on control dependency: [catch], data = [none] final int nDstLen = aDstBuf.position (); if (nDstLen == aByteArray.length) return aByteArray; return Arrays.copyOf (aByteArray, nDstLen); } }
public class class_name { public boolean consume(String token) { if (getInput().toString().startsWith(token)) { index += token.length(); return true; } return false; } }
public class class_name { public boolean consume(String token) { if (getInput().toString().startsWith(token)) { index += token.length(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void initSharedRecord(Record record) { FieldListener listener = null; try { BaseField field = record.getSharedRecordTypeKey(); field.addListener(listener = new InitOnceFieldHandler(null)); field.setData(new Integer(0), true, DBConstants.INIT_MOVE); field.setData(new Integer(0), true, DBConstants.INIT_MOVE); if (field != null) if (field.getDataClass() == Integer.class) { for (int i = 1; ; i++) { Integer intData = new Integer(i); field.setData(intData); record.addNew(); Record recShared = record.getTable().getCurrentTable().getRecord(); if (recShared == null) break; if (recShared == record) break; if (recShared.getField(field.getFieldName()).getValue() != i) break; this.disableAllListeners(recShared); } } } catch (DBException ex) { ex.printStackTrace(); } finally { if (listener != null) record.removeListener(listener, true); } } }
public class class_name { public void initSharedRecord(Record record) { FieldListener listener = null; try { BaseField field = record.getSharedRecordTypeKey(); field.addListener(listener = new InitOnceFieldHandler(null)); // depends on control dependency: [try], data = [none] field.setData(new Integer(0), true, DBConstants.INIT_MOVE); // depends on control dependency: [try], data = [none] field.setData(new Integer(0), true, DBConstants.INIT_MOVE); // depends on control dependency: [try], data = [none] if (field != null) if (field.getDataClass() == Integer.class) { for (int i = 1; ; i++) { Integer intData = new Integer(i); field.setData(intData); // depends on control dependency: [for], data = [none] record.addNew(); // depends on control dependency: [for], data = [none] Record recShared = record.getTable().getCurrentTable().getRecord(); if (recShared == null) break; if (recShared == record) break; if (recShared.getField(field.getFieldName()).getValue() != i) break; this.disableAllListeners(recShared); // depends on control dependency: [for], data = [none] } } } catch (DBException ex) { ex.printStackTrace(); } finally { // depends on control dependency: [catch], data = [none] if (listener != null) record.removeListener(listener, true); } } }
public class class_name { private void processAudioBox(SampleTableBox stbl, AudioSampleEntry ase, long scale) { // get codec String codecName = ase.getType(); // set the audio codec here - may be mp4a or... setAudioCodecId(codecName); log.debug("Sample size: {}", ase.getSampleSize()); long ats = ase.getSampleRate(); // skip invalid audio time scale if (ats > 0) { audioTimeScale = ats * 1.0; } log.debug("Sample rate (audio time scale): {}", audioTimeScale); audioChannels = ase.getChannelCount(); log.debug("Channels: {}", audioChannels); if (ase.getBoxes(ESDescriptorBox.class).size() > 0) { // look for esds ESDescriptorBox esds = ase.getBoxes(ESDescriptorBox.class).get(0); if (esds == null) { log.debug("esds not found in default path"); // check for decompression param atom AppleWaveBox wave = ase.getBoxes(AppleWaveBox.class).get(0); if (wave != null) { log.debug("wave atom found"); // wave/esds esds = wave.getBoxes(ESDescriptorBox.class).get(0); if (esds == null) { log.debug("esds not found in wave"); // mp4a/esds //AC3SpecificBox mp4a = wave.getBoxes(AC3SpecificBox.class).get(0); //esds = mp4a.getBoxes(ESDescriptorBox.class).get(0); } } } //mp4a: esds if (esds != null) { // http://stackoverflow.com/questions/3987850/mp4-atom-how-to-discriminate-the-audio-codec-is-it-aac-or-mp3 ESDescriptor descriptor = esds.getEsDescriptor(); if (descriptor != null) { DecoderConfigDescriptor configDescriptor = descriptor.getDecoderConfigDescriptor(); AudioSpecificConfig audioInfo = configDescriptor.getAudioSpecificInfo(); if (audioInfo != null) { audioDecoderBytes = audioInfo.getConfigBytes(); /* the first 5 (0-4) bits tell us about the coder used for aacaot/aottype * http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio 0 - NULL 1 - AAC Main (a deprecated AAC profile from MPEG-2) 2 - AAC LC or backwards compatible HE-AAC 3 - AAC Scalable Sample Rate 4 - AAC LTP (a replacement for AAC Main, rarely used) 5 - HE-AAC explicitly signaled (Non-backward compatible) 23 - Low Delay AAC 29 - HE-AACv2 explicitly signaled 32 - MP3on4 Layer 1 33 - MP3on4 Layer 2 34 - MP3on4 Layer 3 */ byte audioCoderType = audioDecoderBytes[0]; //match first byte switch (audioCoderType) { case 0x02: log.debug("Audio type AAC LC"); case 0x11: //ER (Error Resilient) AAC LC log.debug("Audio type ER AAC LC"); default: audioCodecType = 1; //AAC LC break; case 0x01: log.debug("Audio type AAC Main"); audioCodecType = 0; //AAC Main break; case 0x03: log.debug("Audio type AAC SBR"); audioCodecType = 2; //AAC LC SBR break; case 0x05: case 0x1d: log.debug("Audio type AAC HE"); audioCodecType = 3; //AAC HE break; case 0x20: case 0x21: case 0x22: log.debug("Audio type MP3"); audioCodecType = 33; //MP3 audioCodecId = "mp3"; break; } log.debug("Audio coder type: {} {} id: {}", new Object[] { audioCoderType, Integer.toBinaryString(audioCoderType), audioCodecId }); } else { log.debug("Audio specific config was not found"); DecoderSpecificInfo info = configDescriptor.getDecoderSpecificInfo(); if (info != null) { log.debug("Decoder info found: {}", info.getTag()); // qcelp == 5 } } } else { log.debug("No ES descriptor found"); } } } else { log.debug("Audio sample entry had no descriptor"); } //stsc - has Records SampleToChunkBox stsc = stbl.getSampleToChunkBox(); // stsc if (stsc != null) { log.debug("Sample to chunk atom found"); audioSamplesToChunks = stsc.getEntries(); log.debug("Audio samples to chunks: {}", audioSamplesToChunks.size()); // handle instance where there are no actual records (bad f4v?) } //stsz - has Samples SampleSizeBox stsz = stbl.getSampleSizeBox(); // stsz if (stsz != null) { log.debug("Sample size atom found"); audioSamples = stsz.getSampleSizes(); log.debug("Samples: {}", audioSamples.length); // if sample size is 0 then the table must be checked due to variable sample sizes audioSampleSize = stsz.getSampleSize(); log.debug("Sample size: {}", audioSampleSize); long audioSampleCount = stsz.getSampleCount(); log.debug("Sample count: {}", audioSampleCount); } //stco - has Chunks ChunkOffsetBox stco = stbl.getChunkOffsetBox(); // stco / co64 if (stco != null) { log.debug("Chunk offset atom found"); audioChunkOffsets = stco.getChunkOffsets(); log.debug("Chunk count: {}", audioChunkOffsets.length); } else { //co64 - has Chunks ChunkOffset64BitBox co64 = stbl.getBoxes(ChunkOffset64BitBox.class).get(0); if (co64 != null) { log.debug("Chunk offset (64) atom found"); audioChunkOffsets = co64.getChunkOffsets(); log.debug("Chunk count: {}", audioChunkOffsets.length); } } //stts - has TimeSampleRecords TimeToSampleBox stts = stbl.getTimeToSampleBox(); // stts if (stts != null) { log.debug("Time to sample atom found"); List<TimeToSampleBox.Entry> records = stts.getEntries(); log.debug("Audio time to samples: {}", records.size()); // handle instance where there are no actual records (bad f4v?) if (records.size() > 0) { TimeToSampleBox.Entry rec = records.get(0); log.debug("Samples = {} delta = {}", rec.getCount(), rec.getDelta()); //if we have 1 record it means all samples have the same duration audioSampleDuration = rec.getDelta(); } } // sdtp - sample dependency type SampleDependencyTypeBox sdtp = stbl.getSampleDependencyTypeBox(); // sdtp if (sdtp != null) { log.debug("Independent and disposable samples atom found"); List<SampleDependencyTypeBox.Entry> recs = sdtp.getEntries(); for (SampleDependencyTypeBox.Entry rec : recs) { log.debug("{}", rec); } } } }
public class class_name { private void processAudioBox(SampleTableBox stbl, AudioSampleEntry ase, long scale) { // get codec String codecName = ase.getType(); // set the audio codec here - may be mp4a or... setAudioCodecId(codecName); log.debug("Sample size: {}", ase.getSampleSize()); long ats = ase.getSampleRate(); // skip invalid audio time scale if (ats > 0) { audioTimeScale = ats * 1.0; // depends on control dependency: [if], data = [none] } log.debug("Sample rate (audio time scale): {}", audioTimeScale); audioChannels = ase.getChannelCount(); log.debug("Channels: {}", audioChannels); if (ase.getBoxes(ESDescriptorBox.class).size() > 0) { // look for esds ESDescriptorBox esds = ase.getBoxes(ESDescriptorBox.class).get(0); if (esds == null) { log.debug("esds not found in default path"); // depends on control dependency: [if], data = [none] // check for decompression param atom AppleWaveBox wave = ase.getBoxes(AppleWaveBox.class).get(0); if (wave != null) { log.debug("wave atom found"); // depends on control dependency: [if], data = [none] // wave/esds esds = wave.getBoxes(ESDescriptorBox.class).get(0); // depends on control dependency: [if], data = [none] if (esds == null) { log.debug("esds not found in wave"); // depends on control dependency: [if], data = [none] // mp4a/esds //AC3SpecificBox mp4a = wave.getBoxes(AC3SpecificBox.class).get(0); //esds = mp4a.getBoxes(ESDescriptorBox.class).get(0); } } } //mp4a: esds if (esds != null) { // http://stackoverflow.com/questions/3987850/mp4-atom-how-to-discriminate-the-audio-codec-is-it-aac-or-mp3 ESDescriptor descriptor = esds.getEsDescriptor(); if (descriptor != null) { DecoderConfigDescriptor configDescriptor = descriptor.getDecoderConfigDescriptor(); AudioSpecificConfig audioInfo = configDescriptor.getAudioSpecificInfo(); if (audioInfo != null) { audioDecoderBytes = audioInfo.getConfigBytes(); /* the first 5 (0-4) bits tell us about the coder used for aacaot/aottype * http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio 0 - NULL 1 - AAC Main (a deprecated AAC profile from MPEG-2) 2 - AAC LC or backwards compatible HE-AAC 3 - AAC Scalable Sample Rate 4 - AAC LTP (a replacement for AAC Main, rarely used) 5 - HE-AAC explicitly signaled (Non-backward compatible) 23 - Low Delay AAC 29 - HE-AACv2 explicitly signaled 32 - MP3on4 Layer 1 33 - MP3on4 Layer 2 34 - MP3on4 Layer 3 */ byte audioCoderType = audioDecoderBytes[0]; //match first byte switch (audioCoderType) { case 0x02: log.debug("Audio type AAC LC"); case 0x11: //ER (Error Resilient) AAC LC log.debug("Audio type ER AAC LC"); default: audioCodecType = 1; //AAC LC break; case 0x01: log.debug("Audio type AAC Main"); audioCodecType = 0; //AAC Main break; case 0x03: log.debug("Audio type AAC SBR"); audioCodecType = 2; //AAC LC SBR break; case 0x05: case 0x1d: log.debug("Audio type AAC HE"); audioCodecType = 3; //AAC HE break; case 0x20: case 0x21: case 0x22: log.debug("Audio type MP3"); audioCodecType = 33; //MP3 audioCodecId = "mp3"; break; } log.debug("Audio coder type: {} {} id: {}", new Object[] { audioCoderType, Integer.toBinaryString(audioCoderType), audioCodecId }); } else { log.debug("Audio specific config was not found"); DecoderSpecificInfo info = configDescriptor.getDecoderSpecificInfo(); if (info != null) { log.debug("Decoder info found: {}", info.getTag()); // qcelp == 5 } } } else { log.debug("No ES descriptor found"); } } } else { log.debug("Audio sample entry had no descriptor"); } //stsc - has Records SampleToChunkBox stsc = stbl.getSampleToChunkBox(); // stsc if (stsc != null) { log.debug("Sample to chunk atom found"); audioSamplesToChunks = stsc.getEntries(); log.debug("Audio samples to chunks: {}", audioSamplesToChunks.size()); // handle instance where there are no actual records (bad f4v?) } //stsz - has Samples SampleSizeBox stsz = stbl.getSampleSizeBox(); // stsz if (stsz != null) { log.debug("Sample size atom found"); audioSamples = stsz.getSampleSizes(); log.debug("Samples: {}", audioSamples.length); // if sample size is 0 then the table must be checked due to variable sample sizes audioSampleSize = stsz.getSampleSize(); log.debug("Sample size: {}", audioSampleSize); long audioSampleCount = stsz.getSampleCount(); log.debug("Sample count: {}", audioSampleCount); } //stco - has Chunks ChunkOffsetBox stco = stbl.getChunkOffsetBox(); // stco / co64 if (stco != null) { log.debug("Chunk offset atom found"); audioChunkOffsets = stco.getChunkOffsets(); log.debug("Chunk count: {}", audioChunkOffsets.length); } else { //co64 - has Chunks ChunkOffset64BitBox co64 = stbl.getBoxes(ChunkOffset64BitBox.class).get(0); if (co64 != null) { log.debug("Chunk offset (64) atom found"); audioChunkOffsets = co64.getChunkOffsets(); log.debug("Chunk count: {}", audioChunkOffsets.length); } } //stts - has TimeSampleRecords TimeToSampleBox stts = stbl.getTimeToSampleBox(); // stts if (stts != null) { log.debug("Time to sample atom found"); List<TimeToSampleBox.Entry> records = stts.getEntries(); log.debug("Audio time to samples: {}", records.size()); // handle instance where there are no actual records (bad f4v?) if (records.size() > 0) { TimeToSampleBox.Entry rec = records.get(0); log.debug("Samples = {} delta = {}", rec.getCount(), rec.getDelta()); //if we have 1 record it means all samples have the same duration audioSampleDuration = rec.getDelta(); } } // sdtp - sample dependency type SampleDependencyTypeBox sdtp = stbl.getSampleDependencyTypeBox(); // sdtp if (sdtp != null) { log.debug("Independent and disposable samples atom found"); List<SampleDependencyTypeBox.Entry> recs = sdtp.getEntries(); for (SampleDependencyTypeBox.Entry rec : recs) { log.debug("{}", rec); } } } }
public class class_name { @Override public void notifyTimeout(AllocationID key, UUID ticket) { checkInit(); if (slotActions != null) { slotActions.timeoutSlot(key, ticket); } } }
public class class_name { @Override public void notifyTimeout(AllocationID key, UUID ticket) { checkInit(); if (slotActions != null) { slotActions.timeoutSlot(key, ticket); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static String encode(String text, char[][] array) { int len; if ((text == null) || ((len = text.length()) == 0)) { return StrUtil.EMPTY; } StringBuilder buffer = new StringBuilder(len + (len >> 2)); char c; for (int i = 0; i < len; i++) { c = text.charAt(i); if (c < 64) { buffer.append(array[c]); } else { buffer.append(c); } } return buffer.toString(); } }
public class class_name { private static String encode(String text, char[][] array) { int len; if ((text == null) || ((len = text.length()) == 0)) { return StrUtil.EMPTY; // depends on control dependency: [if], data = [none] } StringBuilder buffer = new StringBuilder(len + (len >> 2)); char c; for (int i = 0; i < len; i++) { c = text.charAt(i); // depends on control dependency: [for], data = [i] if (c < 64) { buffer.append(array[c]); // depends on control dependency: [if], data = [none] } else { buffer.append(c); // depends on control dependency: [if], data = [(c] } } return buffer.toString(); } }
public class class_name { private OGCGeometry simplifyBunch_(GeometryCursor gc) { // Combines geometries into multipoint, polyline, and polygon types, // simplifying them and unioning them, // then produces OGCGeometry from the result. // Can produce OGCConcreteGoemetryCollection MultiPoint dstMultiPoint = null; ArrayList<Geometry> dstPolylines = new ArrayList<Geometry>(); ArrayList<Geometry> dstPolygons = new ArrayList<Geometry>(); for (com.esri.core.geometry.Geometry g = gc.next(); g != null; g = gc .next()) { switch (g.getType()) { case Point: if (dstMultiPoint == null) dstMultiPoint = new MultiPoint(); dstMultiPoint.add((Point) g); break; case MultiPoint: if (dstMultiPoint == null) dstMultiPoint = new MultiPoint(); dstMultiPoint.add((MultiPoint) g, 0, -1); break; case Polyline: dstPolylines.add((Polyline) g.copy()); break; case Polygon: dstPolygons.add((Polygon) g.copy()); break; default: throw new UnsupportedOperationException(); } } ArrayList<Geometry> result = new ArrayList<Geometry>(3); if (dstMultiPoint != null) { Geometry resMP = OperatorSimplifyOGC.local().execute(dstMultiPoint, esriSR, true, null); result.add(resMP); } if (dstPolylines.size() > 0) { if (dstPolylines.size() == 1) { Geometry resMP = OperatorSimplifyOGC.local().execute( dstPolylines.get(0), esriSR, true, null); result.add(resMP); } else { GeometryCursor res = OperatorUnion.local().execute( new SimpleGeometryCursor(dstPolylines), esriSR, null); Geometry resPolyline = res.next(); Geometry resMP = OperatorSimplifyOGC.local().execute( resPolyline, esriSR, true, null); result.add(resMP); } } if (dstPolygons.size() > 0) { if (dstPolygons.size() == 1) { Geometry resMP = OperatorSimplifyOGC.local().execute( dstPolygons.get(0), esriSR, true, null); result.add(resMP); } else { GeometryCursor res = OperatorUnion.local().execute( new SimpleGeometryCursor(dstPolygons), esriSR, null); Geometry resPolygon = res.next(); Geometry resMP = OperatorSimplifyOGC.local().execute( resPolygon, esriSR, true, null); result.add(resMP); } } return OGCGeometry.createFromEsriCursor( new SimpleGeometryCursor(result), esriSR); } }
public class class_name { private OGCGeometry simplifyBunch_(GeometryCursor gc) { // Combines geometries into multipoint, polyline, and polygon types, // simplifying them and unioning them, // then produces OGCGeometry from the result. // Can produce OGCConcreteGoemetryCollection MultiPoint dstMultiPoint = null; ArrayList<Geometry> dstPolylines = new ArrayList<Geometry>(); ArrayList<Geometry> dstPolygons = new ArrayList<Geometry>(); for (com.esri.core.geometry.Geometry g = gc.next(); g != null; g = gc .next()) { switch (g.getType()) { case Point: if (dstMultiPoint == null) dstMultiPoint = new MultiPoint(); dstMultiPoint.add((Point) g); break; case MultiPoint: if (dstMultiPoint == null) dstMultiPoint = new MultiPoint(); dstMultiPoint.add((MultiPoint) g, 0, -1); break; case Polyline: dstPolylines.add((Polyline) g.copy()); break; case Polygon: dstPolygons.add((Polygon) g.copy()); break; default: throw new UnsupportedOperationException(); } } ArrayList<Geometry> result = new ArrayList<Geometry>(3); if (dstMultiPoint != null) { Geometry resMP = OperatorSimplifyOGC.local().execute(dstMultiPoint, esriSR, true, null); result.add(resMP); // depends on control dependency: [if], data = [none] } if (dstPolylines.size() > 0) { if (dstPolylines.size() == 1) { Geometry resMP = OperatorSimplifyOGC.local().execute( dstPolylines.get(0), esriSR, true, null); result.add(resMP); // depends on control dependency: [if], data = [none] } else { GeometryCursor res = OperatorUnion.local().execute( new SimpleGeometryCursor(dstPolylines), esriSR, null); Geometry resPolyline = res.next(); Geometry resMP = OperatorSimplifyOGC.local().execute( resPolyline, esriSR, true, null); result.add(resMP); // depends on control dependency: [if], data = [none] } } if (dstPolygons.size() > 0) { if (dstPolygons.size() == 1) { Geometry resMP = OperatorSimplifyOGC.local().execute( dstPolygons.get(0), esriSR, true, null); result.add(resMP); // depends on control dependency: [if], data = [none] } else { GeometryCursor res = OperatorUnion.local().execute( new SimpleGeometryCursor(dstPolygons), esriSR, null); Geometry resPolygon = res.next(); Geometry resMP = OperatorSimplifyOGC.local().execute( resPolygon, esriSR, true, null); result.add(resMP); // depends on control dependency: [if], data = [none] } } return OGCGeometry.createFromEsriCursor( new SimpleGeometryCursor(result), esriSR); } }
public class class_name { public GetRegionsResult withRegions(Region... regions) { if (this.regions == null) { setRegions(new java.util.ArrayList<Region>(regions.length)); } for (Region ele : regions) { this.regions.add(ele); } return this; } }
public class class_name { public GetRegionsResult withRegions(Region... regions) { if (this.regions == null) { setRegions(new java.util.ArrayList<Region>(regions.length)); // depends on control dependency: [if], data = [none] } for (Region ele : regions) { this.regions.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void filterEmbeddedGalleryOptions(JSONObject json) { Set<String> validKeys = Sets.newHashSet( Arrays.asList( I_CmsGalleryProviderConstants.CONFIG_GALLERY_TYPES, I_CmsGalleryProviderConstants.CONFIG_GALLERY_PATH, I_CmsGalleryProviderConstants.CONFIG_USE_FORMATS, I_CmsGalleryProviderConstants.CONFIG_IMAGE_FORMAT_NAMES, I_CmsGalleryProviderConstants.CONFIG_IMAGE_FORMATS)); // delete all keys not listed above Set<String> toDelete = new HashSet<String>(Sets.difference(json.keySet(), validKeys)); for (String toDeleteKey : toDelete) { json.remove(toDeleteKey); } } }
public class class_name { private void filterEmbeddedGalleryOptions(JSONObject json) { Set<String> validKeys = Sets.newHashSet( Arrays.asList( I_CmsGalleryProviderConstants.CONFIG_GALLERY_TYPES, I_CmsGalleryProviderConstants.CONFIG_GALLERY_PATH, I_CmsGalleryProviderConstants.CONFIG_USE_FORMATS, I_CmsGalleryProviderConstants.CONFIG_IMAGE_FORMAT_NAMES, I_CmsGalleryProviderConstants.CONFIG_IMAGE_FORMATS)); // delete all keys not listed above Set<String> toDelete = new HashSet<String>(Sets.difference(json.keySet(), validKeys)); for (String toDeleteKey : toDelete) { json.remove(toDeleteKey); // depends on control dependency: [for], data = [toDeleteKey] } } }
public class class_name { public DirectedGraph<BasicBlock> build(List<Instruction> instructions) { // Map of label & basic blocks which are waiting for a bb with that label Map<Label, List<BasicBlock>> forwardRefs = new HashMap<Label, List<BasicBlock>>(); // List of bbs that have a 'return' instruction List<BasicBlock> returnBBs = new ArrayList<BasicBlock>(); // List of bbs that have a 'throw' instruction List<BasicBlock> exceptionBBs = new ArrayList<BasicBlock>(); // Stack of nested rescue regions Stack<ExceptionRegion> nestedExceptionRegions = new Stack<ExceptionRegion>(); // List of all rescued regions List<ExceptionRegion> allExceptionRegions = new ArrayList<ExceptionRegion>(); // Dummy entry basic block (see note at end to see why) entryBB = createBB(nestedExceptionRegions); // First real bb BasicBlock firstBB = createBB(nestedExceptionRegions); // Build the rest! BasicBlock currBB = firstBB; BasicBlock newBB; boolean bbEnded = false; boolean nextBBIsFallThrough = true; for (Instruction i : instructions) { if (i instanceof LabelInstr) { Label l = ((LabelInstr) i).getLabel(); newBB = createBB(l, nestedExceptionRegions); // Jump instruction bbs dont add an edge to the succeeding bb by default if (nextBBIsFallThrough) graph.addEdge(currBB, newBB, EdgeType.FALL_THROUGH); currBB = newBB; bbEnded = false; nextBBIsFallThrough = true; // Add forward reference edges List<BasicBlock> frefs = forwardRefs.get(l); if (frefs != null) { for (BasicBlock b : frefs) { graph.addEdge(b, newBB, EdgeType.REGULAR); } } } else if (bbEnded && !(i instanceof ExceptionRegionEndMarker)) { newBB = createBB(nestedExceptionRegions); // Jump instruction bbs dont add an edge to the succeeding bb by default if (nextBBIsFallThrough) graph.addEdge(currBB, newBB, EdgeType.FALL_THROUGH); // currBB cannot be null! currBB = newBB; bbEnded = false; nextBBIsFallThrough = true; } if (i instanceof ExceptionRegionStartMarker) { // We dont need the instruction anymore -- so it is not added to the CFG. ExceptionRegionStartMarker ersmi = (ExceptionRegionStartMarker) i; ExceptionRegion rr = new ExceptionRegion(ersmi.getLabel(), currBB); rr.addBB(currBB); allExceptionRegions.add(rr); if (!nestedExceptionRegions.empty()) { nestedExceptionRegions.peek().addNestedRegion(rr); } nestedExceptionRegions.push(rr); } else if (i instanceof ExceptionRegionEndMarker) { // We dont need the instruction anymore -- so it is not added to the CFG. nestedExceptionRegions.pop().setEndBB(currBB); } else if (i.transfersControl()) { bbEnded = true; currBB.addInstr(i); Label target; nextBBIsFallThrough = false; if (i instanceof Branch) { target = ((Branch) i).getTarget(); nextBBIsFallThrough = true; } else if (i instanceof Jump) { target = ((Jump) i).getTarget(); } else if (i instanceof Return) { target = null; returnBBs.add(currBB); } else if (i instanceof ThrowException) { target = null; exceptionBBs.add(currBB); } else { throw new RuntimeException("Unhandled case in CFG builder for basic block ending instr: " + i); } if (target != null) addEdge(currBB, target, forwardRefs); } else if (!(i instanceof LabelInstr)) { currBB.addInstr(i); } } // Process all rescued regions for (ExceptionRegion rr : allExceptionRegions) { // When this exception region represents an unrescued region // from a copied ensure block, we have a dummy label Label rescueLabel = rr.getFirstRescueBlockLabel(); if (!Label.UNRESCUED_REGION_LABEL.equals(rescueLabel)) { BasicBlock firstRescueBB = bbMap.get(rescueLabel); // Mark the BB as a rescue entry BB firstRescueBB.markRescueEntryBB(); // Record a mapping from the region's exclusive basic blocks to the first bb that will start exception handling for all their exceptions. // Add an exception edge from every exclusive bb of the region to firstRescueBB for (BasicBlock b : rr.getExclusiveBBs()) { setRescuerBB(b, firstRescueBB); graph.addEdge(b, firstRescueBB, EdgeType.EXCEPTION); } } } buildExitBasicBlock(nestedExceptionRegions, firstBB, returnBBs, exceptionBBs, nextBBIsFallThrough, currBB, entryBB); optimize(); return graph; } }
public class class_name { public DirectedGraph<BasicBlock> build(List<Instruction> instructions) { // Map of label & basic blocks which are waiting for a bb with that label Map<Label, List<BasicBlock>> forwardRefs = new HashMap<Label, List<BasicBlock>>(); // List of bbs that have a 'return' instruction List<BasicBlock> returnBBs = new ArrayList<BasicBlock>(); // List of bbs that have a 'throw' instruction List<BasicBlock> exceptionBBs = new ArrayList<BasicBlock>(); // Stack of nested rescue regions Stack<ExceptionRegion> nestedExceptionRegions = new Stack<ExceptionRegion>(); // List of all rescued regions List<ExceptionRegion> allExceptionRegions = new ArrayList<ExceptionRegion>(); // Dummy entry basic block (see note at end to see why) entryBB = createBB(nestedExceptionRegions); // First real bb BasicBlock firstBB = createBB(nestedExceptionRegions); // Build the rest! BasicBlock currBB = firstBB; BasicBlock newBB; boolean bbEnded = false; boolean nextBBIsFallThrough = true; for (Instruction i : instructions) { if (i instanceof LabelInstr) { Label l = ((LabelInstr) i).getLabel(); newBB = createBB(l, nestedExceptionRegions); // depends on control dependency: [if], data = [none] // Jump instruction bbs dont add an edge to the succeeding bb by default if (nextBBIsFallThrough) graph.addEdge(currBB, newBB, EdgeType.FALL_THROUGH); currBB = newBB; // depends on control dependency: [if], data = [none] bbEnded = false; // depends on control dependency: [if], data = [none] nextBBIsFallThrough = true; // depends on control dependency: [if], data = [none] // Add forward reference edges List<BasicBlock> frefs = forwardRefs.get(l); if (frefs != null) { for (BasicBlock b : frefs) { graph.addEdge(b, newBB, EdgeType.REGULAR); // depends on control dependency: [for], data = [b] } } } else if (bbEnded && !(i instanceof ExceptionRegionEndMarker)) { newBB = createBB(nestedExceptionRegions); // depends on control dependency: [if], data = [none] // Jump instruction bbs dont add an edge to the succeeding bb by default if (nextBBIsFallThrough) graph.addEdge(currBB, newBB, EdgeType.FALL_THROUGH); // currBB cannot be null! currBB = newBB; // depends on control dependency: [if], data = [none] bbEnded = false; // depends on control dependency: [if], data = [none] nextBBIsFallThrough = true; // depends on control dependency: [if], data = [none] } if (i instanceof ExceptionRegionStartMarker) { // We dont need the instruction anymore -- so it is not added to the CFG. ExceptionRegionStartMarker ersmi = (ExceptionRegionStartMarker) i; ExceptionRegion rr = new ExceptionRegion(ersmi.getLabel(), currBB); rr.addBB(currBB); // depends on control dependency: [if], data = [none] allExceptionRegions.add(rr); // depends on control dependency: [if], data = [none] if (!nestedExceptionRegions.empty()) { nestedExceptionRegions.peek().addNestedRegion(rr); // depends on control dependency: [if], data = [none] } nestedExceptionRegions.push(rr); // depends on control dependency: [if], data = [none] } else if (i instanceof ExceptionRegionEndMarker) { // We dont need the instruction anymore -- so it is not added to the CFG. nestedExceptionRegions.pop().setEndBB(currBB); // depends on control dependency: [if], data = [none] } else if (i.transfersControl()) { bbEnded = true; // depends on control dependency: [if], data = [none] currBB.addInstr(i); // depends on control dependency: [if], data = [none] Label target; nextBBIsFallThrough = false; // depends on control dependency: [if], data = [none] if (i instanceof Branch) { target = ((Branch) i).getTarget(); // depends on control dependency: [if], data = [none] nextBBIsFallThrough = true; // depends on control dependency: [if], data = [none] } else if (i instanceof Jump) { target = ((Jump) i).getTarget(); // depends on control dependency: [if], data = [none] } else if (i instanceof Return) { target = null; // depends on control dependency: [if], data = [none] returnBBs.add(currBB); // depends on control dependency: [if], data = [none] } else if (i instanceof ThrowException) { target = null; // depends on control dependency: [if], data = [none] exceptionBBs.add(currBB); // depends on control dependency: [if], data = [none] } else { throw new RuntimeException("Unhandled case in CFG builder for basic block ending instr: " + i); } if (target != null) addEdge(currBB, target, forwardRefs); } else if (!(i instanceof LabelInstr)) { currBB.addInstr(i); // depends on control dependency: [if], data = [none] } } // Process all rescued regions for (ExceptionRegion rr : allExceptionRegions) { // When this exception region represents an unrescued region // from a copied ensure block, we have a dummy label Label rescueLabel = rr.getFirstRescueBlockLabel(); if (!Label.UNRESCUED_REGION_LABEL.equals(rescueLabel)) { BasicBlock firstRescueBB = bbMap.get(rescueLabel); // Mark the BB as a rescue entry BB firstRescueBB.markRescueEntryBB(); // depends on control dependency: [if], data = [none] // Record a mapping from the region's exclusive basic blocks to the first bb that will start exception handling for all their exceptions. // Add an exception edge from every exclusive bb of the region to firstRescueBB for (BasicBlock b : rr.getExclusiveBBs()) { setRescuerBB(b, firstRescueBB); // depends on control dependency: [for], data = [b] graph.addEdge(b, firstRescueBB, EdgeType.EXCEPTION); // depends on control dependency: [for], data = [b] } } } buildExitBasicBlock(nestedExceptionRegions, firstBB, returnBBs, exceptionBBs, nextBBIsFallThrough, currBB, entryBB); optimize(); return graph; } }
public class class_name { ServerSessionContext unregisterSession(long sessionId) { ServerSessionContext session = sessions.remove(sessionId); if (session != null) { clients.remove(session.client(), session); connections.remove(session.client(), session.getConnection()); } return session; } }
public class class_name { ServerSessionContext unregisterSession(long sessionId) { ServerSessionContext session = sessions.remove(sessionId); if (session != null) { clients.remove(session.client(), session); // depends on control dependency: [if], data = [(session] connections.remove(session.client(), session.getConnection()); // depends on control dependency: [if], data = [(session] } return session; } }
public class class_name { public void removeFile(VariantFileMetadata file, String studyId) { // Sanity check if (file == null) { logger.error("Variant file metadata is null."); return; } removeFile(file.getId(), studyId); } }
public class class_name { public void removeFile(VariantFileMetadata file, String studyId) { // Sanity check if (file == null) { logger.error("Variant file metadata is null."); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } removeFile(file.getId(), studyId); } }
public class class_name { public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMetricDefintionsNextWithServiceResponseAsync(final String nextPageLink) { return listMetricDefintionsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricDefintionsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMetricDefintionsNextWithServiceResponseAsync(final String nextPageLink) { return listMetricDefintionsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listMetricDefintionsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { private void beginInternalLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters) { Map<String, String> spanAttributes = new LinkedHashMap<String, String>(); Map<String, String> anchorAttributes = new LinkedHashMap<String, String>(); // Add all parameters to the A attributes anchorAttributes.putAll(parameters); if (StringUtils.isEmpty(reference.getReference())) { spanAttributes.put(CLASS, WIKILINK); renderAutoLink(reference, spanAttributes, anchorAttributes); } else if (this.wikiModel.isDocumentAvailable(reference)) { spanAttributes.put(CLASS, WIKILINK); anchorAttributes.put(XHTMLLinkRenderer.HREF, this.wikiModel.getDocumentViewURL(reference)); } else { // The wiki document doesn't exist spanAttributes.put(CLASS, "wikicreatelink"); anchorAttributes.put(XHTMLLinkRenderer.HREF, this.wikiModel.getDocumentEditURL(reference)); } getXHTMLWikiPrinter().printXMLStartElement(SPAN, spanAttributes); getXHTMLWikiPrinter().printXMLStartElement(XHTMLLinkRenderer.ANCHOR, anchorAttributes); } }
public class class_name { private void beginInternalLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters) { Map<String, String> spanAttributes = new LinkedHashMap<String, String>(); Map<String, String> anchorAttributes = new LinkedHashMap<String, String>(); // Add all parameters to the A attributes anchorAttributes.putAll(parameters); if (StringUtils.isEmpty(reference.getReference())) { spanAttributes.put(CLASS, WIKILINK); // depends on control dependency: [if], data = [none] renderAutoLink(reference, spanAttributes, anchorAttributes); // depends on control dependency: [if], data = [none] } else if (this.wikiModel.isDocumentAvailable(reference)) { spanAttributes.put(CLASS, WIKILINK); // depends on control dependency: [if], data = [none] anchorAttributes.put(XHTMLLinkRenderer.HREF, this.wikiModel.getDocumentViewURL(reference)); // depends on control dependency: [if], data = [none] } else { // The wiki document doesn't exist spanAttributes.put(CLASS, "wikicreatelink"); // depends on control dependency: [if], data = [none] anchorAttributes.put(XHTMLLinkRenderer.HREF, this.wikiModel.getDocumentEditURL(reference)); // depends on control dependency: [if], data = [none] } getXHTMLWikiPrinter().printXMLStartElement(SPAN, spanAttributes); getXHTMLWikiPrinter().printXMLStartElement(XHTMLLinkRenderer.ANCHOR, anchorAttributes); } }
public class class_name { @Override public int compareTo(MP4Frame that) { int ret = 0; if (this.time > that.getTime()) { ret = 1; } else if (this.time < that.getTime()) { ret = -1; } else if (Double.doubleToLongBits(time) == Double.doubleToLongBits(that.getTime()) && this.offset > that.getOffset()) { ret = 1; } else if (Double.doubleToLongBits(time) == Double.doubleToLongBits(that.getTime()) && this.offset < that.getOffset()) { ret = -1; } return ret; } }
public class class_name { @Override public int compareTo(MP4Frame that) { int ret = 0; if (this.time > that.getTime()) { ret = 1; // depends on control dependency: [if], data = [none] } else if (this.time < that.getTime()) { ret = -1; // depends on control dependency: [if], data = [none] } else if (Double.doubleToLongBits(time) == Double.doubleToLongBits(that.getTime()) && this.offset > that.getOffset()) { ret = 1; // depends on control dependency: [if], data = [none] } else if (Double.doubleToLongBits(time) == Double.doubleToLongBits(that.getTime()) && this.offset < that.getOffset()) { ret = -1; // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { private JSType findObjectWithNonStringifiableKey(JSType type, Set<JSType> alreadyCheckedTypes) { if (alreadyCheckedTypes.contains(type)) { // This can happen in recursive types. Current type already being checked earlier in // stacktrace so now we just skip it. return null; } else { alreadyCheckedTypes.add(type); } if (isObjectTypeWithNonStringifiableKey(type)) { return type; } if (type.isUnionType()) { for (JSType alternateType : type.toMaybeUnionType().getAlternates()) { JSType result = findObjectWithNonStringifiableKey(alternateType, alreadyCheckedTypes); if (result != null) { return result; } } } if (type.isTemplatizedType()) { for (JSType templateType : type.toMaybeTemplatizedType().getTemplateTypes()) { JSType result = findObjectWithNonStringifiableKey(templateType, alreadyCheckedTypes); if (result != null) { return result; } } } if (type.isOrdinaryFunction()) { FunctionType function = type.toMaybeFunctionType(); for (Node parameter : function.getParameters()) { JSType result = findObjectWithNonStringifiableKey(parameter.getJSType(), alreadyCheckedTypes); if (result != null) { return result; } } return findObjectWithNonStringifiableKey(function.getReturnType(), alreadyCheckedTypes); } return null; } }
public class class_name { private JSType findObjectWithNonStringifiableKey(JSType type, Set<JSType> alreadyCheckedTypes) { if (alreadyCheckedTypes.contains(type)) { // This can happen in recursive types. Current type already being checked earlier in // stacktrace so now we just skip it. return null; // depends on control dependency: [if], data = [none] } else { alreadyCheckedTypes.add(type); // depends on control dependency: [if], data = [none] } if (isObjectTypeWithNonStringifiableKey(type)) { return type; // depends on control dependency: [if], data = [none] } if (type.isUnionType()) { for (JSType alternateType : type.toMaybeUnionType().getAlternates()) { JSType result = findObjectWithNonStringifiableKey(alternateType, alreadyCheckedTypes); if (result != null) { return result; // depends on control dependency: [if], data = [none] } } } if (type.isTemplatizedType()) { for (JSType templateType : type.toMaybeTemplatizedType().getTemplateTypes()) { JSType result = findObjectWithNonStringifiableKey(templateType, alreadyCheckedTypes); if (result != null) { return result; // depends on control dependency: [if], data = [none] } } } if (type.isOrdinaryFunction()) { FunctionType function = type.toMaybeFunctionType(); for (Node parameter : function.getParameters()) { JSType result = findObjectWithNonStringifiableKey(parameter.getJSType(), alreadyCheckedTypes); if (result != null) { return result; // depends on control dependency: [if], data = [none] } } return findObjectWithNonStringifiableKey(function.getReturnType(), alreadyCheckedTypes); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void evictExpiredElements() { long evictedTotal = 0; final long startTime; final String[] cacheNames; if (!evictLock.tryLock()) { // Lock is already held, skip eviction return; } try { startTime = System.nanoTime(); cacheNames = this.cacheManager.getCacheNames(); for (String cacheName : cacheNames) { final Ehcache cache = this.cacheManager.getEhcache(cacheName); if (null != cache) { final long preEvictSize = cache.getMemoryStoreSize(); final long evictStart = System.nanoTime(); cache.evictExpiredElements(); if (logger.isDebugEnabled()) { final long evicted = preEvictSize - cache.getMemoryStoreSize(); evictedTotal += evicted; logger.debug( "Evicted " + evicted + " elements from cache '" + cacheName + "' in " + TimeUnit.NANOSECONDS.toMillis( System.nanoTime() - evictStart) + " ms"); } } else if (logger.isDebugEnabled()) { logger.debug("No cache found with name " + cacheName); } } } finally { this.evictLock.unlock(); } if (logger.isDebugEnabled()) { logger.debug( "Evicted " + evictedTotal + " elements from " + cacheNames.length + " caches in " + this.cacheManager.getName() + " in " + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime) + " ms"); } } }
public class class_name { public void evictExpiredElements() { long evictedTotal = 0; final long startTime; final String[] cacheNames; if (!evictLock.tryLock()) { // Lock is already held, skip eviction return; // depends on control dependency: [if], data = [none] } try { startTime = System.nanoTime(); // depends on control dependency: [try], data = [none] cacheNames = this.cacheManager.getCacheNames(); // depends on control dependency: [try], data = [none] for (String cacheName : cacheNames) { final Ehcache cache = this.cacheManager.getEhcache(cacheName); if (null != cache) { final long preEvictSize = cache.getMemoryStoreSize(); final long evictStart = System.nanoTime(); cache.evictExpiredElements(); // depends on control dependency: [if], data = [none] if (logger.isDebugEnabled()) { final long evicted = preEvictSize - cache.getMemoryStoreSize(); evictedTotal += evicted; // depends on control dependency: [if], data = [none] logger.debug( "Evicted " + evicted + " elements from cache '" + cacheName + "' in " + TimeUnit.NANOSECONDS.toMillis( System.nanoTime() - evictStart) + " ms"); // depends on control dependency: [if], data = [none] } } else if (logger.isDebugEnabled()) { logger.debug("No cache found with name " + cacheName); // depends on control dependency: [if], data = [none] } } } finally { this.evictLock.unlock(); } if (logger.isDebugEnabled()) { logger.debug( "Evicted " + evictedTotal + " elements from " + cacheNames.length + " caches in " + this.cacheManager.getName() + " in " + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime) + " ms"); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void initData(byte[] fileData) { traceData = fileData; if (isABI()) { setIndex(); setBasecalls(); setQcalls(); setSeq(); setTraces(); } else throw new IllegalArgumentException("Not a valid ABI file."); } }
public class class_name { private void initData(byte[] fileData) { traceData = fileData; if (isABI()) { setIndex(); // depends on control dependency: [if], data = [none] setBasecalls(); // depends on control dependency: [if], data = [none] setQcalls(); // depends on control dependency: [if], data = [none] setSeq(); // depends on control dependency: [if], data = [none] setTraces(); // depends on control dependency: [if], data = [none] } else throw new IllegalArgumentException("Not a valid ABI file."); } }
public class class_name { public Map<String, String> variables(String uri) { Map<String, String> variables = new HashMap<String, String>(); Matcher matcher = pattern.matcher(uri); if (matcher.matches()) { for (int i = 0; i < matcher.groupCount(); i++) { variables.put(this.variables.get(i), matcher.group(i + 1)); } } return variables; } }
public class class_name { public Map<String, String> variables(String uri) { Map<String, String> variables = new HashMap<String, String>(); Matcher matcher = pattern.matcher(uri); if (matcher.matches()) { for (int i = 0; i < matcher.groupCount(); i++) { variables.put(this.variables.get(i), matcher.group(i + 1)); // depends on control dependency: [for], data = [i] } } return variables; } }
public class class_name { @SuppressWarnings({ "rawtypes", "unchecked" }) @Deprecated public static Hashtable getContext() { Map map = org.slf4j.MDC.getCopyOfContextMap(); if (map != null) { return new Hashtable(map); } else { return new Hashtable(); } } }
public class class_name { @SuppressWarnings({ "rawtypes", "unchecked" }) @Deprecated public static Hashtable getContext() { Map map = org.slf4j.MDC.getCopyOfContextMap(); if (map != null) { return new Hashtable(map); // depends on control dependency: [if], data = [(map] } else { return new Hashtable(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private List<? extends Node> list(Node<?> node, List<Object[]> includes) throws IOException { Node child; if (includes.size() == 1 && includes.get(0)[0] instanceof String) { child = node.join((String) includes.get(0)[0]); if (child.exists()) { return Collections.singletonList(child); } else { return Collections.emptyList(); } } else { return node.list(); } } }
public class class_name { private List<? extends Node> list(Node<?> node, List<Object[]> includes) throws IOException { Node child; if (includes.size() == 1 && includes.get(0)[0] instanceof String) { child = node.join((String) includes.get(0)[0]); if (child.exists()) { return Collections.singletonList(child); // depends on control dependency: [if], data = [none] } else { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } } else { return node.list(); } } }
public class class_name { @SuppressWarnings("checkstyle:magicnumber") public static String toMD5String(String str) { try { MessageDigest md = MessageDigest.getInstance("MD5"); if (md == null || str == null) { return null; } byte[] byteData = md.digest(str.getBytes(Charset.forName("UTF-8"))); StringBuilder sb = new StringBuilder(); for (byte aByteData : byteData) { sb.append(Integer.toString((aByteData & 0xff) + 0x100, 16).substring(1)); } return sb.toString(); } catch (NoSuchAlgorithmException ignored) { return null; } } }
public class class_name { @SuppressWarnings("checkstyle:magicnumber") public static String toMD5String(String str) { try { MessageDigest md = MessageDigest.getInstance("MD5"); if (md == null || str == null) { return null; // depends on control dependency: [if], data = [none] } byte[] byteData = md.digest(str.getBytes(Charset.forName("UTF-8"))); StringBuilder sb = new StringBuilder(); for (byte aByteData : byteData) { sb.append(Integer.toString((aByteData & 0xff) + 0x100, 16).substring(1)); // depends on control dependency: [for], data = [aByteData] } return sb.toString(); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException ignored) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { final protected void closeAndRemoveResultSets(boolean closeWrapperOnly) { // Close and remove all the result sets in the childWrappers // - remove childWrappers.isEmpty() check since the precondition of this method // is that childWrappers have at least one element. for (int i = childWrappers.size() - 1; i > -1; i--) { try { ((WSJdbcObject) childWrappers.get(i)).close(closeWrapperOnly); } catch (SQLException ex) { // Just trace the error since we need to continue FFDCFilter.processException( ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.closeAndRemoveResultSets", "277", this); Tr.warning(tc, "ERR_CLOSING_OBJECT", ex); } } } }
public class class_name { final protected void closeAndRemoveResultSets(boolean closeWrapperOnly) { // Close and remove all the result sets in the childWrappers // - remove childWrappers.isEmpty() check since the precondition of this method // is that childWrappers have at least one element. for (int i = childWrappers.size() - 1; i > -1; i--) { try { ((WSJdbcObject) childWrappers.get(i)).close(closeWrapperOnly); // depends on control dependency: [try], data = [none] } catch (SQLException ex) { // Just trace the error since we need to continue FFDCFilter.processException( ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.closeAndRemoveResultSets", "277", this); Tr.warning(tc, "ERR_CLOSING_OBJECT", ex); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static String toHexString(long hash) { String hex = Long.toHexString(hash); if (hex.length() == 16) { return hex; } StringBuilder sb = new StringBuilder(); for (int i = 0, j = 16 - hex.length(); i < j; i++) { sb.append('0'); } return sb.append(hex).toString(); } }
public class class_name { public static String toHexString(long hash) { String hex = Long.toHexString(hash); if (hex.length() == 16) { return hex; // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(); for (int i = 0, j = 16 - hex.length(); i < j; i++) { sb.append('0'); // depends on control dependency: [for], data = [none] } return sb.append(hex).toString(); } }
public class class_name { protected AuthToken createAuthToken(WaybackRequest wbRequest, String urlkey) { AuthToken waybackAuthToken = new APContextAuthToken( wbRequest.getAccessPoint()); waybackAuthToken.setAllCdxFieldsAllow(); boolean ignoreRobots = wbRequest.isCSSContext() || wbRequest.isIMGContext() || wbRequest.isJSContext(); if (ignoreRobots) { waybackAuthToken.setIgnoreRobots(true); } if (ignoreRobotPaths != null) { for (String path : ignoreRobotPaths) { if (urlkey.startsWith(path)) { waybackAuthToken.setIgnoreRobots(true); break; } } } return waybackAuthToken; } }
public class class_name { protected AuthToken createAuthToken(WaybackRequest wbRequest, String urlkey) { AuthToken waybackAuthToken = new APContextAuthToken( wbRequest.getAccessPoint()); waybackAuthToken.setAllCdxFieldsAllow(); boolean ignoreRobots = wbRequest.isCSSContext() || wbRequest.isIMGContext() || wbRequest.isJSContext(); if (ignoreRobots) { waybackAuthToken.setIgnoreRobots(true); // depends on control dependency: [if], data = [none] } if (ignoreRobotPaths != null) { for (String path : ignoreRobotPaths) { if (urlkey.startsWith(path)) { waybackAuthToken.setIgnoreRobots(true); // depends on control dependency: [if], data = [none] break; } } } return waybackAuthToken; } }
public class class_name { @SuppressWarnings("unchecked") public List<Instance> getInstances() throws EFapsException { final List<Instance> ret = new ArrayList<>(); // no value select means, that the from select must be asked if (this.valueSelect == null) { ret.addAll(this.fromSelect.getMainOneSelect().getInstances()); } else { // if an oid select was given the oid is evaluated if ("oid".equals(this.valueSelect.getValueType())) { for (final Object object : this.objectList) { final Instance inst = Instance.get((String) this.valueSelect.getValue(object)); if (inst.isValid()) { ret.add(inst); } } } else { final List<Long> idTmp; if (this.valueSelect.getParentSelectPart() != null && this.valueSelect.getParentSelectPart() instanceof LinkToSelectPart) { idTmp = (List<Long>) this.valueSelect.getParentSelectPart().getObject(); } else { idTmp = this.idList; } for (final Long id : idTmp) { if (id != null) { ret.add(Instance.get(this.valueSelect.getAttribute().getParent(), String.valueOf(id))); } } } } return ret; } }
public class class_name { @SuppressWarnings("unchecked") public List<Instance> getInstances() throws EFapsException { final List<Instance> ret = new ArrayList<>(); // no value select means, that the from select must be asked if (this.valueSelect == null) { ret.addAll(this.fromSelect.getMainOneSelect().getInstances()); } else { // if an oid select was given the oid is evaluated if ("oid".equals(this.valueSelect.getValueType())) { for (final Object object : this.objectList) { final Instance inst = Instance.get((String) this.valueSelect.getValue(object)); if (inst.isValid()) { ret.add(inst); // depends on control dependency: [if], data = [none] } } } else { final List<Long> idTmp; if (this.valueSelect.getParentSelectPart() != null && this.valueSelect.getParentSelectPart() instanceof LinkToSelectPart) { idTmp = (List<Long>) this.valueSelect.getParentSelectPart().getObject(); // depends on control dependency: [if], data = [none] } else { idTmp = this.idList; // depends on control dependency: [if], data = [none] } for (final Long id : idTmp) { if (id != null) { ret.add(Instance.get(this.valueSelect.getAttribute().getParent(), String.valueOf(id))); // depends on control dependency: [if], data = [(id] } } } } return ret; } }
public class class_name { public ServerSocket newServerSocket(int port) { try { ServerSocket serverSocket = newServerSocket(); serverSocket.setReuseAddress(DEFAULT_REUSE_ADDRESS); serverSocket.bind(newSocketAddress(port)); return serverSocket; } catch (IOException cause) { throw newRuntimeException(cause, "Failed to create a ServerSocket on port [%d]", port); } } }
public class class_name { public ServerSocket newServerSocket(int port) { try { ServerSocket serverSocket = newServerSocket(); serverSocket.setReuseAddress(DEFAULT_REUSE_ADDRESS); // depends on control dependency: [try], data = [none] serverSocket.bind(newSocketAddress(port)); // depends on control dependency: [try], data = [none] return serverSocket; // depends on control dependency: [try], data = [none] } catch (IOException cause) { throw newRuntimeException(cause, "Failed to create a ServerSocket on port [%d]", port); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void cleanStaleFiles(File backupDir, AsyncOperationStatus status) { String[] filesInEnv = env.getHome().list(); String[] filesInBackupDir = backupDir.list(); if(filesInEnv != null && filesInBackupDir != null) { HashSet<String> envFileSet = new HashSet<String>(); for(String file: filesInEnv) envFileSet.add(file); // delete all files in backup which are currently not in environment for(String file: filesInBackupDir) { if(file.endsWith(BDB_EXT) && !envFileSet.contains(file)) { status.setStatus("Deleting stale jdb file :" + file); File staleJdbFile = new File(backupDir, file); staleJdbFile.delete(); } } } } }
public class class_name { private void cleanStaleFiles(File backupDir, AsyncOperationStatus status) { String[] filesInEnv = env.getHome().list(); String[] filesInBackupDir = backupDir.list(); if(filesInEnv != null && filesInBackupDir != null) { HashSet<String> envFileSet = new HashSet<String>(); for(String file: filesInEnv) envFileSet.add(file); // delete all files in backup which are currently not in environment for(String file: filesInBackupDir) { if(file.endsWith(BDB_EXT) && !envFileSet.contains(file)) { status.setStatus("Deleting stale jdb file :" + file); // depends on control dependency: [if], data = [none] File staleJdbFile = new File(backupDir, file); staleJdbFile.delete(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void insertIntoMongoDBCollection(String collection, DataTable table) { // Primero pasamos la fila del datatable a un hashmap de ColumnName-Type List<String[]> colRel = coltoArrayList(table); // Vamos insertando fila a fila for (int i = 1; i < table.raw().size(); i++) { // Obtenemos la fila correspondiente BasicDBObject doc = new BasicDBObject(); List<String> row = table.raw().get(i); for (int x = 0; x < row.size(); x++) { String[] colNameType = colRel.get(x); Object data = castSTringTo(colNameType[1], row.get(x)); doc.put(colNameType[0], data); } this.dataBase.getCollection(collection).insert(doc); } } }
public class class_name { public void insertIntoMongoDBCollection(String collection, DataTable table) { // Primero pasamos la fila del datatable a un hashmap de ColumnName-Type List<String[]> colRel = coltoArrayList(table); // Vamos insertando fila a fila for (int i = 1; i < table.raw().size(); i++) { // Obtenemos la fila correspondiente BasicDBObject doc = new BasicDBObject(); List<String> row = table.raw().get(i); for (int x = 0; x < row.size(); x++) { String[] colNameType = colRel.get(x); Object data = castSTringTo(colNameType[1], row.get(x)); doc.put(colNameType[0], data); // depends on control dependency: [for], data = [none] } this.dataBase.getCollection(collection).insert(doc); // depends on control dependency: [for], data = [none] } } }
public class class_name { public static XMLInputFactory createSafeXmlInputFactory() { XMLInputFactory xif = XMLInputFactory.newInstance(); if (xif.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) { xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false); } if (xif.isPropertySupported(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) { xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); } if (xif.isPropertySupported(XMLInputFactory.SUPPORT_DTD)) { xif.setProperty(XMLInputFactory.SUPPORT_DTD, false); } return xif; } }
public class class_name { public static XMLInputFactory createSafeXmlInputFactory() { XMLInputFactory xif = XMLInputFactory.newInstance(); if (xif.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) { xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false); // depends on control dependency: [if], data = [none] } if (xif.isPropertySupported(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) { xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); // depends on control dependency: [if], data = [none] } if (xif.isPropertySupported(XMLInputFactory.SUPPORT_DTD)) { xif.setProperty(XMLInputFactory.SUPPORT_DTD, false); // depends on control dependency: [if], data = [none] } return xif; } }