code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
protected boolean isLocallyAssigned(EObject target, EObject containerToFindUsage) {
if (this.readAndWriteTracking.isAssigned(target)) {
return true;
}
final Collection<Setting> usages = XbaseUsageCrossReferencer.find(target, containerToFindUsage);
// field are assigned when they are not used as the left operand of an assignment operator.
for (final Setting usage : usages) {
final EObject object = usage.getEObject();
if (object instanceof XAssignment) {
final XAssignment assignment = (XAssignment) object;
if (assignment.getFeature() == target) {
// Mark the field as assigned in order to be faster during the next assignment test.
this.readAndWriteTracking.markAssignmentAccess(target);
return true;
}
}
}
return false;
} } | public class class_name {
protected boolean isLocallyAssigned(EObject target, EObject containerToFindUsage) {
if (this.readAndWriteTracking.isAssigned(target)) {
return true; // depends on control dependency: [if], data = [none]
}
final Collection<Setting> usages = XbaseUsageCrossReferencer.find(target, containerToFindUsage);
// field are assigned when they are not used as the left operand of an assignment operator.
for (final Setting usage : usages) {
final EObject object = usage.getEObject();
if (object instanceof XAssignment) {
final XAssignment assignment = (XAssignment) object;
if (assignment.getFeature() == target) {
// Mark the field as assigned in order to be faster during the next assignment test.
this.readAndWriteTracking.markAssignmentAccess(target); // depends on control dependency: [if], data = [target)]
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
protected List<Authorization> executePaginatedQuery(AuthorizationQuery query, Integer firstResult, Integer maxResults) {
if (firstResult == null) {
firstResult = 0;
}
if (maxResults == null) {
maxResults = Integer.MAX_VALUE;
}
return query.listPage(firstResult, maxResults);
} } | public class class_name {
protected List<Authorization> executePaginatedQuery(AuthorizationQuery query, Integer firstResult, Integer maxResults) {
if (firstResult == null) {
firstResult = 0; // depends on control dependency: [if], data = [none]
}
if (maxResults == null) {
maxResults = Integer.MAX_VALUE; // depends on control dependency: [if], data = [none]
}
return query.listPage(firstResult, maxResults);
} } |
public class class_name {
static public String getFormattedDays(long dt)
{
StringBuffer ret = new StringBuffer();
long days = dt/86400000L;
long millis = dt-(days*86400000L);
if(days > 0)
{
ret.append(Long.toString(days));
ret.append(" days ");
}
ret.append(getFormattedTime(millis, false));
return ret.toString();
} } | public class class_name {
static public String getFormattedDays(long dt)
{
StringBuffer ret = new StringBuffer();
long days = dt/86400000L;
long millis = dt-(days*86400000L);
if(days > 0)
{
ret.append(Long.toString(days)); // depends on control dependency: [if], data = [(days]
ret.append(" days "); // depends on control dependency: [if], data = [none]
}
ret.append(getFormattedTime(millis, false));
return ret.toString();
} } |
public class class_name {
public int getSessionID()
{
Integer intSession = (Integer)m_hmSessions.get(this);
if (intSession == null)
{
synchronized (m_hmSessions)
{
m_hmSessions.put(this, intSession = new Integer(m_iNextSession++));
}
}
return intSession.intValue();
} } | public class class_name {
public int getSessionID()
{
Integer intSession = (Integer)m_hmSessions.get(this);
if (intSession == null)
{
synchronized (m_hmSessions) // depends on control dependency: [if], data = [none]
{
m_hmSessions.put(this, intSession = new Integer(m_iNextSession++));
}
}
return intSession.intValue();
} } |
public class class_name {
private String ipAddressFromNI(String niSpec, String name) {
String result = "UNKNOWN";
NetworkInterface ni = null;
String[] parts = niSpec.split(":");
String niName = "eth0"; // default NIC name
Scheme scheme = Scheme.ipv4;
int index = 0; // default index
Scope scope = Scope.global; // can be global, linklocal or sitelocal - is
// global by default
// Parse up the spec
for (int idx = 0; idx < parts.length; idx++) {
switch (idx) {
case 0:
niName = parts[idx];
break;
case 1:
String _schemeStr = parts[idx].toLowerCase();
try {
scheme = Scheme.valueOf(_schemeStr);
} catch (Exception e) {
warn("Error parsing scheme for resolveIP named [" + name + "]. Expecting ipv4 or ipv6 but got [" + _schemeStr + "]. Using default of ipv4.");
scheme = Scheme.ipv4; // default
}
break;
case 2:
String scopeTarget = parts[idx].toLowerCase();
try {
scope = Scope.valueOf(scopeTarget);
} catch (Exception e) {
warn("Error parsing scope for resolveIP named [" + name + "]. Expecting global, sitelocal or linklocal but got [" + scopeTarget + "]. Using default of global.");
scope = Scope.global; // default
}
break;
case 3:
try {
index = Integer.parseInt(parts[idx]);
} catch (NumberFormatException e) {
index = 0; // default
}
break;
default:
break;
}
}
// Find the specified NIC
try {
// if the niName is localhost, get the IP address associated with
// localhost
if (niName.equalsIgnoreCase("localhost")) {
if (scope != Scope.sitelocal) {
warn("resolveIP named [" + name + "] has ni of localhost and will default to scope of sitelocal (or it won't work). Expects sitelocal but got [" + scope + "].");
scope = Scope.sitelocal; // force scope to site local
}
try {
InetAddress addr = InetAddress.getLocalHost();
ni = NetworkInterface.getByInetAddress(addr);
} catch (UnknownHostException e) {
// This should not happen
warn("The lookup of the NI for localhost for resolveIP named [" + name + "] caused an exception. Look for odd entries in /etc/hosts.");
return "UNKNOWN NI";
}
} else {
ni = NetworkInterface.getByName(niName);
}
} catch (SocketException e) {
error("An error occured looking up the interface named [" + niName + "] for resolveIP named [" + name + "]", e);
return "UNKNOWN NI";
}
// if we have a network interface, then get the right ip
List<InetAddress> ipv4Addrs = new ArrayList<InetAddress>();
List<InetAddress> ipv6Addrs = new ArrayList<InetAddress>();
if (ni != null) {
// group the two types of addresses
Enumeration<InetAddress> addrList = ni.getInetAddresses();
do {
InetAddress addr = addrList.nextElement();
// filter out only the type specified (linklocal, sitelocal or global)
switch (scope) {
case linklocal:
if (addr.isLinkLocalAddress()) {
if (addr instanceof Inet4Address)
ipv4Addrs.add((Inet4Address) addr);
if (addr instanceof Inet6Address)
ipv6Addrs.add((Inet6Address) addr);
}
break;
case sitelocal:
if (addr.isSiteLocalAddress()) {
if (addr instanceof Inet4Address)
ipv4Addrs.add((Inet4Address) addr);
if (addr instanceof Inet6Address)
ipv6Addrs.add((Inet6Address) addr);
}
break;
case global:
if (!addr.isSiteLocalAddress() && !addr.isLinkLocalAddress()) {
if (addr instanceof Inet4Address)
ipv4Addrs.add((Inet4Address) addr);
if (addr instanceof Inet6Address)
ipv6Addrs.add((Inet6Address) addr);
}
break;
default:
break;
}
} while (addrList.hasMoreElements());
}
List<InetAddress> targetAddrs = null;
switch (scheme) {
case ipv4:
targetAddrs = ipv4Addrs;
break;
case ipv6:
targetAddrs = ipv6Addrs;
break;
default:
break;
}
// Get a candidate addr from the list
InetAddress candidateAddr = null;
if (!targetAddrs.isEmpty()) {
if (index < targetAddrs.size()) {
candidateAddr = targetAddrs.get(index);
result = candidateAddr.getHostAddress();
} else {
error("Error getting index [" + index + "] addrees for resolveIP named [" + name + "]. Index is out of bounds.");
return "INDEX OUT OF BOUNDS";
}
} else {
error("Empty list of addresses for resolveIP named [" + name + "]");
return "EMPTY LIST";
}
return result;
} } | public class class_name {
private String ipAddressFromNI(String niSpec, String name) {
String result = "UNKNOWN";
NetworkInterface ni = null;
String[] parts = niSpec.split(":");
String niName = "eth0"; // default NIC name
Scheme scheme = Scheme.ipv4;
int index = 0; // default index
Scope scope = Scope.global; // can be global, linklocal or sitelocal - is
// global by default
// Parse up the spec
for (int idx = 0; idx < parts.length; idx++) {
switch (idx) {
case 0:
niName = parts[idx];
break;
case 1:
String _schemeStr = parts[idx].toLowerCase();
try {
scheme = Scheme.valueOf(_schemeStr); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
warn("Error parsing scheme for resolveIP named [" + name + "]. Expecting ipv4 or ipv6 but got [" + _schemeStr + "]. Using default of ipv4.");
scheme = Scheme.ipv4; // default
} // depends on control dependency: [catch], data = [none]
break;
case 2:
String scopeTarget = parts[idx].toLowerCase();
try {
scope = Scope.valueOf(scopeTarget); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
warn("Error parsing scope for resolveIP named [" + name + "]. Expecting global, sitelocal or linklocal but got [" + scopeTarget + "]. Using default of global.");
scope = Scope.global; // default
} // depends on control dependency: [catch], data = [none]
break;
case 3:
try {
index = Integer.parseInt(parts[idx]); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
index = 0; // default
} // depends on control dependency: [catch], data = [none]
break;
default:
break;
}
}
// Find the specified NIC
try {
// if the niName is localhost, get the IP address associated with
// localhost
if (niName.equalsIgnoreCase("localhost")) {
if (scope != Scope.sitelocal) {
warn("resolveIP named [" + name + "] has ni of localhost and will default to scope of sitelocal (or it won't work). Expects sitelocal but got [" + scope + "]."); // depends on control dependency: [if], data = [none]
scope = Scope.sitelocal; // force scope to site local // depends on control dependency: [if], data = [none]
}
try {
InetAddress addr = InetAddress.getLocalHost();
ni = NetworkInterface.getByInetAddress(addr); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
// This should not happen
warn("The lookup of the NI for localhost for resolveIP named [" + name + "] caused an exception. Look for odd entries in /etc/hosts.");
return "UNKNOWN NI";
} // depends on control dependency: [catch], data = [none]
} else {
ni = NetworkInterface.getByName(niName); // depends on control dependency: [if], data = [none]
}
} catch (SocketException e) {
error("An error occured looking up the interface named [" + niName + "] for resolveIP named [" + name + "]", e);
return "UNKNOWN NI";
} // depends on control dependency: [catch], data = [none]
// if we have a network interface, then get the right ip
List<InetAddress> ipv4Addrs = new ArrayList<InetAddress>();
List<InetAddress> ipv6Addrs = new ArrayList<InetAddress>();
if (ni != null) {
// group the two types of addresses
Enumeration<InetAddress> addrList = ni.getInetAddresses();
do {
InetAddress addr = addrList.nextElement();
// filter out only the type specified (linklocal, sitelocal or global)
switch (scope) {
case linklocal:
if (addr.isLinkLocalAddress()) {
if (addr instanceof Inet4Address)
ipv4Addrs.add((Inet4Address) addr);
if (addr instanceof Inet6Address)
ipv6Addrs.add((Inet6Address) addr);
}
break;
case sitelocal:
if (addr.isSiteLocalAddress()) {
if (addr instanceof Inet4Address)
ipv4Addrs.add((Inet4Address) addr);
if (addr instanceof Inet6Address)
ipv6Addrs.add((Inet6Address) addr);
}
break;
case global:
if (!addr.isSiteLocalAddress() && !addr.isLinkLocalAddress()) {
if (addr instanceof Inet4Address)
ipv4Addrs.add((Inet4Address) addr);
if (addr instanceof Inet6Address)
ipv6Addrs.add((Inet6Address) addr);
}
break;
default:
break;
}
} while (addrList.hasMoreElements());
}
List<InetAddress> targetAddrs = null;
switch (scheme) {
case ipv4:
targetAddrs = ipv4Addrs;
break;
case ipv6:
targetAddrs = ipv6Addrs;
break;
default:
break;
}
// Get a candidate addr from the list
InetAddress candidateAddr = null;
if (!targetAddrs.isEmpty()) {
if (index < targetAddrs.size()) {
candidateAddr = targetAddrs.get(index); // depends on control dependency: [if], data = [(index]
result = candidateAddr.getHostAddress(); // depends on control dependency: [if], data = [none]
} else {
error("Error getting index [" + index + "] addrees for resolveIP named [" + name + "]. Index is out of bounds."); // depends on control dependency: [if], data = [none]
return "INDEX OUT OF BOUNDS"; // depends on control dependency: [if], data = [none]
}
} else {
error("Empty list of addresses for resolveIP named [" + name + "]"); // depends on control dependency: [if], data = [none]
return "EMPTY LIST"; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public void stop() {
if (thread != null) {
thread.interrupt();
}
try {
thread.join();
} catch (@javax.annotation.Nonnull final InterruptedException e) {
Thread.currentThread().interrupt();
}
} } | public class class_name {
public void stop() {
if (thread != null) {
thread.interrupt(); // depends on control dependency: [if], data = [none]
}
try {
thread.join(); // depends on control dependency: [try], data = [none]
} catch (@javax.annotation.Nonnull final InterruptedException e) {
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setShowTitle(boolean showTitle) {
if (showTitle) {
this.attributes.put(SHOW_TITLE, true);
this.attributes.remove(NOTITLE);
} else {
this.attributes.put(NOTITLE, true);
this.attributes.remove(SHOW_TITLE);
}
} } | public class class_name {
public void setShowTitle(boolean showTitle) {
if (showTitle) {
this.attributes.put(SHOW_TITLE, true); // depends on control dependency: [if], data = [none]
this.attributes.remove(NOTITLE); // depends on control dependency: [if], data = [none]
} else {
this.attributes.put(NOTITLE, true); // depends on control dependency: [if], data = [none]
this.attributes.remove(SHOW_TITLE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void setCurrencyForSymbols() {
// Bug 4212072 Update the affix strings according to symbols in order to keep the
// affix strings up to date. [Richard/GCL]
// With the introduction of the Currency object, the currency symbols in the DFS
// object are ignored. For backward compatibility, we check any explicitly set DFS
// object. If it is a default symbols object for its locale, we change the
// currency object to one for that locale. If it is custom, we set the currency to
// null.
DecimalFormatSymbols def = new DecimalFormatSymbols(symbols.getULocale());
if (symbols.getCurrencySymbol().equals(def.getCurrencySymbol())
&& symbols.getInternationalCurrencySymbol()
.equals(def.getInternationalCurrencySymbol())) {
setCurrency(Currency.getInstance(symbols.getULocale()));
} else {
setCurrency(null);
}
} } | public class class_name {
private void setCurrencyForSymbols() {
// Bug 4212072 Update the affix strings according to symbols in order to keep the
// affix strings up to date. [Richard/GCL]
// With the introduction of the Currency object, the currency symbols in the DFS
// object are ignored. For backward compatibility, we check any explicitly set DFS
// object. If it is a default symbols object for its locale, we change the
// currency object to one for that locale. If it is custom, we set the currency to
// null.
DecimalFormatSymbols def = new DecimalFormatSymbols(symbols.getULocale());
if (symbols.getCurrencySymbol().equals(def.getCurrencySymbol())
&& symbols.getInternationalCurrencySymbol()
.equals(def.getInternationalCurrencySymbol())) {
setCurrency(Currency.getInstance(symbols.getULocale())); // depends on control dependency: [if], data = [none]
} else {
setCurrency(null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setReturnObject(PrintWriter out, Object objReturn)
{
String strReturn = null;
if (objReturn instanceof Map)
{
Map<String, Object> map = (Map)objReturn;
JSONObject jsonObj = AjaxProxyTask.mapToJsonObject(map);
strReturn = AjaxProxyTask.jsonObjectToReturnString(jsonObj);
}
else if (objReturn instanceof BaseMessage)
{
BaseMessage message = (BaseMessage)objReturn;
String strMessage = (String)message.get("message");
BaseMessageHeader messageHeader = message.getMessageHeader();
String strQueueName = messageHeader.getQueueName();
String strQueueType = messageHeader.getQueueType();
Integer intRegID = messageHeader.getRegistryIDMatch();
JSONObject jsonObj = new JSONObject();
try {
jsonObj.put("message", strMessage);
jsonObj.put(MessageConstants.QUEUE_NAME, strQueueName);
jsonObj.put(MessageConstants.QUEUE_TYPE, strQueueType);
if (intRegID != null)
jsonObj.put("id", intRegID.toString());
} catch (JSONException e) {
e.printStackTrace();
}
strReturn = AjaxProxyTask.jsonObjectToReturnString(jsonObj);
}
else if (objReturn instanceof BaseMessageFilter)
{
Integer intFilterID = ((BaseMessageFilter)objReturn).getFilterID();
if (intFilterID != null) // If registry ID is null.
strReturn = intFilterID.toString();
Integer intRegistryFilterID = ((BaseMessageFilter)objReturn).getRegistryID();
if (intRegistryFilterID != null) // Always
strReturn = intRegistryFilterID.toString();
}
else if (objReturn instanceof RemoteException)
{
try {
this.setErrorReturn(out, (RemoteException)objReturn);
return;
} catch (RemoteException ex) {
// Never
}
}
else
{
//? String strReturn = org.jbundle.thin.base.remote.proxy.transport.BaseTransport.convertObjectToString(objReturn);
//? strReturn = org.jbundle.thin.base.remote.proxy.transport.Base64Encoder.encode(strReturn);
if (objReturn != null)
strReturn = objReturn.toString();
}
this.setReturnString(out, strReturn);
} } | public class class_name {
public void setReturnObject(PrintWriter out, Object objReturn)
{
String strReturn = null;
if (objReturn instanceof Map)
{
Map<String, Object> map = (Map)objReturn;
JSONObject jsonObj = AjaxProxyTask.mapToJsonObject(map);
strReturn = AjaxProxyTask.jsonObjectToReturnString(jsonObj); // depends on control dependency: [if], data = [none]
}
else if (objReturn instanceof BaseMessage)
{
BaseMessage message = (BaseMessage)objReturn;
String strMessage = (String)message.get("message");
BaseMessageHeader messageHeader = message.getMessageHeader();
String strQueueName = messageHeader.getQueueName();
String strQueueType = messageHeader.getQueueType();
Integer intRegID = messageHeader.getRegistryIDMatch();
JSONObject jsonObj = new JSONObject();
try {
jsonObj.put("message", strMessage); // depends on control dependency: [try], data = [none]
jsonObj.put(MessageConstants.QUEUE_NAME, strQueueName); // depends on control dependency: [try], data = [none]
jsonObj.put(MessageConstants.QUEUE_TYPE, strQueueType); // depends on control dependency: [try], data = [none]
if (intRegID != null)
jsonObj.put("id", intRegID.toString());
} catch (JSONException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
strReturn = AjaxProxyTask.jsonObjectToReturnString(jsonObj); // depends on control dependency: [if], data = [none]
}
else if (objReturn instanceof BaseMessageFilter)
{
Integer intFilterID = ((BaseMessageFilter)objReturn).getFilterID();
if (intFilterID != null) // If registry ID is null.
strReturn = intFilterID.toString();
Integer intRegistryFilterID = ((BaseMessageFilter)objReturn).getRegistryID();
if (intRegistryFilterID != null) // Always
strReturn = intRegistryFilterID.toString();
}
else if (objReturn instanceof RemoteException)
{
try {
this.setErrorReturn(out, (RemoteException)objReturn); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
} catch (RemoteException ex) {
// Never
} // depends on control dependency: [catch], data = [none]
}
else
{
//? String strReturn = org.jbundle.thin.base.remote.proxy.transport.BaseTransport.convertObjectToString(objReturn);
//? strReturn = org.jbundle.thin.base.remote.proxy.transport.Base64Encoder.encode(strReturn);
if (objReturn != null)
strReturn = objReturn.toString();
}
this.setReturnString(out, strReturn);
} } |
public class class_name {
public void deselectByLabel(String label) {
getDispatcher().beforeDeselect(this, label);
new Select(getElement()).deselectByVisibleText(label);
if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) {
logUIActions(UIActions.CLEARED, label);
}
getDispatcher().afterDeselect(this, label);
} } | public class class_name {
public void deselectByLabel(String label) {
getDispatcher().beforeDeselect(this, label);
new Select(getElement()).deselectByVisibleText(label);
if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) {
logUIActions(UIActions.CLEARED, label); // depends on control dependency: [if], data = [none]
}
getDispatcher().afterDeselect(this, label);
} } |
public class class_name {
private void executeDeletes()
throws EFapsException
{
final AbstractDelete delete = (AbstractDelete) runnable;
for (final Instance instance : delete.getInstances()) {
final Context context = Context.getThreadContext();
final ConnectionResource con = context.getConnectionResource();
// first remove the storeresource, because the information needed
// from the general
// instance to actually delete will be removed in the second step
Resource storeRsrc = null;
try {
if (instance.getType().hasStore()) {
storeRsrc = context.getStoreResource(instance, Resource.StoreEvent.DELETE);
storeRsrc.delete();
}
} finally {
if (storeRsrc != null && storeRsrc.isOpened()) {
}
}
try {
final List<DeleteDefintion> defs = new ArrayList<>();
defs.addAll(GeneralInstance.getDeleteDefintion(instance, con));
final SQLTable mainTable = instance.getType().getMainTable();
for (final SQLTable curTable : instance.getType().getTables()) {
if (!curTable.equals(mainTable) && !curTable.isReadOnly()) {
defs.add(new DeleteDefintion(curTable.getSqlTable(), curTable.getSqlColId(), instance.getId()));
}
}
defs.add(new DeleteDefintion(mainTable.getSqlTable(), mainTable.getSqlColId(), instance.getId()));
final SQLDelete sqlDelete = Context.getDbType().newDelete(defs.toArray(new DeleteDefintion[defs
.size()]));
sqlDelete.execute(con);
AccessCache.registerUpdate(instance);
Queue.registerUpdate(instance);
} catch (final SQLException e) {
throw new EFapsException(getClass(), "executeWithoutAccessCheck.SQLException", e, instance);
}
}
} } | public class class_name {
private void executeDeletes()
throws EFapsException
{
final AbstractDelete delete = (AbstractDelete) runnable;
for (final Instance instance : delete.getInstances()) {
final Context context = Context.getThreadContext();
final ConnectionResource con = context.getConnectionResource();
// first remove the storeresource, because the information needed
// from the general
// instance to actually delete will be removed in the second step
Resource storeRsrc = null;
try {
if (instance.getType().hasStore()) {
storeRsrc = context.getStoreResource(instance, Resource.StoreEvent.DELETE); // depends on control dependency: [if], data = [none]
storeRsrc.delete(); // depends on control dependency: [if], data = [none]
}
} finally {
if (storeRsrc != null && storeRsrc.isOpened()) {
}
}
try {
final List<DeleteDefintion> defs = new ArrayList<>();
defs.addAll(GeneralInstance.getDeleteDefintion(instance, con)); // depends on control dependency: [try], data = [none]
final SQLTable mainTable = instance.getType().getMainTable();
for (final SQLTable curTable : instance.getType().getTables()) {
if (!curTable.equals(mainTable) && !curTable.isReadOnly()) {
defs.add(new DeleteDefintion(curTable.getSqlTable(), curTable.getSqlColId(), instance.getId())); // depends on control dependency: [if], data = [none]
}
}
defs.add(new DeleteDefintion(mainTable.getSqlTable(), mainTable.getSqlColId(), instance.getId())); // depends on control dependency: [try], data = [none]
final SQLDelete sqlDelete = Context.getDbType().newDelete(defs.toArray(new DeleteDefintion[defs
.size()]));
sqlDelete.execute(con); // depends on control dependency: [try], data = [none]
AccessCache.registerUpdate(instance); // depends on control dependency: [try], data = [none]
Queue.registerUpdate(instance); // depends on control dependency: [try], data = [none]
} catch (final SQLException e) {
throw new EFapsException(getClass(), "executeWithoutAccessCheck.SQLException", e, instance);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected EventBuilder createEventBuilder(LogEvent event) {
Message eventMessage = event.getMessage();
EventBuilder eventBuilder = new EventBuilder()
.withSdkIntegration("log4j2")
.withTimestamp(new Date(event.getTimeMillis()))
.withMessage(eventMessage.getFormattedMessage())
.withLogger(event.getLoggerName())
.withLevel(formatLevel(event.getLevel()))
.withExtra(THREAD_NAME, event.getThreadName());
if (eventMessage.getFormat() != null
&& !eventMessage.getFormat().equals("")
&& !eventMessage.getFormattedMessage().equals(eventMessage.getFormat())) {
eventBuilder.withSentryInterface(new MessageInterface(
eventMessage.getFormat(),
formatMessageParameters(eventMessage.getParameters()),
eventMessage.getFormattedMessage()));
}
Throwable throwable = event.getThrown();
if (throwable != null) {
eventBuilder.withSentryInterface(new ExceptionInterface(throwable));
} else if (event.getSource() != null) {
StackTraceElement[] stackTrace = {event.getSource()};
eventBuilder.withSentryInterface(new StackTraceInterface(stackTrace));
}
if (event.getContextStack() != null) {
eventBuilder.withExtra(LOG4J_NDC, event.getContextStack().asList());
}
if (event.getContextMap() != null) {
for (Map.Entry<String, String> contextEntry : event.getContextMap().entrySet()) {
if (Sentry.getStoredClient().getMdcTags().contains(contextEntry.getKey())) {
eventBuilder.withTag(contextEntry.getKey(), contextEntry.getValue());
} else {
eventBuilder.withExtra(contextEntry.getKey(), contextEntry.getValue());
}
}
}
if (event.getMarker() != null) {
eventBuilder.withTag(LOG4J_MARKER, event.getMarker().getName());
}
return eventBuilder;
} } | public class class_name {
protected EventBuilder createEventBuilder(LogEvent event) {
Message eventMessage = event.getMessage();
EventBuilder eventBuilder = new EventBuilder()
.withSdkIntegration("log4j2")
.withTimestamp(new Date(event.getTimeMillis()))
.withMessage(eventMessage.getFormattedMessage())
.withLogger(event.getLoggerName())
.withLevel(formatLevel(event.getLevel()))
.withExtra(THREAD_NAME, event.getThreadName());
if (eventMessage.getFormat() != null
&& !eventMessage.getFormat().equals("")
&& !eventMessage.getFormattedMessage().equals(eventMessage.getFormat())) {
eventBuilder.withSentryInterface(new MessageInterface(
eventMessage.getFormat(),
formatMessageParameters(eventMessage.getParameters()),
eventMessage.getFormattedMessage())); // depends on control dependency: [if], data = [none]
}
Throwable throwable = event.getThrown();
if (throwable != null) {
eventBuilder.withSentryInterface(new ExceptionInterface(throwable)); // depends on control dependency: [if], data = [(throwable]
} else if (event.getSource() != null) {
StackTraceElement[] stackTrace = {event.getSource()};
eventBuilder.withSentryInterface(new StackTraceInterface(stackTrace)); // depends on control dependency: [if], data = [none]
}
if (event.getContextStack() != null) {
eventBuilder.withExtra(LOG4J_NDC, event.getContextStack().asList()); // depends on control dependency: [if], data = [none]
}
if (event.getContextMap() != null) {
for (Map.Entry<String, String> contextEntry : event.getContextMap().entrySet()) {
if (Sentry.getStoredClient().getMdcTags().contains(contextEntry.getKey())) {
eventBuilder.withTag(contextEntry.getKey(), contextEntry.getValue()); // depends on control dependency: [if], data = [none]
} else {
eventBuilder.withExtra(contextEntry.getKey(), contextEntry.getValue()); // depends on control dependency: [if], data = [none]
}
}
}
if (event.getMarker() != null) {
eventBuilder.withTag(LOG4J_MARKER, event.getMarker().getName()); // depends on control dependency: [if], data = [none]
}
return eventBuilder;
} } |
public class class_name {
public static long convert2long(String date, String format) {
try {
if (!StringUtil.isEmpty(date)) {
if (StringUtil.isEmpty(format))
format = dateTimeFormat;
SimpleDateFormat sf = new SimpleDateFormat(format);
return sf.parse(date).getTime();
}
} catch (ParseException e) {
LOG.error(e);
}
return 0l;
} } | public class class_name {
public static long convert2long(String date, String format) {
try {
if (!StringUtil.isEmpty(date)) {
if (StringUtil.isEmpty(format))
format = dateTimeFormat;
SimpleDateFormat sf = new SimpleDateFormat(format);
return sf.parse(date).getTime(); // depends on control dependency: [if], data = [none]
}
} catch (ParseException e) {
LOG.error(e);
} // depends on control dependency: [catch], data = [none]
return 0l;
} } |
public class class_name {
public static int getOptionPos(String flag, String[] options) {
if (options == null)
return -1;
for (int i = 0; i < options.length; i++) {
if ((options[i].length() > 0) && (options[i].charAt(0) == '-')) {
// Check if it is a negative number
try {
Double.valueOf(options[i]);
}
catch (NumberFormatException e) {
// found?
if (options[i].equals("-" + flag))
return i;
// did we reach "--"?
if (options[i].charAt(1) == '-')
return -1;
}
}
}
return -1;
} } | public class class_name {
public static int getOptionPos(String flag, String[] options) {
if (options == null)
return -1;
for (int i = 0; i < options.length; i++) {
if ((options[i].length() > 0) && (options[i].charAt(0) == '-')) {
// Check if it is a negative number
try {
Double.valueOf(options[i]); // depends on control dependency: [try], data = [none]
}
catch (NumberFormatException e) {
// found?
if (options[i].equals("-" + flag))
return i;
// did we reach "--"?
if (options[i].charAt(1) == '-')
return -1;
} // depends on control dependency: [catch], data = [none]
}
}
return -1;
} } |
public class class_name {
private URL buildStyleSheetUrl(final StyleSheet ss) {
final StringBuilder sb = new StringBuilder();
if (!ss.path().isEmpty()) {
sb.append(ss.path()).append(Resources.PATH_SEP);
}
sb.append(ss.name());
if (!ss.name().endsWith(CSS_EXT)) {
sb.append(CSS_EXT);
}
return buildUrl(sb.toString(), ss.skipStylesFolder());
} } | public class class_name {
private URL buildStyleSheetUrl(final StyleSheet ss) {
final StringBuilder sb = new StringBuilder();
if (!ss.path().isEmpty()) {
sb.append(ss.path()).append(Resources.PATH_SEP);
// depends on control dependency: [if], data = [none]
}
sb.append(ss.name());
if (!ss.name().endsWith(CSS_EXT)) {
sb.append(CSS_EXT);
// depends on control dependency: [if], data = [none]
}
return buildUrl(sb.toString(), ss.skipStylesFolder());
} } |
public class class_name {
public void marshall(MapFilter mapFilter, ProtocolMarshaller protocolMarshaller) {
if (mapFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(mapFilter.getKey(), KEY_BINDING);
protocolMarshaller.marshall(mapFilter.getValue(), VALUE_BINDING);
protocolMarshaller.marshall(mapFilter.getComparison(), COMPARISON_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(MapFilter mapFilter, ProtocolMarshaller protocolMarshaller) {
if (mapFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(mapFilter.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mapFilter.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mapFilter.getComparison(), COMPARISON_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <DPO> SingleResultCollectorContext<DPO> collect(ResultCollector<?, DPO> resultCollector) {
List<Trigger> addedTriggers = new ArrayList<Trigger>();
List<DataProvider<DPO>> addedDataProviders = new ArrayList<DataProvider<DPO>>();
if (resultCollector != null) {
addedTriggers.add(resultCollector);
addedDataProviders.add(resultCollector);
}
return new SingleResultCollectorContext<DPO>(addedTriggers, addedDataProviders);
} } | public class class_name {
public static <DPO> SingleResultCollectorContext<DPO> collect(ResultCollector<?, DPO> resultCollector) {
List<Trigger> addedTriggers = new ArrayList<Trigger>();
List<DataProvider<DPO>> addedDataProviders = new ArrayList<DataProvider<DPO>>();
if (resultCollector != null) {
addedTriggers.add(resultCollector); // depends on control dependency: [if], data = [(resultCollector]
addedDataProviders.add(resultCollector); // depends on control dependency: [if], data = [(resultCollector]
}
return new SingleResultCollectorContext<DPO>(addedTriggers, addedDataProviders);
} } |
public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String model) {
final char[] c = model.toCharArray();
boolean result = true;
String curr;
for (final char element : c) {
curr = new String(new char[] { element });
try {
final String nue = new String(curr.getBytes(this.charsetName));
result = element == nue.charAt(0);
if (!result) {
problems.add(
ValidationBundle.getMessage(EncodableInCharsetValidator.class, "INVALID_CHARACTER", compName, curr, this.charsetName)); // NOI18N
break;
}
} catch (final UnsupportedEncodingException ex) {
// Already tested in constructor
throw new AssertionError(ex);
}
}
return result;
} } | public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String model) {
final char[] c = model.toCharArray();
boolean result = true;
String curr;
for (final char element : c) {
curr = new String(new char[] { element }); // depends on control dependency: [for], data = [element]
try {
final String nue = new String(curr.getBytes(this.charsetName));
result = element == nue.charAt(0); // depends on control dependency: [try], data = [none]
if (!result) {
problems.add(
ValidationBundle.getMessage(EncodableInCharsetValidator.class, "INVALID_CHARACTER", compName, curr, this.charsetName)); // NOI18N // depends on control dependency: [if], data = [none]
break;
}
} catch (final UnsupportedEncodingException ex) {
// Already tested in constructor
throw new AssertionError(ex);
} // depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
public static Tensor edgeScoresToTensor(EdgeScores es, Algebra s) {
int n = es.child.length;
Tensor m = new Tensor(s, n, n);
for (int p = -1; p < n; p++) {
for (int c = 0; c < n; c++) {
if (p == c) { continue; }
int pp = getTensorParent(p, c);
m.set(es.getScore(p, c), pp, c);
}
}
return m;
} } | public class class_name {
public static Tensor edgeScoresToTensor(EdgeScores es, Algebra s) {
int n = es.child.length;
Tensor m = new Tensor(s, n, n);
for (int p = -1; p < n; p++) {
for (int c = 0; c < n; c++) {
if (p == c) { continue; }
int pp = getTensorParent(p, c);
m.set(es.getScore(p, c), pp, c); // depends on control dependency: [for], data = [c]
}
}
return m;
} } |
public class class_name {
public final String entryRuleOpSingleAssign() throws RecognitionException {
String current = null;
AntlrDatatypeRuleToken iv_ruleOpSingleAssign = null;
try {
// InternalPureXbase.g:906:54: (iv_ruleOpSingleAssign= ruleOpSingleAssign EOF )
// InternalPureXbase.g:907:2: iv_ruleOpSingleAssign= ruleOpSingleAssign EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getOpSingleAssignRule());
}
pushFollow(FOLLOW_1);
iv_ruleOpSingleAssign=ruleOpSingleAssign();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleOpSingleAssign.getText();
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final String entryRuleOpSingleAssign() throws RecognitionException {
String current = null;
AntlrDatatypeRuleToken iv_ruleOpSingleAssign = null;
try {
// InternalPureXbase.g:906:54: (iv_ruleOpSingleAssign= ruleOpSingleAssign EOF )
// InternalPureXbase.g:907:2: iv_ruleOpSingleAssign= ruleOpSingleAssign EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getOpSingleAssignRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleOpSingleAssign=ruleOpSingleAssign();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleOpSingleAssign.getText(); // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
public static ContentType getCurrentContentType(SearchContext context) {
return ofNullable(unpackWebDriverFromSearchContext(context)).map(driver -> {
if (HasSessionDetails.class.isAssignableFrom(driver.getClass())) {
HasSessionDetails hasSessionDetails = HasSessionDetails.class.cast(driver);
if (!hasSessionDetails.isBrowser()) {
return NATIVE_MOBILE_SPECIFIC;
}
}
if (ContextAware.class.isAssignableFrom(driver.getClass())) { //it is desktop browser
ContextAware contextAware = ContextAware.class.cast(driver);
String currentContext = contextAware.getContext();
if (containsIgnoreCase(currentContext, NATIVE_APP_PATTERN)) {
return NATIVE_MOBILE_SPECIFIC;
}
}
return HTML_OR_DEFAULT;
}).orElse(HTML_OR_DEFAULT);
} } | public class class_name {
public static ContentType getCurrentContentType(SearchContext context) {
return ofNullable(unpackWebDriverFromSearchContext(context)).map(driver -> {
if (HasSessionDetails.class.isAssignableFrom(driver.getClass())) {
HasSessionDetails hasSessionDetails = HasSessionDetails.class.cast(driver);
if (!hasSessionDetails.isBrowser()) {
return NATIVE_MOBILE_SPECIFIC; // depends on control dependency: [if], data = [none]
}
}
if (ContextAware.class.isAssignableFrom(driver.getClass())) { //it is desktop browser
ContextAware contextAware = ContextAware.class.cast(driver);
String currentContext = contextAware.getContext();
if (containsIgnoreCase(currentContext, NATIVE_APP_PATTERN)) {
return NATIVE_MOBILE_SPECIFIC; // depends on control dependency: [if], data = [none]
}
}
return HTML_OR_DEFAULT;
}).orElse(HTML_OR_DEFAULT);
} } |
public class class_name {
@VisibleForTesting
public ControllerServiceStarter awaitServicePausing() {
monitor.enterWhenUninterruptibly(hasReachedPausing);
try {
if (serviceState != ServiceState.PAUSING) {
throw new IllegalStateException("Expected state=" + ServiceState.PAUSING +
", but actual state=" + serviceState);
} else {
return this.starter;
}
} finally {
monitor.leave();
}
} } | public class class_name {
@VisibleForTesting
public ControllerServiceStarter awaitServicePausing() {
monitor.enterWhenUninterruptibly(hasReachedPausing);
try {
if (serviceState != ServiceState.PAUSING) {
throw new IllegalStateException("Expected state=" + ServiceState.PAUSING +
", but actual state=" + serviceState);
} else {
return this.starter; // depends on control dependency: [if], data = [none]
}
} finally {
monitor.leave();
}
} } |
public class class_name {
public static void widthTable(XWPFTable table, float widthCM, int cols) {
int width = (int)(widthCM/2.54*1440);
CTTblPr tblPr = table.getCTTbl().getTblPr();
if (null == tblPr) {
tblPr = table.getCTTbl().addNewTblPr();
}
CTTblWidth tblW = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
tblW.setType(0 == width ? STTblWidth.AUTO : STTblWidth.DXA);
tblW.setW(BigInteger.valueOf(width));
if (0 != width) {
CTTblGrid tblGrid = table.getCTTbl().getTblGrid();
if (null == tblGrid) {
tblGrid = table.getCTTbl().addNewTblGrid();
}
for (int j = 0; j < cols; j++) {
CTTblGridCol addNewGridCol = tblGrid.addNewGridCol();
addNewGridCol.setW(BigInteger.valueOf(width / cols));
}
}
} } | public class class_name {
public static void widthTable(XWPFTable table, float widthCM, int cols) {
int width = (int)(widthCM/2.54*1440);
CTTblPr tblPr = table.getCTTbl().getTblPr();
if (null == tblPr) {
tblPr = table.getCTTbl().addNewTblPr(); // depends on control dependency: [if], data = [none]
}
CTTblWidth tblW = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
tblW.setType(0 == width ? STTblWidth.AUTO : STTblWidth.DXA);
tblW.setW(BigInteger.valueOf(width));
if (0 != width) {
CTTblGrid tblGrid = table.getCTTbl().getTblGrid();
if (null == tblGrid) {
tblGrid = table.getCTTbl().addNewTblGrid(); // depends on control dependency: [if], data = [none]
}
for (int j = 0; j < cols; j++) {
CTTblGridCol addNewGridCol = tblGrid.addNewGridCol();
addNewGridCol.setW(BigInteger.valueOf(width / cols)); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public void setInteractive(final boolean INTERACTIVE) {
if (null == interactive) {
_interactive = INTERACTIVE;
redraw();
} else {
interactive.set(INTERACTIVE);
}
} } | public class class_name {
public void setInteractive(final boolean INTERACTIVE) {
if (null == interactive) {
_interactive = INTERACTIVE; // depends on control dependency: [if], data = [none]
redraw(); // depends on control dependency: [if], data = [none]
} else {
interactive.set(INTERACTIVE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void handleLoadResource(Option option) {
String resourceLocation = option.getValue();
reportable.output("Loading resource into the cache:");
reportable.output(" " + resourceLocation);
ResourceType type = ResourceType.fromLocation(resourceLocation);
if (type == null) {
reportable
.error("Resource type cannot be determined, consult help with -h.");
bail(GENERAL_FAILURE);
}
cacheMgrService.updateResourceInCache(type, resourceLocation);
} } | public class class_name {
protected void handleLoadResource(Option option) {
String resourceLocation = option.getValue();
reportable.output("Loading resource into the cache:");
reportable.output(" " + resourceLocation);
ResourceType type = ResourceType.fromLocation(resourceLocation);
if (type == null) {
reportable
.error("Resource type cannot be determined, consult help with -h."); // depends on control dependency: [if], data = [none]
bail(GENERAL_FAILURE); // depends on control dependency: [if], data = [none]
}
cacheMgrService.updateResourceInCache(type, resourceLocation);
} } |
public class class_name {
private String getStackTrace(AbstractRestException data) {
StringBuilderWriter writer = new StringBuilderWriter();
try {
data.printStackTrace(new PrintWriter(writer));
return writer.getBuilder().toString();
} finally {
writer.close();
}
} } | public class class_name {
private String getStackTrace(AbstractRestException data) {
StringBuilderWriter writer = new StringBuilderWriter();
try {
data.printStackTrace(new PrintWriter(writer)); // depends on control dependency: [try], data = [none]
return writer.getBuilder().toString(); // depends on control dependency: [try], data = [none]
} finally {
writer.close();
}
} } |
public class class_name {
public ClassDoc[] exceptions() {
ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
for (ClassDocImpl c : getClasses(true)) {
if (c.isException()) {
ret.append(c);
}
}
return ret.toArray(new ClassDocImpl[ret.length()]);
} } | public class class_name {
public ClassDoc[] exceptions() {
ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
for (ClassDocImpl c : getClasses(true)) {
if (c.isException()) {
ret.append(c); // depends on control dependency: [if], data = [none]
}
}
return ret.toArray(new ClassDocImpl[ret.length()]);
} } |
public class class_name {
public void addCssProperties(final String cssProperties) {
final long stamp = lock.writeLock();
try {
extractStylesAndAddToAttributeValueMap(cssProperties);
} finally {
lock.unlockWrite(stamp);
}
} } | public class class_name {
public void addCssProperties(final String cssProperties) {
final long stamp = lock.writeLock();
try {
extractStylesAndAddToAttributeValueMap(cssProperties); // depends on control dependency: [try], data = [none]
} finally {
lock.unlockWrite(stamp);
}
} } |
public class class_name {
protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) {
ErrorProperties.IncludeStacktrace include = this.errorProperties
.getIncludeStacktrace();
if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
return true;
}
if (include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM) {
return isTraceEnabled(request);
}
return false;
} } | public class class_name {
protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) {
ErrorProperties.IncludeStacktrace include = this.errorProperties
.getIncludeStacktrace();
if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
return true; // depends on control dependency: [if], data = [none]
}
if (include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM) {
return isTraceEnabled(request); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void anonymize() {
for (int i = theAtts.getLength() - 1; i >= 0; i--) {
if (theAtts.getType(i).equals("ID")
|| theAtts.getQName(i).equals("name")) {
theAtts.removeAttribute(i);
}
}
} } | public class class_name {
public void anonymize() {
for (int i = theAtts.getLength() - 1; i >= 0; i--) {
if (theAtts.getType(i).equals("ID")
|| theAtts.getQName(i).equals("name")) {
theAtts.removeAttribute(i); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public <X extends Exception> void updateAll(Try.TriFunction<R, C, E, E, X> func) throws X {
checkFrozen();
if (rowLength() > 0 && columnLength() > 0) {
this.init();
final int rowLength = rowLength();
int columnIndex = 0;
C columnKey = null;
for (List<E> column : _columnList) {
columnKey = _columnKeyIndexMap.getByValue(columnIndex);
for (int rowIndex = 0; rowIndex < rowLength; rowIndex++) {
column.set(rowIndex, func.apply(_rowKeyIndexMap.getByValue(rowIndex), columnKey, column.get(rowIndex)));
}
columnIndex++;
}
}
} } | public class class_name {
public <X extends Exception> void updateAll(Try.TriFunction<R, C, E, E, X> func) throws X {
checkFrozen();
if (rowLength() > 0 && columnLength() > 0) {
this.init();
final int rowLength = rowLength();
int columnIndex = 0;
C columnKey = null;
for (List<E> column : _columnList) {
columnKey = _columnKeyIndexMap.getByValue(columnIndex);
// depends on control dependency: [for], data = [column]
for (int rowIndex = 0; rowIndex < rowLength; rowIndex++) {
column.set(rowIndex, func.apply(_rowKeyIndexMap.getByValue(rowIndex), columnKey, column.get(rowIndex)));
// depends on control dependency: [for], data = [rowIndex]
}
columnIndex++;
// depends on control dependency: [for], data = [column]
}
}
} } |
public class class_name {
public void marshall(DynamoDBTarget dynamoDBTarget, ProtocolMarshaller protocolMarshaller) {
if (dynamoDBTarget == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dynamoDBTarget.getPath(), PATH_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DynamoDBTarget dynamoDBTarget, ProtocolMarshaller protocolMarshaller) {
if (dynamoDBTarget == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dynamoDBTarget.getPath(), PATH_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void put(String key, Object value) {
Bindings nn = getBindings(ScriptContext.ENGINE_SCOPE);
if (nn != null) {
nn.put(key, value);
}
} } | public class class_name {
public void put(String key, Object value) {
Bindings nn = getBindings(ScriptContext.ENGINE_SCOPE);
if (nn != null) {
nn.put(key, value); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void showPopup() {
updateFromTextBox(true);
m_box.setPreventShowError(true);
m_popup.showRelativeTo(m_box);
if (m_previewHandlerRegistration != null) {
m_previewHandlerRegistration.removeHandler();
}
m_previewHandlerRegistration = Event.addNativePreviewHandler(new CloseEventPreviewHandler());
} } | public class class_name {
private void showPopup() {
updateFromTextBox(true);
m_box.setPreventShowError(true);
m_popup.showRelativeTo(m_box);
if (m_previewHandlerRegistration != null) {
m_previewHandlerRegistration.removeHandler(); // depends on control dependency: [if], data = [none]
}
m_previewHandlerRegistration = Event.addNativePreviewHandler(new CloseEventPreviewHandler());
} } |
public class class_name {
@Deprecated
public static byte[] getContentFromUrl(String url, String proxyServer, int port, Map inCookies, Map outCookies, boolean allowAllCerts)
{
// if proxy server is passed
Proxy proxy = null;
if (proxyServer != null)
{
proxy = new Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress(proxyServer, port));
}
return getContentFromUrl(url, inCookies, outCookies, proxy, allowAllCerts);
} } | public class class_name {
@Deprecated
public static byte[] getContentFromUrl(String url, String proxyServer, int port, Map inCookies, Map outCookies, boolean allowAllCerts)
{
// if proxy server is passed
Proxy proxy = null;
if (proxyServer != null)
{
proxy = new Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress(proxyServer, port)); // depends on control dependency: [if], data = [(proxyServer]
}
return getContentFromUrl(url, inCookies, outCookies, proxy, allowAllCerts);
} } |
public class class_name {
protected void cleanup(Iterable<? extends K> keys, StoreAccessException from) {
try {
store.obliterate(keys);
} catch (StoreAccessException e) {
inconsistent(keys, from, e);
return;
}
recovered(keys, from);
} } | public class class_name {
protected void cleanup(Iterable<? extends K> keys, StoreAccessException from) {
try {
store.obliterate(keys); // depends on control dependency: [try], data = [none]
} catch (StoreAccessException e) {
inconsistent(keys, from, e);
return;
} // depends on control dependency: [catch], data = [none]
recovered(keys, from);
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T extends Throwable> T wrap(Throwable throwable, Class<T> wrapThrowable) {
if (wrapThrowable.isInstance(throwable)) {
return (T) throwable;
}
return ReflectUtil.newInstance(wrapThrowable, throwable);
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T extends Throwable> T wrap(Throwable throwable, Class<T> wrapThrowable) {
if (wrapThrowable.isInstance(throwable)) {
return (T) throwable; // depends on control dependency: [if], data = [none]
}
return ReflectUtil.newInstance(wrapThrowable, throwable);
} } |
public class class_name {
public synchronized static Server getServer(ServerConfig serverConfig) {
try {
Server server = SERVER_MAP.get(Integer.toString(serverConfig.getPort()));
if (server == null) {
// 算下网卡和端口
resolveServerConfig(serverConfig);
ExtensionClass<Server> ext = ExtensionLoaderFactory.getExtensionLoader(Server.class)
.getExtensionClass(serverConfig.getProtocol());
if (ext == null) {
throw ExceptionUtils.buildRuntime("server.protocol", serverConfig.getProtocol(),
"Unsupported protocol of server!");
}
server = ext.getExtInstance();
server.init(serverConfig);
SERVER_MAP.put(serverConfig.getPort() + "", server);
}
return server;
} catch (SofaRpcRuntimeException e) {
throw e;
} catch (Throwable e) {
throw new SofaRpcRuntimeException(e.getMessage(), e);
}
} } | public class class_name {
public synchronized static Server getServer(ServerConfig serverConfig) {
try {
Server server = SERVER_MAP.get(Integer.toString(serverConfig.getPort()));
if (server == null) {
// 算下网卡和端口
resolveServerConfig(serverConfig); // depends on control dependency: [if], data = [(server]
ExtensionClass<Server> ext = ExtensionLoaderFactory.getExtensionLoader(Server.class)
.getExtensionClass(serverConfig.getProtocol());
if (ext == null) {
throw ExceptionUtils.buildRuntime("server.protocol", serverConfig.getProtocol(),
"Unsupported protocol of server!");
}
server = ext.getExtInstance(); // depends on control dependency: [if], data = [none]
server.init(serverConfig); // depends on control dependency: [if], data = [(server]
SERVER_MAP.put(serverConfig.getPort() + "", server); // depends on control dependency: [if], data = [(server]
}
return server; // depends on control dependency: [try], data = [none]
} catch (SofaRpcRuntimeException e) {
throw e;
} catch (Throwable e) { // depends on control dependency: [catch], data = [none]
throw new SofaRpcRuntimeException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void loadCSVFromReader(TableDefinition tableDef,
String csvName,
long byteLength,
BufferedReader reader) {
m_logger.info("Loading CSV file: {}", csvName);
// Determine the order in which fields in this file appear. Wrap this in a CSVFile.
List<String> fieldList = getFieldListFromHeader(reader);
CSVFile csvFile = new CSVFile(csvName, tableDef, fieldList);
long startTime = System.currentTimeMillis();
long recsLoaded = 0;
int lineNo = 0;
while (true) {
Map<String, String> fieldMap = new HashMap<String, String>();
if (!tokenizeCSVLine(csvFile, reader, fieldMap)) {
break;
}
lineNo++;
m_totalLines++;
try {
m_workerQueue.put(new Record(csvFile, fieldMap));
} catch (InterruptedException e) {
logErrorThrow("Error posting to queue", e.toString());
}
if ((++recsLoaded % 10000) == 0) {
m_logger.info("...loaded {} records.", recsLoaded);
}
}
// Always close the file and display stats even if an error occurred.
m_totalFiles++;
m_totalBytes += byteLength;
long stopTime = System.currentTimeMillis();
long totalMillis = stopTime - startTime;
if (totalMillis == 0) {
totalMillis = 1; // You never know
}
m_logger.info("File '{}': time={} millis; lines={}",
new Object[]{csvFile.m_fileName, totalMillis, lineNo});
} } | public class class_name {
private void loadCSVFromReader(TableDefinition tableDef,
String csvName,
long byteLength,
BufferedReader reader) {
m_logger.info("Loading CSV file: {}", csvName);
// Determine the order in which fields in this file appear. Wrap this in a CSVFile.
List<String> fieldList = getFieldListFromHeader(reader);
CSVFile csvFile = new CSVFile(csvName, tableDef, fieldList);
long startTime = System.currentTimeMillis();
long recsLoaded = 0;
int lineNo = 0;
while (true) {
Map<String, String> fieldMap = new HashMap<String, String>();
if (!tokenizeCSVLine(csvFile, reader, fieldMap)) {
break;
}
lineNo++;
// depends on control dependency: [while], data = [none]
m_totalLines++;
// depends on control dependency: [while], data = [none]
try {
m_workerQueue.put(new Record(csvFile, fieldMap));
// depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
logErrorThrow("Error posting to queue", e.toString());
}
// depends on control dependency: [catch], data = [none]
if ((++recsLoaded % 10000) == 0) {
m_logger.info("...loaded {} records.", recsLoaded);
// depends on control dependency: [if], data = [none]
}
}
// Always close the file and display stats even if an error occurred.
m_totalFiles++;
m_totalBytes += byteLength;
long stopTime = System.currentTimeMillis();
long totalMillis = stopTime - startTime;
if (totalMillis == 0) {
totalMillis = 1; // You never know
// depends on control dependency: [if], data = [none]
}
m_logger.info("File '{}': time={} millis; lines={}",
new Object[]{csvFile.m_fileName, totalMillis, lineNo});
} } |
public class class_name {
protected boolean isSuccessor(NodeData mergeVersion, NodeData corrVersion) throws RepositoryException
{
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
PropertyData successorsProperty =
(PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_SUCCESSORS, 0),
ItemType.PROPERTY);
if (successorsProperty != null)
{
for (ValueData sv : successorsProperty.getValues())
{
String sidentifier = ValueDataUtil.getString(sv);
if (sidentifier.equals(corrVersion.getIdentifier()))
{
return true; // got it
}
// search in successors of the successor
NodeData successor = (NodeData)mergeDataManager.getItemData(sidentifier);
if (successor != null)
{
if (isSuccessor(successor, corrVersion))
{
return true;
}
}
else
{
throw new RepositoryException("Merge. Ssuccessor is not found by uuid " + sidentifier + ". Version "
+ mergeSession.getLocationFactory().createJCRPath(mergeVersion.getQPath()).getAsString(false));
}
}
// else it's a end of version graph node
}
return false;
} } | public class class_name {
protected boolean isSuccessor(NodeData mergeVersion, NodeData corrVersion) throws RepositoryException
{
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
PropertyData successorsProperty =
(PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_SUCCESSORS, 0),
ItemType.PROPERTY);
if (successorsProperty != null)
{
for (ValueData sv : successorsProperty.getValues())
{
String sidentifier = ValueDataUtil.getString(sv);
if (sidentifier.equals(corrVersion.getIdentifier()))
{
return true; // got it // depends on control dependency: [if], data = [none]
}
// search in successors of the successor
NodeData successor = (NodeData)mergeDataManager.getItemData(sidentifier);
if (successor != null)
{
if (isSuccessor(successor, corrVersion))
{
return true; // depends on control dependency: [if], data = [none]
}
}
else
{
throw new RepositoryException("Merge. Ssuccessor is not found by uuid " + sidentifier + ". Version "
+ mergeSession.getLocationFactory().createJCRPath(mergeVersion.getQPath()).getAsString(false));
}
}
// else it's a end of version graph node
}
return false;
} } |
public class class_name {
Cookie[] convertCookies(HttpEntity<?> httpEntity) {
final List<Cookie> cookies = new LinkedList<>();
List<String> inboundCookies = httpEntity.getHeaders().get(HttpHeaders.SET_COOKIE);
if (inboundCookies != null) {
for (String cookieString : inboundCookies) {
Cookie cookie = convertCookieString(cookieString);
cookies.add(cookie);
}
}
return cookies.toArray(new Cookie[0]);
} } | public class class_name {
Cookie[] convertCookies(HttpEntity<?> httpEntity) {
final List<Cookie> cookies = new LinkedList<>();
List<String> inboundCookies = httpEntity.getHeaders().get(HttpHeaders.SET_COOKIE);
if (inboundCookies != null) {
for (String cookieString : inboundCookies) {
Cookie cookie = convertCookieString(cookieString);
cookies.add(cookie); // depends on control dependency: [for], data = [none]
}
}
return cookies.toArray(new Cookie[0]);
} } |
public class class_name {
public Observable<ServiceResponse<Iteration>> trainProjectWithServiceResponseAsync(UUID projectId) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
return service.trainProject(projectId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Iteration>>>() {
@Override
public Observable<ServiceResponse<Iteration>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Iteration> clientResponse = trainProjectDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Iteration>> trainProjectWithServiceResponseAsync(UUID projectId) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
return service.trainProject(projectId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Iteration>>>() {
@Override
public Observable<ServiceResponse<Iteration>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Iteration> clientResponse = trainProjectDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
@Action(name = "Compute Signature V4",
outputs = {
@Output(Outputs.RETURN_CODE),
@Output(Outputs.RETURN_RESULT),
@Output(Outputs.EXCEPTION),
@Output(SIGNATURE_RESULT),
@Output(AUTHORIZATION_HEADER_RESULT)
},
responses = {
@Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.SUCCESS_RETURN_CODE,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.FAILURE_RETURN_CODE,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
})
public Map<String, String> execute(@Param(value = ENDPOINT) String endpoint,
@Param(value = IDENTITY, required = true) String identity,
@Param(value = CREDENTIAL, required = true, encrypted = true) String credential,
@Param(value = HEADERS) String headers,
@Param(value = QUERY_PARAMS) String queryParams,
@Param(value = AMAZON_API) String amazonApi,
@Param(value = URI) String uri,
@Param(value = HTTP_VERB) String httpVerb,
@Param(value = PAYLOAD_HASH) String payloadHash,
@Param(value = DATE) String date,
@Param(value = SECURITY_TOKEN) String securityToken,
@Param(value = PREFIX) String prefix) {
try {
Map<String, String> headersMap = getHeadersOrQueryParamsMap(new HashMap<String, String>(), headers, HEADER_DELIMITER, COLON, true);
Map<String, String> queryParamsMap = getHeadersOrQueryParamsMap(new HashMap<String, String>(), queryParams, AMPERSAND, EQUAL, false);
CommonInputs commonInputs = new CommonInputs.Builder()
.withEndpoint(endpoint, amazonApi, prefix)
.withIdentity(identity)
.withCredential(credential)
.build();
InputsWrapper wrapper = new InputsWrapper.Builder()
.withCommonInputs(commonInputs)
.withApiService(amazonApi)
.withRequestUri(uri)
.withHttpVerb(httpVerb)
.withRequestPayload(payloadHash)
.withDate(date)
.withHeaders(headers)
.withQueryParams(queryParams)
.withSecurityToken(securityToken)
.build();
AuthorizationHeader authorizationHeader = new AmazonSignatureService()
.signRequestHeaders(wrapper, headersMap, queryParamsMap);
return OutputsUtil.populateSignatureResultsMap(authorizationHeader);
} catch (Exception exception) {
return ExceptionProcessor.getExceptionResult(exception);
}
} } | public class class_name {
@Action(name = "Compute Signature V4",
outputs = {
@Output(Outputs.RETURN_CODE),
@Output(Outputs.RETURN_RESULT),
@Output(Outputs.EXCEPTION),
@Output(SIGNATURE_RESULT),
@Output(AUTHORIZATION_HEADER_RESULT)
},
responses = {
@Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.SUCCESS_RETURN_CODE,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.FAILURE_RETURN_CODE,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
})
public Map<String, String> execute(@Param(value = ENDPOINT) String endpoint,
@Param(value = IDENTITY, required = true) String identity,
@Param(value = CREDENTIAL, required = true, encrypted = true) String credential,
@Param(value = HEADERS) String headers,
@Param(value = QUERY_PARAMS) String queryParams,
@Param(value = AMAZON_API) String amazonApi,
@Param(value = URI) String uri,
@Param(value = HTTP_VERB) String httpVerb,
@Param(value = PAYLOAD_HASH) String payloadHash,
@Param(value = DATE) String date,
@Param(value = SECURITY_TOKEN) String securityToken,
@Param(value = PREFIX) String prefix) {
try {
Map<String, String> headersMap = getHeadersOrQueryParamsMap(new HashMap<String, String>(), headers, HEADER_DELIMITER, COLON, true);
Map<String, String> queryParamsMap = getHeadersOrQueryParamsMap(new HashMap<String, String>(), queryParams, AMPERSAND, EQUAL, false);
CommonInputs commonInputs = new CommonInputs.Builder()
.withEndpoint(endpoint, amazonApi, prefix)
.withIdentity(identity)
.withCredential(credential)
.build();
InputsWrapper wrapper = new InputsWrapper.Builder()
.withCommonInputs(commonInputs)
.withApiService(amazonApi)
.withRequestUri(uri)
.withHttpVerb(httpVerb)
.withRequestPayload(payloadHash)
.withDate(date)
.withHeaders(headers)
.withQueryParams(queryParams)
.withSecurityToken(securityToken)
.build();
AuthorizationHeader authorizationHeader = new AmazonSignatureService()
.signRequestHeaders(wrapper, headersMap, queryParamsMap);
return OutputsUtil.populateSignatureResultsMap(authorizationHeader); // depends on control dependency: [try], data = [none]
} catch (Exception exception) {
return ExceptionProcessor.getExceptionResult(exception);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void sendMessage(org.isoblue.isobus.Message message) {
// Check that we're actually connected before trying anything
if (mChatService.getState() != BluetoothService.STATE_CONNECTED) {
Toast.makeText(this, R.string.not_connected, Toast.LENGTH_SHORT)
.show();
return;
}
// Get the message bytes and tell the BluetoothChatService to write
mChatService.write(message);
// Reset out string buffer to zero and clear the edit text field
mOutStringBuffer.setLength(0);
} } | public class class_name {
private void sendMessage(org.isoblue.isobus.Message message) {
// Check that we're actually connected before trying anything
if (mChatService.getState() != BluetoothService.STATE_CONNECTED) {
Toast.makeText(this, R.string.not_connected, Toast.LENGTH_SHORT)
.show(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Get the message bytes and tell the BluetoothChatService to write
mChatService.write(message);
// Reset out string buffer to zero and clear the edit text field
mOutStringBuffer.setLength(0);
} } |
public class class_name {
public static final boolean isCharged(char aa) {
if (negChargedAAs.contains(String.valueOf(aa))) {
return true;
}
else if (posChargedAAs.contains(String.valueOf(aa))) {
return true;
}
return false;
} } | public class class_name {
public static final boolean isCharged(char aa) {
if (negChargedAAs.contains(String.valueOf(aa))) {
return true; // depends on control dependency: [if], data = [none]
}
else if (posChargedAAs.contains(String.valueOf(aa))) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
private void closeContext(DirContext ctx) {
if (ctx != null) {
try {
ctx.close();
}
catch (Exception e) {
LOG.debug("Exception closing context", e);
}
}
} } | public class class_name {
private void closeContext(DirContext ctx) {
if (ctx != null) {
try {
ctx.close(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
LOG.debug("Exception closing context", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private static URI getBlobId(String token) {
try {
int i = token.indexOf('+');
if (i == -1) {
return new URI(new PID(token).toURI());
} else {
String[] dsParts = token.substring(i + 1).split("\\+");
if (dsParts.length != 2) {
throw new IllegalArgumentException(
"Malformed datastream token: " + token);
}
return new URI(Constants.FEDORA.uri
+ token.substring(0, i) + "/"
+ uriEncode(dsParts[0]) + "/"
+ uriEncode(dsParts[1]));
}
} catch (MalformedPIDException e) {
throw new IllegalArgumentException(
"Malformed object token: " + token, e);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(
"Malformed object or datastream token: " + token, e);
}
} } | public class class_name {
private static URI getBlobId(String token) {
try {
int i = token.indexOf('+');
if (i == -1) {
return new URI(new PID(token).toURI()); // depends on control dependency: [if], data = [none]
} else {
String[] dsParts = token.substring(i + 1).split("\\+");
if (dsParts.length != 2) {
throw new IllegalArgumentException(
"Malformed datastream token: " + token);
}
return new URI(Constants.FEDORA.uri
+ token.substring(0, i) + "/"
+ uriEncode(dsParts[0]) + "/"
+ uriEncode(dsParts[1])); // depends on control dependency: [if], data = [none]
}
} catch (MalformedPIDException e) {
throw new IllegalArgumentException(
"Malformed object token: " + token, e);
} catch (URISyntaxException e) { // depends on control dependency: [catch], data = [none]
throw new IllegalArgumentException(
"Malformed object or datastream token: " + token, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static void splitReciprocal(final double in[], final double result[]) {
final double b = 1.0/4194304.0;
final double a = 1.0 - b;
if (in[0] == 0.0) {
in[0] = in[1];
in[1] = 0.0;
}
result[0] = a / in[0];
result[1] = (b*in[0]-a*in[1]) / (in[0]*in[0] + in[0]*in[1]);
if (result[1] != result[1]) { // can happen if result[1] is NAN
result[1] = 0.0;
}
/* Resplit */
resplit(result);
for (int i = 0; i < 2; i++) {
/* this may be overkill, probably once is enough */
double err = 1.0 - result[0] * in[0] - result[0] * in[1] -
result[1] * in[0] - result[1] * in[1];
/*err = 1.0 - err; */
err = err * (result[0] + result[1]);
/*printf("err = %16e\n", err); */
result[1] += err;
}
} } | public class class_name {
static void splitReciprocal(final double in[], final double result[]) {
final double b = 1.0/4194304.0;
final double a = 1.0 - b;
if (in[0] == 0.0) {
in[0] = in[1]; // depends on control dependency: [if], data = [none]
in[1] = 0.0; // depends on control dependency: [if], data = [none]
}
result[0] = a / in[0];
result[1] = (b*in[0]-a*in[1]) / (in[0]*in[0] + in[0]*in[1]);
if (result[1] != result[1]) { // can happen if result[1] is NAN
result[1] = 0.0; // depends on control dependency: [if], data = [none]
}
/* Resplit */
resplit(result);
for (int i = 0; i < 2; i++) {
/* this may be overkill, probably once is enough */
double err = 1.0 - result[0] * in[0] - result[0] * in[1] -
result[1] * in[0] - result[1] * in[1];
/*err = 1.0 - err; */
err = err * (result[0] + result[1]); // depends on control dependency: [for], data = [none]
/*printf("err = %16e\n", err); */
result[1] += err; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@Override
public String getNameHtml() {
final SubmitterLink submitterLink = submitterLinkRenderer
.getGedObject();
if (!submitterLink.isSet()) {
return "";
}
final Submitter submitter =
(Submitter) submitterLink.find(submitterLink.getToString());
final GedRenderer<? extends GedObject> renderer =
new SimpleNameRenderer(submitter.getName(),
submitterLinkRenderer.getRendererFactory(),
submitterLinkRenderer.getRenderingContext());
final String nameHtml = renderer.getNameHtml();
return "<a class=\"name\" href=\"submitter?db="
+ submitterLink.getDbName() + "&id="
+ submitterLink.getToString() + "\">" + nameHtml
+ " [" + submitterLink.getToString() + "]" + "</a>";
} } | public class class_name {
@Override
public String getNameHtml() {
final SubmitterLink submitterLink = submitterLinkRenderer
.getGedObject();
if (!submitterLink.isSet()) {
return ""; // depends on control dependency: [if], data = [none]
}
final Submitter submitter =
(Submitter) submitterLink.find(submitterLink.getToString());
final GedRenderer<? extends GedObject> renderer =
new SimpleNameRenderer(submitter.getName(),
submitterLinkRenderer.getRendererFactory(),
submitterLinkRenderer.getRenderingContext());
final String nameHtml = renderer.getNameHtml();
return "<a class=\"name\" href=\"submitter?db="
+ submitterLink.getDbName() + "&id="
+ submitterLink.getToString() + "\">" + nameHtml
+ " [" + submitterLink.getToString() + "]" + "</a>";
} } |
public class class_name {
@Override
public void writeUTF(String value) {
// fix from issue #97
try {
byte[] strBuf = value.getBytes(AMF.CHARSET.name());
buffer.putShort((short) strBuf.length);
buffer.put(strBuf);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
} } | public class class_name {
@Override
public void writeUTF(String value) {
// fix from issue #97
try {
byte[] strBuf = value.getBytes(AMF.CHARSET.name());
buffer.putShort((short) strBuf.length);
// depends on control dependency: [try], data = [none]
buffer.put(strBuf);
// depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void maybeNotifyListeners(R oldValue, R newValue) {
if (!ValueUtils.areEqual(oldValue, newValue)) {
notifyListenersIfUninhibited(oldValue, newValue);
}
} } | public class class_name {
protected void maybeNotifyListeners(R oldValue, R newValue) {
if (!ValueUtils.areEqual(oldValue, newValue)) {
notifyListenersIfUninhibited(oldValue, newValue); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void writeCSVColumns(XYChart chart, String path2Dir) {
for (XYSeries xySeries : chart.getSeriesMap().values()) {
writeCSVColumns(xySeries, path2Dir);
}
} } | public class class_name {
public static void writeCSVColumns(XYChart chart, String path2Dir) {
for (XYSeries xySeries : chart.getSeriesMap().values()) {
writeCSVColumns(xySeries, path2Dir); // depends on control dependency: [for], data = [xySeries]
}
} } |
public class class_name {
public void withGeneratedName()
{
if (key.getAnnotation() != null) {
if (key.getAnnotation() instanceof Named) {
as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), ((Named) key.getAnnotation()).value()));
}
else {
as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotation().annotationType().getSimpleName()));
}
}
else if (key.getAnnotationType() != null) {
as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotationType().getSimpleName()));
}
else {
as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType()));
}
} } | public class class_name {
public void withGeneratedName()
{
if (key.getAnnotation() != null) {
if (key.getAnnotation() instanceof Named) {
as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), ((Named) key.getAnnotation()).value())); // depends on control dependency: [if], data = [none]
}
else {
as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotation().annotationType().getSimpleName())); // depends on control dependency: [if], data = [none]
}
}
else if (key.getAnnotationType() != null) {
as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotationType().getSimpleName())); // depends on control dependency: [if], data = [none]
}
else {
as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void completeMultipartUpload(WebContext ctx,
Bucket bucket,
String id,
final String uploadId,
InputStreamHandler in) {
if (!multipartUploads.remove(uploadId)) {
ctx.respondWith().error(HttpResponseStatus.NOT_FOUND, ERROR_MULTIPART_UPLOAD_DOES_NOT_EXIST);
return;
}
final Map<Integer, File> parts = new HashMap<>();
XMLReader reader = new XMLReader();
reader.addHandler("Part", part -> {
int number = part.queryValue("PartNumber").asInt(0);
parts.put(number, new File(getUploadDir(uploadId), String.valueOf(number)));
});
try {
reader.parse(in);
} catch (IOException e) {
Exceptions.handle(e);
}
File file = combineParts(id,
uploadId,
parts.entrySet()
.stream()
.sorted(Comparator.comparing(Map.Entry::getKey))
.map(Map.Entry::getValue)
.collect(Collectors.toList()));
file.deleteOnExit();
if (!file.exists()) {
ctx.respondWith().error(HttpResponseStatus.NOT_FOUND, "Multipart File does not exist");
return;
}
try {
StoredObject object = bucket.getObject(id);
Files.move(file, object.getFile());
delete(getUploadDir(uploadId));
String etag = Files.hash(object.getFile(), Hashing.md5()).toString();
XMLStructuredOutput out = ctx.respondWith().xml();
out.beginOutput("CompleteMultipartUploadResult");
out.property("Location", "");
out.property(RESPONSE_BUCKET, bucket.getName());
out.property("Key", id);
out.property(HTTP_HEADER_NAME_ETAG, etag);
out.endOutput();
} catch (IOException e) {
Exceptions.ignore(e);
ctx.respondWith().error(HttpResponseStatus.INTERNAL_SERVER_ERROR, "Could not build response");
}
} } | public class class_name {
private void completeMultipartUpload(WebContext ctx,
Bucket bucket,
String id,
final String uploadId,
InputStreamHandler in) {
if (!multipartUploads.remove(uploadId)) {
ctx.respondWith().error(HttpResponseStatus.NOT_FOUND, ERROR_MULTIPART_UPLOAD_DOES_NOT_EXIST); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final Map<Integer, File> parts = new HashMap<>();
XMLReader reader = new XMLReader();
reader.addHandler("Part", part -> {
int number = part.queryValue("PartNumber").asInt(0);
parts.put(number, new File(getUploadDir(uploadId), String.valueOf(number)));
});
try {
reader.parse(in);
} catch (IOException e) {
Exceptions.handle(e);
}
File file = combineParts(id,
uploadId,
parts.entrySet()
.stream()
.sorted(Comparator.comparing(Map.Entry::getKey))
.map(Map.Entry::getValue)
.collect(Collectors.toList()));
file.deleteOnExit();
if (!file.exists()) {
ctx.respondWith().error(HttpResponseStatus.NOT_FOUND, "Multipart File does not exist");
return;
}
try {
StoredObject object = bucket.getObject(id);
Files.move(file, object.getFile());
delete(getUploadDir(uploadId));
String etag = Files.hash(object.getFile(), Hashing.md5()).toString();
XMLStructuredOutput out = ctx.respondWith().xml();
out.beginOutput("CompleteMultipartUploadResult");
out.property("Location", "");
out.property(RESPONSE_BUCKET, bucket.getName());
out.property("Key", id);
out.property(HTTP_HEADER_NAME_ETAG, etag);
out.endOutput();
} catch (IOException e) {
Exceptions.ignore(e);
ctx.respondWith().error(HttpResponseStatus.INTERNAL_SERVER_ERROR, "Could not build response");
}
} } |
public class class_name {
public void setTapeArchives(java.util.Collection<TapeArchive> tapeArchives) {
if (tapeArchives == null) {
this.tapeArchives = null;
return;
}
this.tapeArchives = new com.amazonaws.internal.SdkInternalList<TapeArchive>(tapeArchives);
} } | public class class_name {
public void setTapeArchives(java.util.Collection<TapeArchive> tapeArchives) {
if (tapeArchives == null) {
this.tapeArchives = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.tapeArchives = new com.amazonaws.internal.SdkInternalList<TapeArchive>(tapeArchives);
} } |
public class class_name {
@Override
public int size()
{
if (indics != null)
{
return indics.size();
}
indics = new HashMap<Integer, Pair<Integer, Integer>>();
int size = 0;
TestSequence rtests = repeat.getTests();
int count = rtests.size();
for (int r = from; r <= to; r++)
{
if (r == 0)
{
indics.put(size, new Pair<Integer, Integer>(r, 0));
size++;
continue;
}
int[] c = new int[r];
for (int i = 0; i < r; i++)
{
c[i] = count;
}
Permutor p = new Permutor(c);
int j = 0;
while (p.hasNext())
{
j++;
p.next();
indics.put(size, new Pair<Integer, Integer>(r, j));
size++;
}
}
return size;
} } | public class class_name {
@Override
public int size()
{
if (indics != null)
{
return indics.size(); // depends on control dependency: [if], data = [none]
}
indics = new HashMap<Integer, Pair<Integer, Integer>>();
int size = 0;
TestSequence rtests = repeat.getTests();
int count = rtests.size();
for (int r = from; r <= to; r++)
{
if (r == 0)
{
indics.put(size, new Pair<Integer, Integer>(r, 0)); // depends on control dependency: [if], data = [(r]
size++; // depends on control dependency: [if], data = [none]
continue;
}
int[] c = new int[r];
for (int i = 0; i < r; i++)
{
c[i] = count; // depends on control dependency: [for], data = [i]
}
Permutor p = new Permutor(c);
int j = 0;
while (p.hasNext())
{
j++; // depends on control dependency: [while], data = [none]
p.next(); // depends on control dependency: [while], data = [none]
indics.put(size, new Pair<Integer, Integer>(r, j)); // depends on control dependency: [while], data = [none]
size++; // depends on control dependency: [while], data = [none]
}
}
return size;
} } |
public class class_name {
@Implementation(minSdk = N)
protected void setOrganizationName(ComponentName admin, @Nullable CharSequence name) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
enforceDeviceOwnerOrProfileOwner(admin);
} else {
enforceProfileOwner(admin);
}
if (TextUtils.isEmpty(name)) {
organizationName = null;
} else {
organizationName = name;
}
} } | public class class_name {
@Implementation(minSdk = N)
protected void setOrganizationName(ComponentName admin, @Nullable CharSequence name) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
enforceDeviceOwnerOrProfileOwner(admin); // depends on control dependency: [if], data = [none]
} else {
enforceProfileOwner(admin); // depends on control dependency: [if], data = [none]
}
if (TextUtils.isEmpty(name)) {
organizationName = null; // depends on control dependency: [if], data = [none]
} else {
organizationName = name; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean removeAll(Collection<?> collection) {
if (booleanTerms == null) {
return false;
}
return booleanTerms.removeAll(collection);
} } | public class class_name {
@Override
public boolean removeAll(Collection<?> collection) {
if (booleanTerms == null) {
return false;
// depends on control dependency: [if], data = [none]
}
return booleanTerms.removeAll(collection);
} } |
public class class_name {
protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
int pos = token.pos;
accept(INTERFACE);
Name name = ident();
List<JCTypeParameter> typarams = typeParametersOpt();
List<JCExpression> extending = List.nil();
if (token.kind == EXTENDS) {
nextToken();
extending = typeList();
}
List<JCTree> defs = classOrInterfaceBody(name, true);
JCClassDecl result = toP(F.at(pos).ClassDef(
mods, name, typarams, null, extending, defs));
attach(result, dc);
return result;
} } | public class class_name {
protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
int pos = token.pos;
accept(INTERFACE);
Name name = ident();
List<JCTypeParameter> typarams = typeParametersOpt();
List<JCExpression> extending = List.nil();
if (token.kind == EXTENDS) {
nextToken(); // depends on control dependency: [if], data = [none]
extending = typeList(); // depends on control dependency: [if], data = [none]
}
List<JCTree> defs = classOrInterfaceBody(name, true);
JCClassDecl result = toP(F.at(pos).ClassDef(
mods, name, typarams, null, extending, defs));
attach(result, dc);
return result;
} } |
public class class_name {
public void setParent( PlanNode parent ) {
removeFromParent();
if (parent != null) {
this.parent = parent;
this.parent.children.add(this);
}
} } | public class class_name {
public void setParent( PlanNode parent ) {
removeFromParent();
if (parent != null) {
this.parent = parent; // depends on control dependency: [if], data = [none]
this.parent.children.add(this); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected int addConics(List<AssociatedPairConic> points , DMatrixRMaj A, int rows ) {
if( exhaustiveConics ) {
// adds an exhaustive set of linear conics
for (int i = 0; i < points.size(); i++) {
for (int j = i+1; j < points.size(); j++) {
rows = addConicPairConstraints(points.get(i),points.get(j),A,rows);
}
}
} else {
// adds pairs and has linear time complexity
for (int i = 1; i < points.size(); i++) {
rows = addConicPairConstraints(points.get(i-1),points.get(i),A,rows);
}
int N = points.size();
rows = addConicPairConstraints(points.get(0),points.get(N-1),A,rows);
}
return rows;
} } | public class class_name {
protected int addConics(List<AssociatedPairConic> points , DMatrixRMaj A, int rows ) {
if( exhaustiveConics ) {
// adds an exhaustive set of linear conics
for (int i = 0; i < points.size(); i++) {
for (int j = i+1; j < points.size(); j++) {
rows = addConicPairConstraints(points.get(i),points.get(j),A,rows); // depends on control dependency: [for], data = [j]
}
}
} else {
// adds pairs and has linear time complexity
for (int i = 1; i < points.size(); i++) {
rows = addConicPairConstraints(points.get(i-1),points.get(i),A,rows); // depends on control dependency: [for], data = [i]
}
int N = points.size();
rows = addConicPairConstraints(points.get(0),points.get(N-1),A,rows); // depends on control dependency: [if], data = [none]
}
return rows;
} } |
public class class_name {
public void taskletFailed(final int taskletId, final Exception e) {
final boolean aggregateOnCount;
synchronized (stateLock) {
failedTasklets.add(new ImmutablePair<>(taskletId, e));
removePendingTaskletReferenceCount(taskletId);
aggregateOnCount = aggregateOnCount();
}
if (aggregateOnCount) {
aggregateTasklets(AggregateTriggerType.COUNT);
}
} } | public class class_name {
public void taskletFailed(final int taskletId, final Exception e) {
final boolean aggregateOnCount;
synchronized (stateLock) {
failedTasklets.add(new ImmutablePair<>(taskletId, e));
removePendingTaskletReferenceCount(taskletId);
aggregateOnCount = aggregateOnCount();
}
if (aggregateOnCount) {
aggregateTasklets(AggregateTriggerType.COUNT); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Nonnull
public static char [] decodeBytesToChars (@Nonnull final byte [] aByteArray,
@Nonnegative final int nOfs,
@Nonnegative final int nLen,
@Nonnull final Charset aCharset)
{
final CharsetDecoder aDecoder = aCharset.newDecoder ();
final int nDecodedLen = (int) (nLen * (double) aDecoder.maxCharsPerByte ());
final char [] aCharArray = new char [nDecodedLen];
if (nLen == 0)
return aCharArray;
aDecoder.onMalformedInput (CodingErrorAction.REPLACE).onUnmappableCharacter (CodingErrorAction.REPLACE).reset ();
final ByteBuffer aSrcBuf = ByteBuffer.wrap (aByteArray, nOfs, nLen);
final CharBuffer aDstBuf = CharBuffer.wrap (aCharArray);
try
{
CoderResult aRes = aDecoder.decode (aSrcBuf, aDstBuf, true);
if (!aRes.isUnderflow ())
aRes.throwException ();
aRes = aDecoder.flush (aDstBuf);
if (!aRes.isUnderflow ())
aRes.throwException ();
}
catch (final CharacterCodingException x)
{
// Substitution is always enabled,
// so this shouldn't happen
throw new IllegalStateException (x);
}
final int nDstLen = aDstBuf.position ();
if (nDstLen == aCharArray.length)
return aCharArray;
return Arrays.copyOf (aCharArray, nDstLen);
} } | public class class_name {
@Nonnull
public static char [] decodeBytesToChars (@Nonnull final byte [] aByteArray,
@Nonnegative final int nOfs,
@Nonnegative final int nLen,
@Nonnull final Charset aCharset)
{
final CharsetDecoder aDecoder = aCharset.newDecoder ();
final int nDecodedLen = (int) (nLen * (double) aDecoder.maxCharsPerByte ());
final char [] aCharArray = new char [nDecodedLen];
if (nLen == 0)
return aCharArray;
aDecoder.onMalformedInput (CodingErrorAction.REPLACE).onUnmappableCharacter (CodingErrorAction.REPLACE).reset ();
final ByteBuffer aSrcBuf = ByteBuffer.wrap (aByteArray, nOfs, nLen);
final CharBuffer aDstBuf = CharBuffer.wrap (aCharArray);
try
{
CoderResult aRes = aDecoder.decode (aSrcBuf, aDstBuf, true);
if (!aRes.isUnderflow ())
aRes.throwException ();
aRes = aDecoder.flush (aDstBuf); // depends on control dependency: [try], data = [none]
if (!aRes.isUnderflow ())
aRes.throwException ();
}
catch (final CharacterCodingException x)
{
// Substitution is always enabled,
// so this shouldn't happen
throw new IllegalStateException (x);
} // depends on control dependency: [catch], data = [none]
final int nDstLen = aDstBuf.position ();
if (nDstLen == aCharArray.length)
return aCharArray;
return Arrays.copyOf (aCharArray, nDstLen);
} } |
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");
}
processAudioStbl(stbl, scale);
} } | 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");
}
processAudioStbl(stbl, scale);
} } |
public class class_name {
public void marshall(DeviceType deviceType, ProtocolMarshaller protocolMarshaller) {
if (deviceType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deviceType.getDeviceKey(), DEVICEKEY_BINDING);
protocolMarshaller.marshall(deviceType.getDeviceAttributes(), DEVICEATTRIBUTES_BINDING);
protocolMarshaller.marshall(deviceType.getDeviceCreateDate(), DEVICECREATEDATE_BINDING);
protocolMarshaller.marshall(deviceType.getDeviceLastModifiedDate(), DEVICELASTMODIFIEDDATE_BINDING);
protocolMarshaller.marshall(deviceType.getDeviceLastAuthenticatedDate(), DEVICELASTAUTHENTICATEDDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeviceType deviceType, ProtocolMarshaller protocolMarshaller) {
if (deviceType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deviceType.getDeviceKey(), DEVICEKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceType.getDeviceAttributes(), DEVICEATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceType.getDeviceCreateDate(), DEVICECREATEDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceType.getDeviceLastModifiedDate(), DEVICELASTMODIFIEDDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceType.getDeviceLastAuthenticatedDate(), DEVICELASTAUTHENTICATEDDATE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setRequestTime(long requestTime) {
checkFrozen();
if (requestTime == CURRENT_TIME) {
m_requestTime = System.currentTimeMillis();
} else {
m_requestTime = requestTime;
}
} } | public class class_name {
public void setRequestTime(long requestTime) {
checkFrozen();
if (requestTime == CURRENT_TIME) {
m_requestTime = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
} else {
m_requestTime = requestTime; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void initialize(InputStream configuration) throws IOException
{
SynonymMap sm = null;
try
{
sm = new SynonymMap(configuration);
}
catch (IOException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
SYNONYM_MAP = sm;
} } | public class class_name {
public void initialize(InputStream configuration) throws IOException
{
SynonymMap sm = null;
try
{
sm = new SynonymMap(configuration);
}
catch (IOException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage()); // depends on control dependency: [if], data = [none]
}
}
SYNONYM_MAP = sm;
} } |
public class class_name {
public ISLgSessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
if (clazz.equals(ClientSLgSession.class)) {
ClientSLgSessionDataReplicatedImpl data = new ClientSLgSessionDataReplicatedImpl(sessionId, this.mobicentsCluster,
this.replicatedSessionDataSource.getContainer());
return data;
} else if (clazz.equals(ServerSLgSession.class)) {
ServerSLgSessionDataReplicatedImpl data = new ServerSLgSessionDataReplicatedImpl(sessionId, this.mobicentsCluster,
this.replicatedSessionDataSource.getContainer());
return data;
}
throw new IllegalArgumentException();
} } | public class class_name {
public ISLgSessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
if (clazz.equals(ClientSLgSession.class)) {
ClientSLgSessionDataReplicatedImpl data = new ClientSLgSessionDataReplicatedImpl(sessionId, this.mobicentsCluster,
this.replicatedSessionDataSource.getContainer());
return data; // depends on control dependency: [if], data = [none]
} else if (clazz.equals(ServerSLgSession.class)) {
ServerSLgSessionDataReplicatedImpl data = new ServerSLgSessionDataReplicatedImpl(sessionId, this.mobicentsCluster,
this.replicatedSessionDataSource.getContainer());
return data; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException();
} } |
public class class_name {
public static boolean isIconicsAnimateChanges(@NonNull Context context,
@Nullable AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IconicsAnimateChanges, 0, 0);
try {
return a.getBoolean(R.styleable.IconicsAnimateChanges_iiv_animate_icon_changes, true);
} finally {
a.recycle();
}
} } | public class class_name {
public static boolean isIconicsAnimateChanges(@NonNull Context context,
@Nullable AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IconicsAnimateChanges, 0, 0);
try {
return a.getBoolean(R.styleable.IconicsAnimateChanges_iiv_animate_icon_changes, true); // depends on control dependency: [try], data = [none]
} finally {
a.recycle();
}
} } |
public class class_name {
public static void callPreDestroyMethod(final Object instance)
{
if (instance == null)
throw new IllegalArgumentException();
final Collection<Method> methods = PRE_DESTROY_METHOD_FINDER.process(instance.getClass());
if (methods.size() > 0)
{
final Method method = methods.iterator().next();
try
{
invokeMethod(instance, method, null);
}
catch (Exception e)
{
final String message = "Calling of @PreDestroy annotated method failed: " + method;
InjectionException.rethrow(message, e);
}
}
} } | public class class_name {
public static void callPreDestroyMethod(final Object instance)
{
if (instance == null)
throw new IllegalArgumentException();
final Collection<Method> methods = PRE_DESTROY_METHOD_FINDER.process(instance.getClass());
if (methods.size() > 0)
{
final Method method = methods.iterator().next();
try
{
invokeMethod(instance, method, null); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
final String message = "Calling of @PreDestroy annotated method failed: " + method;
InjectionException.rethrow(message, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void setGateways(java.util.Collection<GatewayInfo> gateways) {
if (gateways == null) {
this.gateways = null;
return;
}
this.gateways = new com.amazonaws.internal.SdkInternalList<GatewayInfo>(gateways);
} } | public class class_name {
public void setGateways(java.util.Collection<GatewayInfo> gateways) {
if (gateways == null) {
this.gateways = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.gateways = new com.amazonaws.internal.SdkInternalList<GatewayInfo>(gateways);
} } |
public class class_name {
public void clean()
{
ChronoFullRevision cfr = firstCFR;
totalSize = size;
while (cfr != null) {
totalSize += cfr.size();
cfr = cfr.getNext();
}
if (totalSize < MAX_STORAGE_SIZE) {
return;
}
cfr = firstCFR;
while (cfr != null) {
totalSize += cfr.clean(revisionIndex, 0);
cfr = cfr.getNext();
}
ChronoStorageBlock block;
while (last != null && totalSize >= MAX_STORAGE_SIZE) {
// System.out.println("CLEAN " + last.getRevisionIndex());
// Retrieve previous block
block = last.getIndexPrev();
// Subtract size
if (storage.remove(last.getRevisionIndex()) == null) {
throw new RuntimeException("VALUE WAS NOT REMOVED FROM STORAGE");
}
totalSize -= last.length();
size += last.length();
// Delete references
if (block != null) {
block.setIndexNext(null);
}
last.setIndexPrev(null);
cfr = last.getChronoFullRevision();
totalSize += cfr.size()
- cfr.clean(revisionIndex, last.getRevisionIndex());
if (last == first) {
first = null;
}
// Set the new last
last = block;
}
} } | public class class_name {
public void clean()
{
ChronoFullRevision cfr = firstCFR;
totalSize = size;
while (cfr != null) {
totalSize += cfr.size(); // depends on control dependency: [while], data = [none]
cfr = cfr.getNext(); // depends on control dependency: [while], data = [none]
}
if (totalSize < MAX_STORAGE_SIZE) {
return; // depends on control dependency: [if], data = [none]
}
cfr = firstCFR;
while (cfr != null) {
totalSize += cfr.clean(revisionIndex, 0); // depends on control dependency: [while], data = [none]
cfr = cfr.getNext(); // depends on control dependency: [while], data = [none]
}
ChronoStorageBlock block;
while (last != null && totalSize >= MAX_STORAGE_SIZE) {
// System.out.println("CLEAN " + last.getRevisionIndex());
// Retrieve previous block
block = last.getIndexPrev(); // depends on control dependency: [while], data = [none]
// Subtract size
if (storage.remove(last.getRevisionIndex()) == null) {
throw new RuntimeException("VALUE WAS NOT REMOVED FROM STORAGE");
}
totalSize -= last.length(); // depends on control dependency: [while], data = [none]
size += last.length(); // depends on control dependency: [while], data = [none]
// Delete references
if (block != null) {
block.setIndexNext(null); // depends on control dependency: [if], data = [null)]
}
last.setIndexPrev(null); // depends on control dependency: [while], data = [none]
cfr = last.getChronoFullRevision(); // depends on control dependency: [while], data = [none]
totalSize += cfr.size()
- cfr.clean(revisionIndex, last.getRevisionIndex()); // depends on control dependency: [while], data = [none]
if (last == first) {
first = null; // depends on control dependency: [if], data = [none]
}
// Set the new last
last = block; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private void nextFromPrologBang(boolean isProlog)
throws XMLStreamException
{
int i = getNext();
if (i < 0) {
throwUnexpectedEOF(SUFFIX_IN_PROLOG);
}
if (i == 'D') { // Doctype declaration?
String keyw = checkKeyword('D', "DOCTYPE");
if (keyw != null) {
throwParseError("Unrecognized XML directive '<!"+keyw+"' (misspelled DOCTYPE?).");
}
if (!isProlog) {
// Still possibly ok in multidoc mode...
if (mConfig.inputParsingModeDocuments()) {
if (!mStDoctypeFound) {
mCurrToken = handleMultiDocStart(DTD);
return;
}
} else {
throwParseError(ErrorConsts.ERR_DTD_IN_EPILOG);
}
}
if (mStDoctypeFound) {
throwParseError(ErrorConsts.ERR_DTD_DUP);
}
mStDoctypeFound = true;
// Ok; let's read main input (all but internal subset)
mCurrToken = DTD;
startDTD();
return;
} else if (i == '-') { // comment
char c = getNextChar(isProlog ? SUFFIX_IN_PROLOG : SUFFIX_IN_EPILOG);
if (c != '-') {
throwUnexpectedChar(i, " (malformed comment?)");
}
// Likewise, let's delay actual parsing/skipping.
mTokenState = TOKEN_STARTED;
mCurrToken = COMMENT;
return;
} else if (i == '[') { // erroneous CDATA?
i = peekNext();
// Let's just add bit of heuristics, to get better error msg
if (i == 'C') {
throwUnexpectedChar(i, ErrorConsts.ERR_CDATA_IN_EPILOG);
}
}
throwUnexpectedChar(i, " after '<!' (malformed comment?)");
} } | public class class_name {
private void nextFromPrologBang(boolean isProlog)
throws XMLStreamException
{
int i = getNext();
if (i < 0) {
throwUnexpectedEOF(SUFFIX_IN_PROLOG);
}
if (i == 'D') { // Doctype declaration?
String keyw = checkKeyword('D', "DOCTYPE");
if (keyw != null) {
throwParseError("Unrecognized XML directive '<!"+keyw+"' (misspelled DOCTYPE?)."); // depends on control dependency: [if], data = [none]
}
if (!isProlog) {
// Still possibly ok in multidoc mode...
if (mConfig.inputParsingModeDocuments()) {
if (!mStDoctypeFound) {
mCurrToken = handleMultiDocStart(DTD); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
} else {
throwParseError(ErrorConsts.ERR_DTD_IN_EPILOG); // depends on control dependency: [if], data = [none]
}
}
if (mStDoctypeFound) {
throwParseError(ErrorConsts.ERR_DTD_DUP); // depends on control dependency: [if], data = [none]
}
mStDoctypeFound = true;
// Ok; let's read main input (all but internal subset)
mCurrToken = DTD;
startDTD();
return;
} else if (i == '-') { // comment
char c = getNextChar(isProlog ? SUFFIX_IN_PROLOG : SUFFIX_IN_EPILOG);
if (c != '-') {
throwUnexpectedChar(i, " (malformed comment?)");
}
// Likewise, let's delay actual parsing/skipping.
mTokenState = TOKEN_STARTED;
mCurrToken = COMMENT;
return;
} else if (i == '[') { // erroneous CDATA?
i = peekNext();
// Let's just add bit of heuristics, to get better error msg
if (i == 'C') {
throwUnexpectedChar(i, ErrorConsts.ERR_CDATA_IN_EPILOG); // depends on control dependency: [if], data = [(i]
}
}
throwUnexpectedChar(i, " after '<!' (malformed comment?)");
} } |
public class class_name {
public void marshall(ListTaskExecutionsRequest listTaskExecutionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listTaskExecutionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTaskExecutionsRequest.getTaskArn(), TASKARN_BINDING);
protocolMarshaller.marshall(listTaskExecutionsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listTaskExecutionsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListTaskExecutionsRequest listTaskExecutionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listTaskExecutionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTaskExecutionsRequest.getTaskArn(), TASKARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listTaskExecutionsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listTaskExecutionsRequest.getNextToken(), NEXTTOKEN_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 synchronized Image loadImage(InputStream stream) throws IOException {
Toolkit toolkit = Toolkit.getDefaultToolkit();
byte data[] = FileCopyUtils.copyToByteArray(stream);
Image image = toolkit.createImage(data);
imageLoaded = false;
imageError = false;
// fully loads the image into memory
toolkit.prepareImage(image, -1, -1, this);
while (!imageLoaded && !imageError) {
try {
wait();
}
catch (InterruptedException ex) {
}
}
if (imageError) {
throw new IOException("Error preparing image from resource.");
}
return image;
} } | public class class_name {
private synchronized Image loadImage(InputStream stream) throws IOException {
Toolkit toolkit = Toolkit.getDefaultToolkit();
byte data[] = FileCopyUtils.copyToByteArray(stream);
Image image = toolkit.createImage(data);
imageLoaded = false;
imageError = false;
// fully loads the image into memory
toolkit.prepareImage(image, -1, -1, this);
while (!imageLoaded && !imageError) {
try {
wait(); // depends on control dependency: [try], data = [none]
}
catch (InterruptedException ex) {
} // depends on control dependency: [catch], data = [none]
}
if (imageError) {
throw new IOException("Error preparing image from resource.");
}
return image;
} } |
public class class_name {
public static String time2StringLocal(Date date) {
String ret;
try {
ret = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault()).format(date);
} catch (Exception e) {
throw new InvalidArgumentException(date.toString());
}
return ret;
} } | public class class_name {
public static String time2StringLocal(Date date) {
String ret;
try {
ret = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault()).format(date); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new InvalidArgumentException(date.toString());
} // depends on control dependency: [catch], data = [none]
return ret;
} } |
public class class_name {
public void write(Writer writer, String enclosingNamespace) throws IOException {
for (CharSequence csq : sb.getAsList()) {
if (csq instanceof XmlStringBuilder) {
((XmlStringBuilder) csq).write(writer, enclosingNamespace);
}
else if (csq instanceof XmlNsAttribute) {
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
writer.write(xmlNsAttribute.toString());
enclosingNamespace = xmlNsAttribute.value;
}
}
else {
writer.write(csq.toString());
}
}
} } | public class class_name {
public void write(Writer writer, String enclosingNamespace) throws IOException {
for (CharSequence csq : sb.getAsList()) {
if (csq instanceof XmlStringBuilder) {
((XmlStringBuilder) csq).write(writer, enclosingNamespace);
}
else if (csq instanceof XmlNsAttribute) {
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
writer.write(xmlNsAttribute.toString()); // depends on control dependency: [if], data = [none]
enclosingNamespace = xmlNsAttribute.value; // depends on control dependency: [if], data = [none]
}
}
else {
writer.write(csq.toString());
}
}
} } |
public class class_name {
private void addSharingProfiles(Collection<SharingProfile> sharingProfiles)
throws GuacamoleException {
// Add each sharing profile to the tree
for (SharingProfile sharingProfile : sharingProfiles) {
// Retrieve the sharing profile's associated connection
String primaryConnectionIdentifier = sharingProfile.getPrimaryConnectionIdentifier();
APIConnection primaryConnection = retrievedConnections.get(primaryConnectionIdentifier);
// Add the sharing profile as a child of the primary connection
if (primaryConnection != null) {
Collection<APISharingProfile> children = primaryConnection.getSharingProfiles();
// Create child collection if it does not yet exist
if (children == null) {
children = new ArrayList<APISharingProfile>();
primaryConnection.setSharingProfiles(children);
}
// Add child
children.add(new APISharingProfile(sharingProfile));
}
// Warn of internal consistency issues
else
logger.debug("Sharing profile \"{}\" cannot be added to the "
+ "tree: primary connection \"{}\" does not actually "
+ "exist.", sharingProfile.getIdentifier(),
primaryConnectionIdentifier);
} // end for each sharing profile
} } | public class class_name {
private void addSharingProfiles(Collection<SharingProfile> sharingProfiles)
throws GuacamoleException {
// Add each sharing profile to the tree
for (SharingProfile sharingProfile : sharingProfiles) {
// Retrieve the sharing profile's associated connection
String primaryConnectionIdentifier = sharingProfile.getPrimaryConnectionIdentifier();
APIConnection primaryConnection = retrievedConnections.get(primaryConnectionIdentifier);
// Add the sharing profile as a child of the primary connection
if (primaryConnection != null) {
Collection<APISharingProfile> children = primaryConnection.getSharingProfiles();
// Create child collection if it does not yet exist
if (children == null) {
children = new ArrayList<APISharingProfile>(); // depends on control dependency: [if], data = [none]
primaryConnection.setSharingProfiles(children); // depends on control dependency: [if], data = [(children]
}
// Add child
children.add(new APISharingProfile(sharingProfile)); // depends on control dependency: [if], data = [none]
}
// Warn of internal consistency issues
else
logger.debug("Sharing profile \"{}\" cannot be added to the "
+ "tree: primary connection \"{}\" does not actually "
+ "exist.", sharingProfile.getIdentifier(),
primaryConnectionIdentifier);
} // end for each sharing profile
} } |
public class class_name {
private static List<String> getExcludedForResource(final String sitePath, final List<String> excluded) {
List<String> result = new ArrayList<String>();
for (String exclude : excluded) {
if (CmsStringUtil.isPrefixPath(sitePath, exclude)) {
result.add(exclude);
}
}
return result;
} } | public class class_name {
private static List<String> getExcludedForResource(final String sitePath, final List<String> excluded) {
List<String> result = new ArrayList<String>();
for (String exclude : excluded) {
if (CmsStringUtil.isPrefixPath(sitePath, exclude)) {
result.add(exclude); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public long getLastLoggedZxid() {
File[] files = getLogFiles(logDir.listFiles(), 0);
long maxLog=files.length>0?
Util.getZxidFromName(files[files.length-1].getName(),"log"):-1;
// if a log file is more recent we must scan it to find
// the highest zxid
long zxid = maxLog;
try {
FileTxnLog txn = new FileTxnLog(logDir);
TxnIterator itr = txn.read(maxLog);
while (true) {
if(!itr.next())
break;
TxnHeader hdr = itr.getHeader();
zxid = hdr.getZxid();
}
} catch (IOException e) {
LOG.warn("Unexpected exception", e);
}
return zxid;
} } | public class class_name {
public long getLastLoggedZxid() {
File[] files = getLogFiles(logDir.listFiles(), 0);
long maxLog=files.length>0?
Util.getZxidFromName(files[files.length-1].getName(),"log"):-1;
// if a log file is more recent we must scan it to find
// the highest zxid
long zxid = maxLog;
try {
FileTxnLog txn = new FileTxnLog(logDir);
TxnIterator itr = txn.read(maxLog);
while (true) {
if(!itr.next())
break;
TxnHeader hdr = itr.getHeader();
zxid = hdr.getZxid(); // depends on control dependency: [while], data = [none]
}
} catch (IOException e) {
LOG.warn("Unexpected exception", e);
} // depends on control dependency: [catch], data = [none]
return zxid;
} } |
public class class_name {
private byte[] berEncodedValue() {
final byte[] cookieSize = NumberFacility.leftTrim(NumberFacility.getBytes(cookie.length));
final byte[] size = NumberFacility.leftTrim(NumberFacility.getBytes(14 + cookieSize.length + cookie.length));
final ByteBuffer buff = ByteBuffer.allocate(1 + 1 + size.length + 14 + cookieSize.length + cookie.length);
buff.put((byte) 0x30); // (Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
buff.put((byte) (size.length == 1 ? 0x81 : size.length == 2 ? 0x82 : 0x83)); // size type (short or long form)
buff.put(size); // sequence size
buff.put((byte) 0x02); // 4bytes int tag
buff.put((byte) 0x04); // int size
buff.putInt(flags); // flags
buff.put((byte) 0x02); // 4bytes int tag
buff.put((byte) 0x04); // int size
buff.putInt(Integer.MAX_VALUE); // max attribute count
buff.put((byte) 0x04); // byte array tag
buff.put((byte) (cookieSize.length == 1 ? 0x81 : cookieSize.length == 2 ? 0x82 : 0x83)); // short or long form
buff.put(cookieSize); // byte array size
if (cookie.length > 0) {
buff.put(cookie); // (cookie, Ber.ASN_OCTET_STR);
}
return buff.array();
} } | public class class_name {
private byte[] berEncodedValue() {
final byte[] cookieSize = NumberFacility.leftTrim(NumberFacility.getBytes(cookie.length));
final byte[] size = NumberFacility.leftTrim(NumberFacility.getBytes(14 + cookieSize.length + cookie.length));
final ByteBuffer buff = ByteBuffer.allocate(1 + 1 + size.length + 14 + cookieSize.length + cookie.length);
buff.put((byte) 0x30); // (Ber.ASN_SEQUENCE | Ber.ASN_CONSTRUCTOR);
buff.put((byte) (size.length == 1 ? 0x81 : size.length == 2 ? 0x82 : 0x83)); // size type (short or long form)
buff.put(size); // sequence size
buff.put((byte) 0x02); // 4bytes int tag
buff.put((byte) 0x04); // int size
buff.putInt(flags); // flags
buff.put((byte) 0x02); // 4bytes int tag
buff.put((byte) 0x04); // int size
buff.putInt(Integer.MAX_VALUE); // max attribute count
buff.put((byte) 0x04); // byte array tag
buff.put((byte) (cookieSize.length == 1 ? 0x81 : cookieSize.length == 2 ? 0x82 : 0x83)); // short or long form
buff.put(cookieSize); // byte array size
if (cookie.length > 0) {
buff.put(cookie); // (cookie, Ber.ASN_OCTET_STR); // depends on control dependency: [if], data = [none]
}
return buff.array();
} } |
public class class_name {
private void processUsers(ConfigurationAdmin configAdmin,
String roleName,
Dictionary<String, Object> roleProps, Set<String> pids) {
String[] userPids = (String[]) roleProps.get(CFG_KEY_USER);
if (userPids == null || userPids.length == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No users in role " + roleName);
}
} else {
Set<String> badUsers = new HashSet<String>();
Set<String> badAccessIds = new HashSet<String>();
for (int i = 0; i < userPids.length; i++) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "user pid " + i + ": " + userPids[i]);
}
pids.add(userPids[i]);
Configuration userConfig = null;
try {
userConfig = configAdmin.getConfiguration(userPids[i], bundleLocation);
} catch (IOException ioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid user entry " + userPids[i]);
}
continue;
}
if (userConfig == null || userConfig.getProperties() == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Null user element", userPids[i]);
}
continue;
}
Dictionary<String, Object> userProps = userConfig.getProperties();
final String name = (String) userProps.get("name");
final String accessId = (String) userProps.get("access-id");
if (name == null || name.trim().isEmpty()) {
continue;
}
if (accessId != null && AccessIdUtil.isUserAccessId(accessId)) {
if (badAccessIds.contains(accessId)) {
// This accessId is already flagged as a duplicate
continue;
}
if (!accessIds.add(accessId)) {
Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_ACCESSID, accessId);
badAccessIds.add(accessId);
accessIds.remove(accessId);
}
} else {
// TODO: check for bad access id
if (badUsers.contains(name)) {
// This user is already flagged as a duplicate
continue;
}
if (name.trim().isEmpty()) {
// Empty entry, ignoring
continue;
}
if (!users.add(name)) {
Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_USER, name);
badUsers.add(name);
users.remove(name);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Role " + roleName + " has users:", users);
}
}
} } | public class class_name {
private void processUsers(ConfigurationAdmin configAdmin,
String roleName,
Dictionary<String, Object> roleProps, Set<String> pids) {
String[] userPids = (String[]) roleProps.get(CFG_KEY_USER);
if (userPids == null || userPids.length == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No users in role " + roleName); // depends on control dependency: [if], data = [none]
}
} else {
Set<String> badUsers = new HashSet<String>();
Set<String> badAccessIds = new HashSet<String>();
for (int i = 0; i < userPids.length; i++) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "user pid " + i + ": " + userPids[i]); // depends on control dependency: [if], data = [none]
}
pids.add(userPids[i]); // depends on control dependency: [for], data = [i]
Configuration userConfig = null;
try {
userConfig = configAdmin.getConfiguration(userPids[i], bundleLocation); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid user entry " + userPids[i]); // depends on control dependency: [if], data = [none]
}
continue;
} // depends on control dependency: [catch], data = [none]
if (userConfig == null || userConfig.getProperties() == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Null user element", userPids[i]); // depends on control dependency: [if], data = [none]
}
continue;
}
Dictionary<String, Object> userProps = userConfig.getProperties();
final String name = (String) userProps.get("name");
final String accessId = (String) userProps.get("access-id");
if (name == null || name.trim().isEmpty()) {
continue;
}
if (accessId != null && AccessIdUtil.isUserAccessId(accessId)) {
if (badAccessIds.contains(accessId)) {
// This accessId is already flagged as a duplicate
continue;
}
if (!accessIds.add(accessId)) {
Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_ACCESSID, accessId); // depends on control dependency: [if], data = [none]
badAccessIds.add(accessId); // depends on control dependency: [if], data = [none]
accessIds.remove(accessId); // depends on control dependency: [if], data = [none]
}
} else {
// TODO: check for bad access id
if (badUsers.contains(name)) {
// This user is already flagged as a duplicate
continue;
}
if (name.trim().isEmpty()) {
// Empty entry, ignoring
continue;
}
if (!users.add(name)) {
Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_USER, name); // depends on control dependency: [if], data = [none]
badUsers.add(name); // depends on control dependency: [if], data = [none]
users.remove(name); // depends on control dependency: [if], data = [none]
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Role " + roleName + " has users:", users); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void run() {
manageStyleSheetReloading(this.application.scene());
// Attach the first view and run pre and post command
try {
bootUp();
} catch (final JRebirthThreadException e) {
LOGGER.error(BOOT_UP_ERROR, e);
}
// JRebirth thread has boot up and is ready to process events
this.hasStarted.set(true);
while (this.infiniteLoop.get()) {
try {
if (!this.forceClose.get()) {
final JRebirthRunnable jrr = this.processingTasks.poll(100, TimeUnit.MILLISECONDS);
if (jrr != null) {
jrr.run();
}
}
} catch (final InterruptedException e) {
LOGGER.error(JIT_ERROR, e);
}
}
// Shutdown the application more properly
shutdown();
} } | public class class_name {
@Override
public void run() {
manageStyleSheetReloading(this.application.scene());
// Attach the first view and run pre and post command
try {
bootUp(); // depends on control dependency: [try], data = [none]
} catch (final JRebirthThreadException e) {
LOGGER.error(BOOT_UP_ERROR, e);
} // depends on control dependency: [catch], data = [none]
// JRebirth thread has boot up and is ready to process events
this.hasStarted.set(true);
while (this.infiniteLoop.get()) {
try {
if (!this.forceClose.get()) {
final JRebirthRunnable jrr = this.processingTasks.poll(100, TimeUnit.MILLISECONDS);
if (jrr != null) {
jrr.run(); // depends on control dependency: [if], data = [none]
}
}
} catch (final InterruptedException e) {
LOGGER.error(JIT_ERROR, e);
} // depends on control dependency: [catch], data = [none]
}
// Shutdown the application more properly
shutdown();
} } |
public class class_name {
private static int interpolate(
double y_minus, // = f(-1)
double y_0, // = f(0)
double y_plus, // = f(+1)
double[] result // xe, ye, root1, root2
) {
double a = 0.5 * (y_plus + y_minus) - y_0;
double b = 0.5 * (y_plus - y_minus);
double xe = -b / (2.0 * a);
double ye = (a * xe + b) * xe + y_0;
double dis = b * b - 4 * a * y_0;
double root1 = Double.NaN;
double root2 = Double.NaN;
int count = 0;
if (dis >= 0) {
double dx = 0.5 * Math.sqrt(dis) / Math.abs(a);
if (Math.abs(xe - dx) <= 1.0) {
root1 = xe - dx;
count++;
}
if (Math.abs(xe + dx) <= 1.0) {
root2 = xe + dx;
count++;
}
}
result[0] = xe;
result[1] = ye;
result[2] = root1;
result[3] = root2;
return count;
} } | public class class_name {
private static int interpolate(
double y_minus, // = f(-1)
double y_0, // = f(0)
double y_plus, // = f(+1)
double[] result // xe, ye, root1, root2
) {
double a = 0.5 * (y_plus + y_minus) - y_0;
double b = 0.5 * (y_plus - y_minus);
double xe = -b / (2.0 * a);
double ye = (a * xe + b) * xe + y_0;
double dis = b * b - 4 * a * y_0;
double root1 = Double.NaN;
double root2 = Double.NaN;
int count = 0;
if (dis >= 0) {
double dx = 0.5 * Math.sqrt(dis) / Math.abs(a);
if (Math.abs(xe - dx) <= 1.0) {
root1 = xe - dx; // depends on control dependency: [if], data = [none]
count++; // depends on control dependency: [if], data = [none]
}
if (Math.abs(xe + dx) <= 1.0) {
root2 = xe + dx; // depends on control dependency: [if], data = [none]
count++; // depends on control dependency: [if], data = [none]
}
}
result[0] = xe;
result[1] = ye;
result[2] = root1;
result[3] = root2;
return count;
} } |
public class class_name {
public static Connection close(Connection conn, Logger logExceptionTo, Object name)
{
if(conn == null)
return null;
try
{
conn.close();
}
catch(SQLException e)
{
(logExceptionTo==null ? logger : logExceptionTo).warn("SQLException closing " + (name == null ? conn.toString() : name) + " ignored.", e);
}
return null;
} } | public class class_name {
public static Connection close(Connection conn, Logger logExceptionTo, Object name)
{
if(conn == null)
return null;
try
{
conn.close(); // depends on control dependency: [try], data = [none]
}
catch(SQLException e)
{
(logExceptionTo==null ? logger : logExceptionTo).warn("SQLException closing " + (name == null ? conn.toString() : name) + " ignored.", e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public void start() {
originalClassLoader = Thread.currentThread().getContextClassLoader();
if (!keep || hotdeployClassLoader == null) {
hotdeployClassLoader = new HotdeployClassLoader(originalClassLoader, namingConvention);
}
Thread.currentThread().setContextClassLoader(hotdeployClassLoader);
LaContainer container = SingletonLaContainerFactory.getContainer();
container.setClassLoader(hotdeployClassLoader);
} } | public class class_name {
public void start() {
originalClassLoader = Thread.currentThread().getContextClassLoader();
if (!keep || hotdeployClassLoader == null) {
hotdeployClassLoader = new HotdeployClassLoader(originalClassLoader, namingConvention); // depends on control dependency: [if], data = [none]
}
Thread.currentThread().setContextClassLoader(hotdeployClassLoader);
LaContainer container = SingletonLaContainerFactory.getContainer();
container.setClassLoader(hotdeployClassLoader);
} } |
public class class_name {
private boolean isMethodAlreadyDefined(M2MEntity entity, final String methodName) {
final One<Boolean> found = new One<Boolean>(false);
SqlBuilderHelper.forEachMethods(entity.daoElement, new MethodFoundListener() {
@Override
public void onMethod(ExecutableElement executableMethod) {
if (executableMethod.getSimpleName().toString().equals(methodName)) {
found.value0 = true;
}
}
});
return found.value0;
} } | public class class_name {
private boolean isMethodAlreadyDefined(M2MEntity entity, final String methodName) {
final One<Boolean> found = new One<Boolean>(false);
SqlBuilderHelper.forEachMethods(entity.daoElement, new MethodFoundListener() {
@Override
public void onMethod(ExecutableElement executableMethod) {
if (executableMethod.getSimpleName().toString().equals(methodName)) {
found.value0 = true; // depends on control dependency: [if], data = [none]
}
}
});
return found.value0;
} } |
public class class_name {
public static Set<BeanDefinitionHolder> registerAnnotationConfigProcessors(
BeanDefinitionRegistry registry, Object source, ReleaseId releaseId) {
Set<BeanDefinitionHolder> beanDefs = new LinkedHashSet<BeanDefinitionHolder>(1);
if (!registry.containsBeanDefinition(KIE_ANNOTATION_PROCESSOR_CLASS_NAME)) {
RootBeanDefinition def = new RootBeanDefinition(AnnotationsPostProcessor.class);
def.setSource(source);
def.getPropertyValues().add("releaseId", releaseId);
beanDefs.add(registerPostProcessor(registry, def, KIE_ANNOTATION_PROCESSOR_CLASS_NAME));
}
return beanDefs;
} } | public class class_name {
public static Set<BeanDefinitionHolder> registerAnnotationConfigProcessors(
BeanDefinitionRegistry registry, Object source, ReleaseId releaseId) {
Set<BeanDefinitionHolder> beanDefs = new LinkedHashSet<BeanDefinitionHolder>(1);
if (!registry.containsBeanDefinition(KIE_ANNOTATION_PROCESSOR_CLASS_NAME)) {
RootBeanDefinition def = new RootBeanDefinition(AnnotationsPostProcessor.class);
def.setSource(source); // depends on control dependency: [if], data = [none]
def.getPropertyValues().add("releaseId", releaseId); // depends on control dependency: [if], data = [none]
beanDefs.add(registerPostProcessor(registry, def, KIE_ANNOTATION_PROCESSOR_CLASS_NAME)); // depends on control dependency: [if], data = [none]
}
return beanDefs;
} } |
public class class_name {
public String getSiteString (int siteId)
{
checkReloadSites();
Site site = _sitesById.get(siteId);
if (site == null) {
site = _sitesById.get(_defaultSiteId);
}
return (site == null) ? DEFAULT_SITE_STRING : site.siteString;
} } | public class class_name {
public String getSiteString (int siteId)
{
checkReloadSites();
Site site = _sitesById.get(siteId);
if (site == null) {
site = _sitesById.get(_defaultSiteId); // depends on control dependency: [if], data = [none]
}
return (site == null) ? DEFAULT_SITE_STRING : site.siteString;
} } |
public class class_name {
public static final PhotoList<Photo> createPhotoList(Element photosElement) {
PhotoList<Photo> photos = new PhotoList<Photo>();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoNodes = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
}
return photos;
} } | public class class_name {
public static final PhotoList<Photo> createPhotoList(Element photosElement) {
PhotoList<Photo> photos = new PhotoList<Photo>();
photos.setPage(photosElement.getAttribute("page"));
photos.setPages(photosElement.getAttribute("pages"));
photos.setPerPage(photosElement.getAttribute("perpage"));
photos.setTotal(photosElement.getAttribute("total"));
NodeList photoNodes = photosElement.getElementsByTagName("photo");
for (int i = 0; i < photoNodes.getLength(); i++) {
Element photoElement = (Element) photoNodes.item(i);
photos.add(PhotoUtils.createPhoto(photoElement));
// depends on control dependency: [for], data = [none]
}
return photos;
} } |
public class class_name {
public List<SendMessageResult> sendMessage(List<SignalServiceAddress> recipients,
List<Optional<UnidentifiedAccessPair>> unidentifiedAccess,
SignalServiceDataMessage message)
throws IOException, UntrustedIdentityException
{
byte[] content = createMessageContent(message);
long timestamp = message.getTimestamp();
List<SendMessageResult> results = sendMessage(recipients, getTargetUnidentifiedAccess(unidentifiedAccess), timestamp, content, false);
boolean needsSyncInResults = false;
for (SendMessageResult result : results) {
if (result.getSuccess() != null && result.getSuccess().isNeedsSync()) {
needsSyncInResults = true;
break;
}
}
if (needsSyncInResults || (isMultiDevice.get())) {
byte[] syncMessage = createMultiDeviceSentTranscriptContent(content, Optional.<SignalServiceAddress>absent(), timestamp, results);
sendMessage(localAddress, Optional.<UnidentifiedAccess>absent(), timestamp, syncMessage, false);
}
return results;
} } | public class class_name {
public List<SendMessageResult> sendMessage(List<SignalServiceAddress> recipients,
List<Optional<UnidentifiedAccessPair>> unidentifiedAccess,
SignalServiceDataMessage message)
throws IOException, UntrustedIdentityException
{
byte[] content = createMessageContent(message);
long timestamp = message.getTimestamp();
List<SendMessageResult> results = sendMessage(recipients, getTargetUnidentifiedAccess(unidentifiedAccess), timestamp, content, false);
boolean needsSyncInResults = false;
for (SendMessageResult result : results) {
if (result.getSuccess() != null && result.getSuccess().isNeedsSync()) {
needsSyncInResults = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (needsSyncInResults || (isMultiDevice.get())) {
byte[] syncMessage = createMultiDeviceSentTranscriptContent(content, Optional.<SignalServiceAddress>absent(), timestamp, results);
sendMessage(localAddress, Optional.<UnidentifiedAccess>absent(), timestamp, syncMessage, false);
}
return results;
} } |
public class class_name {
private void debugSegmentEntries(WriteStream out,
ReadStream is,
SegmentExtent extent,
TableEntry table)
throws IOException
{
TempBuffer tBuf = TempBuffer.create();
byte []buffer = tBuf.buffer();
for (long ptr = extent.length() - BLOCK_SIZE;
ptr > 0;
ptr -= BLOCK_SIZE) {
is.position(ptr);
is.readAll(buffer, 0, BLOCK_SIZE);
long seq = BitsUtil.readLong(buffer, 0);
int head = 8;
byte []tableKey = new byte[32];
System.arraycopy(buffer, head, tableKey, 0, tableKey.length);
is.readAll(tableKey, 0, tableKey.length);
head += tableKey.length;
int offset = BLOCK_SIZE - 8;
int tail = BitsUtil.readInt16(buffer, offset);
offset += 2;
boolean isCont = buffer[offset] == 1;
if (seq <= 0 || tail <= 0) {
return;
}
while ((head = debugSegmentIndex(out, is, buffer, extent.address(),
ptr, head,
table)) < tail) {
}
if (! isCont) {
break;
}
}
} } | public class class_name {
private void debugSegmentEntries(WriteStream out,
ReadStream is,
SegmentExtent extent,
TableEntry table)
throws IOException
{
TempBuffer tBuf = TempBuffer.create();
byte []buffer = tBuf.buffer();
for (long ptr = extent.length() - BLOCK_SIZE;
ptr > 0;
ptr -= BLOCK_SIZE) {
is.position(ptr);
is.readAll(buffer, 0, BLOCK_SIZE);
long seq = BitsUtil.readLong(buffer, 0);
int head = 8;
byte []tableKey = new byte[32];
System.arraycopy(buffer, head, tableKey, 0, tableKey.length);
is.readAll(tableKey, 0, tableKey.length);
head += tableKey.length;
int offset = BLOCK_SIZE - 8;
int tail = BitsUtil.readInt16(buffer, offset);
offset += 2;
boolean isCont = buffer[offset] == 1;
if (seq <= 0 || tail <= 0) {
return; // depends on control dependency: [if], data = [none]
}
while ((head = debugSegmentIndex(out, is, buffer, extent.address(),
ptr, head,
table)) < tail) {
}
if (! isCont) {
break;
}
}
} } |
public class class_name {
public static <K, V> Map<K, V> fromIterables(
Iterable<? extends K> iterable0,
Iterable<? extends V> iterable1)
{
Map<K, V> map = new LinkedHashMap<K, V>();
Iterator<? extends K> i0 = iterable0.iterator();
Iterator<? extends V> i1 = iterable1.iterator();
while (i0.hasNext() && i1.hasNext())
{
K k = i0.next();
V v = i1.next();
map.put(k, v);
}
return map;
} } | public class class_name {
public static <K, V> Map<K, V> fromIterables(
Iterable<? extends K> iterable0,
Iterable<? extends V> iterable1)
{
Map<K, V> map = new LinkedHashMap<K, V>();
Iterator<? extends K> i0 = iterable0.iterator();
Iterator<? extends V> i1 = iterable1.iterator();
while (i0.hasNext() && i1.hasNext())
{
K k = i0.next();
V v = i1.next();
map.put(k, v);
// depends on control dependency: [while], data = [none]
}
return map;
} } |
public class class_name {
void fireMemberStateChanged(AsteriskQueueMemberImpl member)
{
synchronized (listeners)
{
for (AsteriskQueueListener listener : listeners)
{
try
{
listener.onMemberStateChange(member);
}
catch (Exception e)
{
logger.warn("Exception in onMemberStateChange()", e);
}
}
}
} } | public class class_name {
void fireMemberStateChanged(AsteriskQueueMemberImpl member)
{
synchronized (listeners)
{
for (AsteriskQueueListener listener : listeners)
{
try
{
listener.onMemberStateChange(member); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
logger.warn("Exception in onMemberStateChange()", e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
protected void broadcastLogout(Authentication authentication) {
if( logger.isDebugEnabled() )
logger.debug( "BROADCAST logout: token=" + authentication );
final Iterator iter = getBeansToUpdate( LoginAware.class ).iterator();
while( iter.hasNext() ) {
((LoginAware) iter.next()).userLogout( authentication );
}
} } | public class class_name {
protected void broadcastLogout(Authentication authentication) {
if( logger.isDebugEnabled() )
logger.debug( "BROADCAST logout: token=" + authentication );
final Iterator iter = getBeansToUpdate( LoginAware.class ).iterator();
while( iter.hasNext() ) {
((LoginAware) iter.next()).userLogout( authentication ); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
@SneakyThrows @SuppressWarnings("unchecked")
private void processExcelRowsAnnotation(Field field, Object bean) {
val excelRows = field.getAnnotation(ExcelRows.class);
if (excelRows == null) return;
if (!Generic.of(field.getGenericType()).isRawType(List.class)) return;
val templateCell = findTemplateCell(excelRows);
if (templateCell == null) {
log.warn("unable to locate template cell for field {}", field);
return; // 找不到模板单元格,直接忽略字段处理。
}
val list = (List<Object>) Fields.invokeField(field, bean);
val itemSize = PoiUtil.shiftRows(sheet, list, templateCell.getRowIndex());
if (itemSize > 0) {
writeRows(templateCell, list);
mergeRows(excelRows, templateCell, itemSize);
mergeCols(excelRows, templateCell, itemSize);
}
} } | public class class_name {
@SneakyThrows @SuppressWarnings("unchecked")
private void processExcelRowsAnnotation(Field field, Object bean) {
val excelRows = field.getAnnotation(ExcelRows.class);
if (excelRows == null) return;
if (!Generic.of(field.getGenericType()).isRawType(List.class)) return;
val templateCell = findTemplateCell(excelRows);
if (templateCell == null) {
log.warn("unable to locate template cell for field {}", field); // depends on control dependency: [if], data = [none]
return; // 找不到模板单元格,直接忽略字段处理。 // depends on control dependency: [if], data = [none]
}
val list = (List<Object>) Fields.invokeField(field, bean);
val itemSize = PoiUtil.shiftRows(sheet, list, templateCell.getRowIndex());
if (itemSize > 0) {
writeRows(templateCell, list); // depends on control dependency: [if], data = [none]
mergeRows(excelRows, templateCell, itemSize); // depends on control dependency: [if], data = [none]
mergeCols(excelRows, templateCell, itemSize); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public DescribeImagesResult withImages(Image... images) {
if (this.images == null) {
setImages(new com.amazonaws.internal.SdkInternalList<Image>(images.length));
}
for (Image ele : images) {
this.images.add(ele);
}
return this;
} } | public class class_name {
public DescribeImagesResult withImages(Image... images) {
if (this.images == null) {
setImages(new com.amazonaws.internal.SdkInternalList<Image>(images.length)); // depends on control dependency: [if], data = [none]
}
for (Image ele : images) {
this.images.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public void validateElementStart(String localName, String uri, String prefix)
throws XMLStreamException
{
// Ok, can we find the element definition?
mTmpKey.reset(prefix, localName);
DTDElement elem = mElemSpecs.get(mTmpKey);
// whether it's found or not, let's add a stack frame:
int elemCount = mElemCount++;
if (elemCount >= mElems.length) {
mElems = (DTDElement[]) DataUtil.growArrayBy50Pct(mElems);
}
mElems[elemCount] = mCurrElem = elem;
mAttrCount = 0;
mIdAttrIndex = -2; // -2 as a "don't know yet" marker
/* but if not found, can not obtain any type information. Not
* a validation problem though, since we are doing none...
* Oh, also, unlike with real validation, not having actual element
* information is ok; can still have attributes!
*/
if (elem == null) { // || !elem.isDefined())
mCurrAttrDefs = NO_ATTRS;
mHasAttrDefaults = false;
mCurrDefaultAttrs = null;
mHasNormalizableAttrs = false;
return;
}
// If element found, does it have any attributes?
mCurrAttrDefs = elem.getAttributes();
if (mCurrAttrDefs == null) {
mCurrAttrDefs = NO_ATTRS;
mHasAttrDefaults = false;
mCurrDefaultAttrs = null;
mHasNormalizableAttrs = false;
return;
}
// Any normalization needed?
mHasNormalizableAttrs = mNormAttrs || elem.attrsNeedValidation();
// Any default values?
mHasAttrDefaults = elem.hasAttrDefaultValues();
if (mHasAttrDefaults) {
/* Special count also contains ones with #REQUIRED value, but
* that's a minor sub-optimality...
*/
int specCount = elem.getSpecialCount();
BitSet bs = mTmpDefaultAttrs;
if (bs == null) {
mTmpDefaultAttrs = bs = new BitSet(specCount);
} else {
bs.clear();
}
mCurrDefaultAttrs = bs;
} else {
mCurrDefaultAttrs = null;
}
} } | public class class_name {
@Override
public void validateElementStart(String localName, String uri, String prefix)
throws XMLStreamException
{
// Ok, can we find the element definition?
mTmpKey.reset(prefix, localName);
DTDElement elem = mElemSpecs.get(mTmpKey);
// whether it's found or not, let's add a stack frame:
int elemCount = mElemCount++;
if (elemCount >= mElems.length) {
mElems = (DTDElement[]) DataUtil.growArrayBy50Pct(mElems);
}
mElems[elemCount] = mCurrElem = elem;
mAttrCount = 0;
mIdAttrIndex = -2; // -2 as a "don't know yet" marker
/* but if not found, can not obtain any type information. Not
* a validation problem though, since we are doing none...
* Oh, also, unlike with real validation, not having actual element
* information is ok; can still have attributes!
*/
if (elem == null) { // || !elem.isDefined())
mCurrAttrDefs = NO_ATTRS;
mHasAttrDefaults = false;
mCurrDefaultAttrs = null;
mHasNormalizableAttrs = false;
return;
}
// If element found, does it have any attributes?
mCurrAttrDefs = elem.getAttributes();
if (mCurrAttrDefs == null) {
mCurrAttrDefs = NO_ATTRS;
mHasAttrDefaults = false;
mCurrDefaultAttrs = null;
mHasNormalizableAttrs = false;
return;
}
// Any normalization needed?
mHasNormalizableAttrs = mNormAttrs || elem.attrsNeedValidation();
// Any default values?
mHasAttrDefaults = elem.hasAttrDefaultValues();
if (mHasAttrDefaults) {
/* Special count also contains ones with #REQUIRED value, but
* that's a minor sub-optimality...
*/
int specCount = elem.getSpecialCount();
BitSet bs = mTmpDefaultAttrs;
if (bs == null) {
mTmpDefaultAttrs = bs = new BitSet(specCount); // depends on control dependency: [if], data = [none]
} else {
bs.clear(); // depends on control dependency: [if], data = [none]
}
mCurrDefaultAttrs = bs;
} else {
mCurrDefaultAttrs = null;
}
} } |
public class class_name {
public static String encodeBase64(String data) {
byte[] bytes = null;
try {
bytes = data.getBytes("ISO-8859-1");
} catch (UnsupportedEncodingException uee) {
throw new IllegalStateException(uee);
}
return encodeBase64(bytes);
} } | public class class_name {
public static String encodeBase64(String data) {
byte[] bytes = null;
try {
bytes = data.getBytes("ISO-8859-1"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException uee) {
throw new IllegalStateException(uee);
} // depends on control dependency: [catch], data = [none]
return encodeBase64(bytes);
} } |
public class class_name {
private boolean genProxyCovariantBridgeMethod( DynamicFunctionSymbol dfs, DynamicFunctionSymbol superDfs )
{
IGosuClassInternal superType = (IGosuClassInternal)superDfs.getScriptPart().getContainingType();
if( superType.isProxy() )
{
IJavaType javaType = superType.getJavaType();
javaType = (IJavaType)TypeLord.getDefaultParameterizedType( javaType );
IType[] dfsArgTypes = dfs.getArgTypes();
IType[] defDfsArgTypes = new IType[dfsArgTypes.length];
for( int i = 0; i < dfsArgTypes.length; i++ )
{
defDfsArgTypes[i] = TypeLord.getDefaultParameterizedTypeWithTypeVars( dfsArgTypes[i] );
}
IJavaMethodInfo mi = (IJavaMethodInfo)((IRelativeTypeInfo)javaType.getTypeInfo()).getMethod( javaType, NameResolver.getFunctionName( dfs ), defDfsArgTypes );
if( mi == null )
{
// Probably a generic method; the caller will gen bridge method for this
return false;
}
IJavaClassMethod method = mi.getMethod();
IJavaClassInfo[] paramClasses = method.getParameterTypes();
for( int i = 0; i < paramClasses.length; i++ )
{
if( !AbstractElementTransformer.isBytecodeType( defDfsArgTypes[i] ) )
{
String dfsParamClass = getDescriptor( defDfsArgTypes[i] ).getName().replace( '$', '.' );
if( !dfsParamClass.equals( paramClasses[i].getName().replace( '$', '.' ) ) )
{
makeCovariantParamBridgeMethod( dfs, superDfs, method );
return true;
}
}
}
if( !AbstractElementTransformer.isBytecodeType( superDfs.getReturnType() ) )
{
String returnClassName = getDescriptor( method.getReturnClassInfo() ).getName();
String superReturnClassName = getDescriptor( superDfs.getReturnType() ).getName();
if( !returnClassName.equals( superReturnClassName ) )
{
makeCovariantParamBridgeMethod( dfs, superDfs, method );
return true;
}
}
}
return false;
} } | public class class_name {
private boolean genProxyCovariantBridgeMethod( DynamicFunctionSymbol dfs, DynamicFunctionSymbol superDfs )
{
IGosuClassInternal superType = (IGosuClassInternal)superDfs.getScriptPart().getContainingType();
if( superType.isProxy() )
{
IJavaType javaType = superType.getJavaType();
javaType = (IJavaType)TypeLord.getDefaultParameterizedType( javaType ); // depends on control dependency: [if], data = [none]
IType[] dfsArgTypes = dfs.getArgTypes();
IType[] defDfsArgTypes = new IType[dfsArgTypes.length];
for( int i = 0; i < dfsArgTypes.length; i++ )
{
defDfsArgTypes[i] = TypeLord.getDefaultParameterizedTypeWithTypeVars( dfsArgTypes[i] ); // depends on control dependency: [for], data = [i]
}
IJavaMethodInfo mi = (IJavaMethodInfo)((IRelativeTypeInfo)javaType.getTypeInfo()).getMethod( javaType, NameResolver.getFunctionName( dfs ), defDfsArgTypes );
if( mi == null )
{
// Probably a generic method; the caller will gen bridge method for this
return false; // depends on control dependency: [if], data = [none]
}
IJavaClassMethod method = mi.getMethod();
IJavaClassInfo[] paramClasses = method.getParameterTypes();
for( int i = 0; i < paramClasses.length; i++ )
{
if( !AbstractElementTransformer.isBytecodeType( defDfsArgTypes[i] ) )
{
String dfsParamClass = getDescriptor( defDfsArgTypes[i] ).getName().replace( '$', '.' );
if( !dfsParamClass.equals( paramClasses[i].getName().replace( '$', '.' ) ) )
{
makeCovariantParamBridgeMethod( dfs, superDfs, method ); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
}
if( !AbstractElementTransformer.isBytecodeType( superDfs.getReturnType() ) )
{
String returnClassName = getDescriptor( method.getReturnClassInfo() ).getName();
String superReturnClassName = getDescriptor( superDfs.getReturnType() ).getName();
if( !returnClassName.equals( superReturnClassName ) )
{
makeCovariantParamBridgeMethod( dfs, superDfs, method ); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.