code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
@Override
public synchronized void disconnect() {
try {
// If there is an error with the handler, dont bother logging out.
if (!mailClientHandler.isHalted()) {
if (mailClientHandler.idleRequested.get()) {
log.warn("Disconnect called while IDLE, leaving idle and logging out.");
done();
}
// Log out of the IMAP Server.
channel.write(". logout\n");
}
currentFolder = null;
} catch (Exception e) {
// swallow any exceptions.
} finally {
// Shut down all channels and exit (leave threadpools as is--for reconnects).
// The Netty channel close listener will fire a disconnect event to our client,
// automatically. See connect() for details.
try {
channel.close().awaitUninterruptibly(config.getTimeout(), TimeUnit.MILLISECONDS);
} catch (Exception e) {
// swallow any exceptions.
} finally {
mailClientHandler.idleAcknowledged.set(false);
mailClientHandler.disconnected();
if (disconnectListener != null)
disconnectListener.disconnected();
}
}
} } | public class class_name {
@Override
public synchronized void disconnect() {
try {
// If there is an error with the handler, dont bother logging out.
if (!mailClientHandler.isHalted()) {
if (mailClientHandler.idleRequested.get()) {
log.warn("Disconnect called while IDLE, leaving idle and logging out."); // depends on control dependency: [if], data = [none]
done(); // depends on control dependency: [if], data = [none]
}
// Log out of the IMAP Server.
channel.write(". logout\n"); // depends on control dependency: [if], data = [none]
}
currentFolder = null; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// swallow any exceptions.
} finally { // depends on control dependency: [catch], data = [none]
// Shut down all channels and exit (leave threadpools as is--for reconnects).
// The Netty channel close listener will fire a disconnect event to our client,
// automatically. See connect() for details.
try {
channel.close().awaitUninterruptibly(config.getTimeout(), TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// swallow any exceptions.
} finally { // depends on control dependency: [catch], data = [none]
mailClientHandler.idleAcknowledged.set(false);
mailClientHandler.disconnected();
if (disconnectListener != null)
disconnectListener.disconnected();
}
}
} } |
public class class_name {
private Double getRangeCostWholeDay(ProjectCalendar projectCalendar, TimescaleUnits rangeUnits, DateRange range, List<TimephasedCost> assignments, int startIndex)
{
int totalDays = 0;
double totalCost = 0;
TimephasedCost assignment = assignments.get(startIndex);
boolean done = false;
do
{
//
// Select the correct start date
//
long startDate = range.getStart().getTime();
long assignmentStart = assignment.getStart().getTime();
if (startDate < assignmentStart)
{
startDate = assignmentStart;
}
long rangeEndDate = range.getEnd().getTime();
long traEndDate = assignment.getFinish().getTime();
Calendar cal = DateHelper.popCalendar(startDate);
Date calendarDate = cal.getTime();
//
// Start counting forwards
//
while (startDate < rangeEndDate && startDate < traEndDate)
{
if (projectCalendar == null || projectCalendar.isWorkingDate(calendarDate))
{
++totalDays;
}
cal.add(Calendar.DAY_OF_YEAR, 1);
startDate = cal.getTimeInMillis();
calendarDate = cal.getTime();
}
DateHelper.pushCalendar(cal);
//
// If we still haven't reached the end of our range
// check to see if the next TRA can be used.
//
done = true;
totalCost += (assignment.getAmountPerDay().doubleValue() * totalDays);
if (startDate < rangeEndDate)
{
++startIndex;
if (startIndex < assignments.size())
{
assignment = assignments.get(startIndex);
totalDays = 0;
done = false;
}
}
}
while (!done);
return Double.valueOf(totalCost);
} } | public class class_name {
private Double getRangeCostWholeDay(ProjectCalendar projectCalendar, TimescaleUnits rangeUnits, DateRange range, List<TimephasedCost> assignments, int startIndex)
{
int totalDays = 0;
double totalCost = 0;
TimephasedCost assignment = assignments.get(startIndex);
boolean done = false;
do
{
//
// Select the correct start date
//
long startDate = range.getStart().getTime();
long assignmentStart = assignment.getStart().getTime();
if (startDate < assignmentStart)
{
startDate = assignmentStart; // depends on control dependency: [if], data = [none]
}
long rangeEndDate = range.getEnd().getTime();
long traEndDate = assignment.getFinish().getTime();
Calendar cal = DateHelper.popCalendar(startDate);
Date calendarDate = cal.getTime();
//
// Start counting forwards
//
while (startDate < rangeEndDate && startDate < traEndDate)
{
if (projectCalendar == null || projectCalendar.isWorkingDate(calendarDate))
{
++totalDays; // depends on control dependency: [if], data = [none]
}
cal.add(Calendar.DAY_OF_YEAR, 1); // depends on control dependency: [while], data = [none]
startDate = cal.getTimeInMillis(); // depends on control dependency: [while], data = [none]
calendarDate = cal.getTime(); // depends on control dependency: [while], data = [none]
}
DateHelper.pushCalendar(cal);
//
// If we still haven't reached the end of our range
// check to see if the next TRA can be used.
//
done = true;
totalCost += (assignment.getAmountPerDay().doubleValue() * totalDays);
if (startDate < rangeEndDate)
{
++startIndex; // depends on control dependency: [if], data = [none]
if (startIndex < assignments.size())
{
assignment = assignments.get(startIndex); // depends on control dependency: [if], data = [(startIndex]
totalDays = 0; // depends on control dependency: [if], data = [none]
done = false; // depends on control dependency: [if], data = [none]
}
}
}
while (!done);
return Double.valueOf(totalCost);
} } |
public class class_name {
public static Slice wrappedBooleanArray(boolean[] array, int offset, int length)
{
if (length == 0) {
return EMPTY_SLICE;
}
return new Slice(array, offset, length);
} } | public class class_name {
public static Slice wrappedBooleanArray(boolean[] array, int offset, int length)
{
if (length == 0) {
return EMPTY_SLICE; // depends on control dependency: [if], data = [none]
}
return new Slice(array, offset, length);
} } |
public class class_name {
protected boolean remove(Object child, boolean setChildBC)
{
if (child == null)
{
throw new IllegalArgumentException(Messages.getString("beans.67"));
}
Object peer = null;
synchronized (globalHierarchyLock)
{
// check existence
if (!contains(child))
{
return false;
}
// check serializing state
if (serializing)
{
throw new IllegalStateException(Messages.getString("beans.68"));
}
// validate
boolean valid = validatePendingRemove(child);
if (!valid)
{
throw new IllegalStateException(Messages.getString("beans.6E"));
}
// set child's beanContext property
BeanContextChild beanContextChild = getChildBeanContextChild(child);
if (beanContextChild != null && setChildBC)
{
// remove listener, first
beanContextChild.removePropertyChangeListener("beanContext", nonSerPCL);
try
{
beanContextChild.setBeanContext(null);
}
catch (PropertyVetoException e)
{
// rollback the listener change
beanContextChild.addPropertyChangeListener("beanContext", nonSerPCL);
throw new IllegalStateException(Messages.getString("beans.6B"));
}
}
// remove from children
BCSChild childBCSC = null, peerBCSC = null;
synchronized (children)
{
childBCSC = (BCSChild) children.remove(child);
peer = childBCSC.proxyPeer;
if (peer != null)
{
peerBCSC = (BCSChild) children.remove(peer);
}
}
// trigger hook
synchronized (child)
{
removeSerializable(childBCSC);
childJustRemovedHook(child, childBCSC);
}
if (peer != null)
{
synchronized (peer)
{
removeSerializable(peerBCSC);
childJustRemovedHook(peer, peerBCSC);
}
}
}
// notify listeners
fireChildrenRemoved(new BeanContextMembershipEvent(getBeanContextPeer(), peer == null ? new Object[] { child } : new Object[] { child, peer }));
return true;
} } | public class class_name {
protected boolean remove(Object child, boolean setChildBC)
{
if (child == null)
{
throw new IllegalArgumentException(Messages.getString("beans.67"));
}
Object peer = null;
synchronized (globalHierarchyLock)
{
// check existence
if (!contains(child))
{
return false; // depends on control dependency: [if], data = [none]
}
// check serializing state
if (serializing)
{
throw new IllegalStateException(Messages.getString("beans.68"));
}
// validate
boolean valid = validatePendingRemove(child);
if (!valid)
{
throw new IllegalStateException(Messages.getString("beans.6E"));
}
// set child's beanContext property
BeanContextChild beanContextChild = getChildBeanContextChild(child);
if (beanContextChild != null && setChildBC)
{
// remove listener, first
beanContextChild.removePropertyChangeListener("beanContext", nonSerPCL);
try
{
beanContextChild.setBeanContext(null);
}
catch (PropertyVetoException e)
{
// rollback the listener change
beanContextChild.addPropertyChangeListener("beanContext", nonSerPCL);
throw new IllegalStateException(Messages.getString("beans.6B"));
}
}
// remove from children
BCSChild childBCSC = null, peerBCSC = null;
synchronized (children)
{
childBCSC = (BCSChild) children.remove(child);
peer = childBCSC.proxyPeer;
if (peer != null)
{
peerBCSC = (BCSChild) children.remove(peer);
}
}
// trigger hook
synchronized (child)
{
removeSerializable(childBCSC);
childJustRemovedHook(child, childBCSC);
}
if (peer != null)
{
synchronized (peer)
{
removeSerializable(peerBCSC);
childJustRemovedHook(peer, peerBCSC);
}
}
}
// notify listeners
fireChildrenRemoved(new BeanContextMembershipEvent(getBeanContextPeer(), peer == null ? new Object[] { child } : new Object[] { child, peer }));
return true;
} } |
public class class_name {
public void setOutgoingCertificates(java.util.Collection<OutgoingCertificate> outgoingCertificates) {
if (outgoingCertificates == null) {
this.outgoingCertificates = null;
return;
}
this.outgoingCertificates = new java.util.ArrayList<OutgoingCertificate>(outgoingCertificates);
} } | public class class_name {
public void setOutgoingCertificates(java.util.Collection<OutgoingCertificate> outgoingCertificates) {
if (outgoingCertificates == null) {
this.outgoingCertificates = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.outgoingCertificates = new java.util.ArrayList<OutgoingCertificate>(outgoingCertificates);
} } |
public class class_name {
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:52:47+02:00", comments = "JAXB RI v2.2.11")
public StatusTyp getStatusIS24() {
if (statusIS24 == null) {
return StatusTyp.AKTIV;
} else {
return statusIS24;
}
} } | public class class_name {
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:52:47+02:00", comments = "JAXB RI v2.2.11")
public StatusTyp getStatusIS24() {
if (statusIS24 == null) {
return StatusTyp.AKTIV; // depends on control dependency: [if], data = [none]
} else {
return statusIS24; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String[] getRegisteredListeners(RESTRequest request,
int clientID,
String source_objName) {
//Get the client area
ClientNotificationArea clientArea = getInboxIfAvailable(clientID, null);
List<ServerNotification> registrations = clientArea.getServerRegistrations(request, source_objName);
if (registrations != null) {
List<String> listeners = new ArrayList<String>();
//loop registrations to match request
for (ServerNotification registration : registrations) {
listeners.add(registration.listener.getCanonicalName());
}
return listeners.toArray(new String[listeners.size()]);
}
return null;
} } | public class class_name {
public String[] getRegisteredListeners(RESTRequest request,
int clientID,
String source_objName) {
//Get the client area
ClientNotificationArea clientArea = getInboxIfAvailable(clientID, null);
List<ServerNotification> registrations = clientArea.getServerRegistrations(request, source_objName);
if (registrations != null) {
List<String> listeners = new ArrayList<String>();
//loop registrations to match request
for (ServerNotification registration : registrations) {
listeners.add(registration.listener.getCanonicalName()); // depends on control dependency: [for], data = [registration]
}
return listeners.toArray(new String[listeners.size()]); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static String getGroupId(final String gavc) {
final int splitter = gavc.indexOf(':');
if(splitter == -1){
return gavc;
}
return gavc.substring(0, splitter);
} } | public class class_name {
public static String getGroupId(final String gavc) {
final int splitter = gavc.indexOf(':');
if(splitter == -1){
return gavc; // depends on control dependency: [if], data = [none]
}
return gavc.substring(0, splitter);
} } |
public class class_name {
public void onMainExecutionComplete(Throwable t) {
try {
// May be called twice, don't do anything the second time
if (mainExecutionComplete) {
return;
}
mainExecutionComplete = true;
this.failure = t;
onAttemptComplete(t);
if (t instanceof CircuitBreakerOpenException) {
// We didn't run anything, execution context needs closing
close();
}
if (retry != null) {
if (retry.canRetryFor(null, t)) {
// This is a retryable failure
metricRecorder.incrementRetryCallsFailureCount();
} else {
// Not a retryable failure
if (retries > 0) {
metricRecorder.incrementRetryCallsSuccessRetriesCount();
} else {
metricRecorder.incrementRetryCallsSuccessImmediateCount();
}
}
}
} catch (Exception e) {
// Unchecked exceptions thrown here can be swallowed by Failsafe
// This catch ensures we at least get an FFDC
throw e;
}
} } | public class class_name {
public void onMainExecutionComplete(Throwable t) {
try {
// May be called twice, don't do anything the second time
if (mainExecutionComplete) {
return; // depends on control dependency: [if], data = [none]
}
mainExecutionComplete = true; // depends on control dependency: [try], data = [none]
this.failure = t; // depends on control dependency: [try], data = [none]
onAttemptComplete(t); // depends on control dependency: [try], data = [none]
if (t instanceof CircuitBreakerOpenException) {
// We didn't run anything, execution context needs closing
close(); // depends on control dependency: [if], data = [none]
}
if (retry != null) {
if (retry.canRetryFor(null, t)) {
// This is a retryable failure
metricRecorder.incrementRetryCallsFailureCount(); // depends on control dependency: [if], data = [none]
} else {
// Not a retryable failure
if (retries > 0) {
metricRecorder.incrementRetryCallsSuccessRetriesCount(); // depends on control dependency: [if], data = [none]
} else {
metricRecorder.incrementRetryCallsSuccessImmediateCount(); // depends on control dependency: [if], data = [none]
}
}
}
} catch (Exception e) {
// Unchecked exceptions thrown here can be swallowed by Failsafe
// This catch ensures we at least get an FFDC
throw e;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private PopupExcludeFromProxyMenu getPopupExcludeFromProxyMenu(int menuIndex) {
if (popupExcludeFromProxyMenu == null) {
popupExcludeFromProxyMenu = new PopupExcludeFromProxyMenu();
popupExcludeFromProxyMenu.setMenuIndex(menuIndex);
}
return popupExcludeFromProxyMenu;
} } | public class class_name {
private PopupExcludeFromProxyMenu getPopupExcludeFromProxyMenu(int menuIndex) {
if (popupExcludeFromProxyMenu == null) {
popupExcludeFromProxyMenu = new PopupExcludeFromProxyMenu();
// depends on control dependency: [if], data = [none]
popupExcludeFromProxyMenu.setMenuIndex(menuIndex);
// depends on control dependency: [if], data = [none]
}
return popupExcludeFromProxyMenu;
} } |
public class class_name {
public void closeAllConsumersForDelete(DestinationHandler destinationBeingDeleted)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "closeAllConsumersForDelete", destinationBeingDeleted);
Iterator<DispatchableKey> itr = null;
Iterator<DispatchableKey> clonedItr = null;
// The consumerPoints list is cloned for the notifyException
// call.
synchronized (consumerPoints)
{
//since the close of the underlying session causes the consumer point to
//be removed from the list we have to take a clone of the list
clonedItr = ((LinkedList<DispatchableKey>) consumerPoints.clone()).iterator();
itr = ((LinkedList<DispatchableKey>) consumerPoints.clone()).iterator();
}
// Defect 360452
// Iterate twice to avoid deadlock. First iteration to mark
// as not ready. This ensure no messages on the destination
// will arrive at the consumers.
synchronized (_baseDestHandler.getReadyConsumerPointLock())
{
while (itr.hasNext())
{
DispatchableKey consumerKey = itr.next();
// If we're making the consumer notReady then we must also remove
// them from the list of ready consumers that we hold
if (consumerKey.isKeyReady())
removeReadyConsumer(consumerKey.getParent(), consumerKey.isSpecific());
consumerKey.markNotReady();
}
}
// Second iteration to close sessions outside of readyConsumerPointLock
// to avoid deadlock with receive.
while (clonedItr.hasNext())
{
DispatchableKey consumerKey = clonedItr.next();
consumerKey.getConsumerPoint().implicitClose(destinationBeingDeleted.getUuid(), null, _messageProcessor.getMessagingEngineUuid());
}
// Close any browsers
closeBrowsersDestinationDeleted(destinationBeingDeleted);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "closeAllConsumersForDelete");
} } | public class class_name {
public void closeAllConsumersForDelete(DestinationHandler destinationBeingDeleted)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "closeAllConsumersForDelete", destinationBeingDeleted);
Iterator<DispatchableKey> itr = null;
Iterator<DispatchableKey> clonedItr = null;
// The consumerPoints list is cloned for the notifyException
// call.
synchronized (consumerPoints)
{
//since the close of the underlying session causes the consumer point to
//be removed from the list we have to take a clone of the list
clonedItr = ((LinkedList<DispatchableKey>) consumerPoints.clone()).iterator();
itr = ((LinkedList<DispatchableKey>) consumerPoints.clone()).iterator();
}
// Defect 360452
// Iterate twice to avoid deadlock. First iteration to mark
// as not ready. This ensure no messages on the destination
// will arrive at the consumers.
synchronized (_baseDestHandler.getReadyConsumerPointLock())
{
while (itr.hasNext())
{
DispatchableKey consumerKey = itr.next();
// If we're making the consumer notReady then we must also remove
// them from the list of ready consumers that we hold
if (consumerKey.isKeyReady())
removeReadyConsumer(consumerKey.getParent(), consumerKey.isSpecific());
consumerKey.markNotReady(); // depends on control dependency: [while], data = [none]
}
}
// Second iteration to close sessions outside of readyConsumerPointLock
// to avoid deadlock with receive.
while (clonedItr.hasNext())
{
DispatchableKey consumerKey = clonedItr.next();
consumerKey.getConsumerPoint().implicitClose(destinationBeingDeleted.getUuid(), null, _messageProcessor.getMessagingEngineUuid()); // depends on control dependency: [while], data = [none]
}
// Close any browsers
closeBrowsersDestinationDeleted(destinationBeingDeleted);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "closeAllConsumersForDelete");
} } |
public class class_name {
public Extension getExtension(ObjectIdentifier oid) {
if (info == null) {
return null;
}
try {
CertificateExtensions extensions;
try {
extensions = (CertificateExtensions)info.get(CertificateExtensions.NAME);
} catch (CertificateException ce) {
return null;
}
if (extensions == null) {
return null;
} else {
Extension ex = extensions.getExtension(oid.toString());
if (ex != null) {
return ex;
}
for (Extension ex2: extensions.getAllExtensions()) {
if (ex2.getExtensionId().equals((Object)oid)) {
//XXXX May want to consider cloning this
return ex2;
}
}
/* no such extension in this certificate */
return null;
}
} catch (IOException ioe) {
return null;
}
} } | public class class_name {
public Extension getExtension(ObjectIdentifier oid) {
if (info == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
CertificateExtensions extensions;
try {
extensions = (CertificateExtensions)info.get(CertificateExtensions.NAME); // depends on control dependency: [try], data = [none]
} catch (CertificateException ce) {
return null;
} // depends on control dependency: [catch], data = [none]
if (extensions == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
Extension ex = extensions.getExtension(oid.toString());
if (ex != null) {
return ex; // depends on control dependency: [if], data = [none]
}
for (Extension ex2: extensions.getAllExtensions()) {
if (ex2.getExtensionId().equals((Object)oid)) {
//XXXX May want to consider cloning this
return ex2; // depends on control dependency: [if], data = [none]
}
}
/* no such extension in this certificate */
return null; // depends on control dependency: [if], data = [none]
}
} catch (IOException ioe) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void initializeToolbar() {
Condition.INSTANCE.ensureTrue(getSupportActionBar() == null,
"An action bar is already attached to the activity. Use the theme " +
"\"@style/Theme.MaterialComponents.NoActionBar\" or " +
"\"@style/Theme.MaterialComponents.Light.NoActionBar\" as the activity's theme",
IllegalStateException.class);
if (isSplitScreen()) {
toolbarLarge.setVisibility(View.VISIBLE);
} else {
toolbar.setVisibility(View.VISIBLE);
}
setSupportActionBar(toolbar);
resetTitle();
} } | public class class_name {
private void initializeToolbar() {
Condition.INSTANCE.ensureTrue(getSupportActionBar() == null,
"An action bar is already attached to the activity. Use the theme " +
"\"@style/Theme.MaterialComponents.NoActionBar\" or " +
"\"@style/Theme.MaterialComponents.Light.NoActionBar\" as the activity's theme",
IllegalStateException.class);
if (isSplitScreen()) {
toolbarLarge.setVisibility(View.VISIBLE); // depends on control dependency: [if], data = [none]
} else {
toolbar.setVisibility(View.VISIBLE); // depends on control dependency: [if], data = [none]
}
setSupportActionBar(toolbar);
resetTitle();
} } |
public class class_name {
public void marshall(UpdateEndpointRequest updateEndpointRequest, ProtocolMarshaller protocolMarshaller) {
if (updateEndpointRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateEndpointRequest.getApplicationId(), APPLICATIONID_BINDING);
protocolMarshaller.marshall(updateEndpointRequest.getEndpointId(), ENDPOINTID_BINDING);
protocolMarshaller.marshall(updateEndpointRequest.getEndpointRequest(), ENDPOINTREQUEST_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateEndpointRequest updateEndpointRequest, ProtocolMarshaller protocolMarshaller) {
if (updateEndpointRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateEndpointRequest.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateEndpointRequest.getEndpointId(), ENDPOINTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateEndpointRequest.getEndpointRequest(), ENDPOINTREQUEST_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 update(Versionable target, Versionable source) {
target.setDirty(source.getDirty());
target.setMajorVersion(source.getMajorVersion());
target.setMidVersion(source.getMidVersion());
target.setMinorVersion(source.getMinorVersion());
target.setModifierId(source.getModifierId());
target.setReason(source.getReason());
target.setModificationTime(source.getModificationTime());
target.setHistoryList(source.getHistoryList());
try {
target.updateHistory();
}
catch (Exception ex) {
LOG.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
}
} } | public class class_name {
public void update(Versionable target, Versionable source) {
target.setDirty(source.getDirty());
target.setMajorVersion(source.getMajorVersion());
target.setMidVersion(source.getMidVersion());
target.setMinorVersion(source.getMinorVersion());
target.setModifierId(source.getModifierId());
target.setReason(source.getReason());
target.setModificationTime(source.getModificationTime());
target.setHistoryList(source.getHistoryList());
try {
target.updateHistory();
// depends on control dependency: [try], data = [none]
}
catch (Exception ex) {
LOG.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int execSelectCount(String preparedSql, Object[] searchKeys) {
log("#execSelectCount preparedSql=" + preparedSql + " searchKeys=" + searchKeys);
int retVal = 0;
PreparedStatement preparedStmt = null;
ResultSet rs = null;
final Connection conn = createConnection();
try {
preparedStmt = conn.prepareStatement(preparedSql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
final StringBuilder logSb = new StringBuilder();
if (searchKeys != null) {
logSb.append("/ ");
for (int i = 0; i < searchKeys.length; i++) {
setObject((i + 1), preparedStmt, searchKeys[i]);
logSb.append("key(" + (i + 1) + ")=" + searchKeys[i]);
logSb.append(" ");
}
}
log("#execSelectCount SQL=" + preparedSql + " " + logSb.toString());
// execute SQL
rs = preparedStmt.executeQuery();
while (rs.next()) {
retVal = rs.getInt(1);
}
} catch (Exception e) {
loge("#execSelectCount", e);
} finally {
try {
if (rs != null) {
rs.close();
}
if (preparedStmt != null) {
preparedStmt.close();
}
if (conn != null) {
conn.close();
}
} catch (SQLException e) {
loge("#execSelectCount", e);
}
}
return retVal;
} } | public class class_name {
public int execSelectCount(String preparedSql, Object[] searchKeys) {
log("#execSelectCount preparedSql=" + preparedSql + " searchKeys=" + searchKeys);
int retVal = 0;
PreparedStatement preparedStmt = null;
ResultSet rs = null;
final Connection conn = createConnection();
try {
preparedStmt = conn.prepareStatement(preparedSql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // depends on control dependency: [try], data = [none]
final StringBuilder logSb = new StringBuilder();
if (searchKeys != null) {
logSb.append("/ "); // depends on control dependency: [if], data = [none]
for (int i = 0; i < searchKeys.length; i++) {
setObject((i + 1), preparedStmt, searchKeys[i]); // depends on control dependency: [for], data = [i]
logSb.append("key(" + (i + 1) + ")=" + searchKeys[i]);
logSb.append(" "); // depends on control dependency: [for], data = [none]
}
}
log("#execSelectCount SQL=" + preparedSql + " " + logSb.toString()); // depends on control dependency: [try], data = [none]
// execute SQL
rs = preparedStmt.executeQuery(); // depends on control dependency: [try], data = [none]
while (rs.next()) {
retVal = rs.getInt(1); // depends on control dependency: [while], data = [none]
}
} catch (Exception e) {
loge("#execSelectCount", e);
} finally { // depends on control dependency: [catch], data = [none]
try {
if (rs != null) {
rs.close(); // depends on control dependency: [if], data = [none]
}
if (preparedStmt != null) {
preparedStmt.close(); // depends on control dependency: [if], data = [none]
}
if (conn != null) {
conn.close(); // depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
loge("#execSelectCount", e);
} // depends on control dependency: [catch], data = [none]
}
return retVal;
} } |
public class class_name {
public Object find(Class clazz, Object identifier) {
try {
return persistenceManager.findById(clazz, identifier);
} catch (InitializationException ignore){}
catch (Exception e) {
e.printStackTrace();
}
return null;
} } | public class class_name {
public Object find(Class clazz, Object identifier) {
try {
return persistenceManager.findById(clazz, identifier); // depends on control dependency: [try], data = [none]
} catch (InitializationException ignore){} // depends on control dependency: [catch], data = [none]
catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
@Override
public List<CommerceUserSegmentEntry> filterFindByG_A(long groupId,
boolean active, int start, int end,
OrderByComparator<CommerceUserSegmentEntry> orderByComparator) {
if (!InlineSQLHelperUtil.isEnabled(groupId)) {
return findByG_A(groupId, active, start, end, orderByComparator);
}
StringBundler query = null;
if (orderByComparator != null) {
query = new StringBundler(4 +
(orderByComparator.getOrderByFields().length * 2));
}
else {
query = new StringBundler(5);
}
if (getDB().isSupportsInlineDistinct()) {
query.append(_FILTER_SQL_SELECT_COMMERCEUSERSEGMENTENTRY_WHERE);
}
else {
query.append(_FILTER_SQL_SELECT_COMMERCEUSERSEGMENTENTRY_NO_INLINE_DISTINCT_WHERE_1);
}
query.append(_FINDER_COLUMN_G_A_GROUPID_2);
query.append(_FINDER_COLUMN_G_A_ACTIVE_2_SQL);
if (!getDB().isSupportsInlineDistinct()) {
query.append(_FILTER_SQL_SELECT_COMMERCEUSERSEGMENTENTRY_NO_INLINE_DISTINCT_WHERE_2);
}
if (orderByComparator != null) {
if (getDB().isSupportsInlineDistinct()) {
appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
orderByComparator, true);
}
else {
appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
orderByComparator, true);
}
}
else {
if (getDB().isSupportsInlineDistinct()) {
query.append(CommerceUserSegmentEntryModelImpl.ORDER_BY_JPQL);
}
else {
query.append(CommerceUserSegmentEntryModelImpl.ORDER_BY_SQL);
}
}
String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
CommerceUserSegmentEntry.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
Session session = null;
try {
session = openSession();
SQLQuery q = session.createSynchronizedSQLQuery(sql);
if (getDB().isSupportsInlineDistinct()) {
q.addEntity(_FILTER_ENTITY_ALIAS,
CommerceUserSegmentEntryImpl.class);
}
else {
q.addEntity(_FILTER_ENTITY_TABLE,
CommerceUserSegmentEntryImpl.class);
}
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
qPos.add(active);
return (List<CommerceUserSegmentEntry>)QueryUtil.list(q,
getDialect(), start, end);
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public List<CommerceUserSegmentEntry> filterFindByG_A(long groupId,
boolean active, int start, int end,
OrderByComparator<CommerceUserSegmentEntry> orderByComparator) {
if (!InlineSQLHelperUtil.isEnabled(groupId)) {
return findByG_A(groupId, active, start, end, orderByComparator); // depends on control dependency: [if], data = [none]
}
StringBundler query = null;
if (orderByComparator != null) {
query = new StringBundler(4 +
(orderByComparator.getOrderByFields().length * 2)); // depends on control dependency: [if], data = [none]
}
else {
query = new StringBundler(5); // depends on control dependency: [if], data = [none]
}
if (getDB().isSupportsInlineDistinct()) {
query.append(_FILTER_SQL_SELECT_COMMERCEUSERSEGMENTENTRY_WHERE); // depends on control dependency: [if], data = [none]
}
else {
query.append(_FILTER_SQL_SELECT_COMMERCEUSERSEGMENTENTRY_NO_INLINE_DISTINCT_WHERE_1); // depends on control dependency: [if], data = [none]
}
query.append(_FINDER_COLUMN_G_A_GROUPID_2);
query.append(_FINDER_COLUMN_G_A_ACTIVE_2_SQL);
if (!getDB().isSupportsInlineDistinct()) {
query.append(_FILTER_SQL_SELECT_COMMERCEUSERSEGMENTENTRY_NO_INLINE_DISTINCT_WHERE_2); // depends on control dependency: [if], data = [none]
}
if (orderByComparator != null) {
if (getDB().isSupportsInlineDistinct()) {
appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
orderByComparator, true); // depends on control dependency: [if], data = [none]
}
else {
appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
orderByComparator, true); // depends on control dependency: [if], data = [none]
}
}
else {
if (getDB().isSupportsInlineDistinct()) {
query.append(CommerceUserSegmentEntryModelImpl.ORDER_BY_JPQL); // depends on control dependency: [if], data = [none]
}
else {
query.append(CommerceUserSegmentEntryModelImpl.ORDER_BY_SQL); // depends on control dependency: [if], data = [none]
}
}
String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
CommerceUserSegmentEntry.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
SQLQuery q = session.createSynchronizedSQLQuery(sql);
if (getDB().isSupportsInlineDistinct()) {
q.addEntity(_FILTER_ENTITY_ALIAS,
CommerceUserSegmentEntryImpl.class); // depends on control dependency: [if], data = [none]
}
else {
q.addEntity(_FILTER_ENTITY_TABLE,
CommerceUserSegmentEntryImpl.class); // depends on control dependency: [if], data = [none]
}
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId); // depends on control dependency: [try], data = [none]
qPos.add(active); // depends on control dependency: [try], data = [none]
return (List<CommerceUserSegmentEntry>)QueryUtil.list(q,
getDialect(), start, end); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
} } |
public class class_name {
int findNextMainLine(LiveFileChunk chunk, int startIdx) {
List<FileLine> lines = chunk.getLines();
int found = -1;
for (int i = startIdx; found == -1 && i < lines.size(); i++) {
if (pattern.matcher(lines.get(i).getText().trim()).matches()) {
found = i;
}
}
return found;
} } | public class class_name {
int findNextMainLine(LiveFileChunk chunk, int startIdx) {
List<FileLine> lines = chunk.getLines();
int found = -1;
for (int i = startIdx; found == -1 && i < lines.size(); i++) {
if (pattern.matcher(lines.get(i).getText().trim()).matches()) {
found = i; // depends on control dependency: [if], data = [none]
}
}
return found;
} } |
public class class_name {
static void shutDown() {
if (prefHelper_ != null) {
prefHelper_.prefsEditor_ = null;
}
// Reset all of the statics.
enableLogging_ = false;
Branch_Key = null;
savedAnalyticsData_ = null;
prefHelper_ = null;
} } | public class class_name {
static void shutDown() {
if (prefHelper_ != null) {
prefHelper_.prefsEditor_ = null; // depends on control dependency: [if], data = [none]
}
// Reset all of the statics.
enableLogging_ = false;
Branch_Key = null;
savedAnalyticsData_ = null;
prefHelper_ = null;
} } |
public class class_name {
public void marshall(LaunchConfig launchConfig, ProtocolMarshaller protocolMarshaller) {
if (launchConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(launchConfig.getPackageName(), PACKAGENAME_BINDING);
protocolMarshaller.marshall(launchConfig.getLaunchFile(), LAUNCHFILE_BINDING);
protocolMarshaller.marshall(launchConfig.getEnvironmentVariables(), ENVIRONMENTVARIABLES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LaunchConfig launchConfig, ProtocolMarshaller protocolMarshaller) {
if (launchConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(launchConfig.getPackageName(), PACKAGENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(launchConfig.getLaunchFile(), LAUNCHFILE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(launchConfig.getEnvironmentVariables(), ENVIRONMENTVARIABLES_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 final void mIDENT_LIST() throws RecognitionException {
try {
int _type = IDENT_LIST;
int _channel = DEFAULT_TOKEN_CHANNEL;
// BELScript.g:269:11: ( '{' OBJECT_IDENT ( COMMA OBJECT_IDENT )* '}' )
// BELScript.g:270:5: '{' OBJECT_IDENT ( COMMA OBJECT_IDENT )* '}'
{
match('{');
mOBJECT_IDENT();
// BELScript.g:270:22: ( COMMA OBJECT_IDENT )*
loop3:
do {
int alt3=2;
int LA3_0 = input.LA(1);
if ( (LA3_0==' '||LA3_0==',') ) {
alt3=1;
}
switch (alt3) {
case 1 :
// BELScript.g:270:23: COMMA OBJECT_IDENT
{
mCOMMA();
mOBJECT_IDENT();
}
break;
default :
break loop3;
}
} while (true);
match('}');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
} } | public class class_name {
public final void mIDENT_LIST() throws RecognitionException {
try {
int _type = IDENT_LIST;
int _channel = DEFAULT_TOKEN_CHANNEL;
// BELScript.g:269:11: ( '{' OBJECT_IDENT ( COMMA OBJECT_IDENT )* '}' )
// BELScript.g:270:5: '{' OBJECT_IDENT ( COMMA OBJECT_IDENT )* '}'
{
match('{');
mOBJECT_IDENT();
// BELScript.g:270:22: ( COMMA OBJECT_IDENT )*
loop3:
do {
int alt3=2;
int LA3_0 = input.LA(1);
if ( (LA3_0==' '||LA3_0==',') ) {
alt3=1; // depends on control dependency: [if], data = [none]
}
switch (alt3) {
case 1 :
// BELScript.g:270:23: COMMA OBJECT_IDENT
{
mCOMMA();
mOBJECT_IDENT();
}
break;
default :
break loop3;
}
} while (true);
match('}');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
} } |
public class class_name {
@Override
public byte[] serialize(Object theObject)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.entry(tc, "serialize = " + theObject.getClass());
}
byte[] idBytes = null;
if (theObject instanceof WrapperProxy) // F58064
{
WrapperProxyState state = WrapperProxyState.getWrapperProxyState(theObject);
idBytes = state.getSerializerBytes();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "serialized a WrapperProxy for " + state);
}
else
{
EJSWrapperBase wrapper = null;
if (theObject instanceof EJSWrapperBase)
{
wrapper = (EJSWrapperBase) theObject;
}
else if (theObject instanceof LocalBeanWrapper) // d609263
{
wrapper = EJSWrapperCommon.getLocalBeanWrapperBase((LocalBeanWrapper) theObject);
}
else
{
throw new IllegalArgumentException(" theObject parameter must be a EJB_LOCAL, EJB_LOCAL_HOME"
+ ", EJB_BUSINESS_LOCAL, or EJB_BUSINESS_REMOTE ObjectType. Use the getObjectType"
+ " to obtain the ObjectType.");
}
// Get the BeanId and WrapperInterface from the wrapper.
BeanId beanId = wrapper.beanId;
WrapperInterface wrapperInterface = wrapper.ivInterface;
BeanMetaData bmd = wrapper.bmd;
// Use type of wrapper interface to determine whether to
// serialize a WrapperId or a BeanId object.
if (wrapperInterface == WrapperInterface.BUSINESS_LOCAL)
{
// Serialize a WrapperId for local business interface.
int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
String interfaceName;
if (interfaceIndex == EJSWrapperBase.AGGREGATE_LOCAL_INDEX) { // F743-34304
interfaceName = EJSWrapperBase.AGGREGATE_EYE_CATCHER; // d677413
} else {
Class<?> biClass = bmd.ivBusinessLocalInterfaceClasses[interfaceIndex];
interfaceName = biClass.getName();
}
WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
, interfaceName
, interfaceIndex);
idBytes = wrapperId.getBytes();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
+ ", local business interface = " + interfaceName);
}
}
else if (wrapperInterface == WrapperInterface.BUSINESS_REMOTE)
{
// Serialize a WrapperId for remote business interface.
int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
Class<?> biClass = bmd.ivBusinessRemoteInterfaceClasses[interfaceIndex];
String interfaceName = biClass.getName();
WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
, interfaceName
, interfaceIndex);
idBytes = wrapperId.getBytes();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
+ ", remote business interface = " + interfaceName);
}
}
else if (wrapperInterface == WrapperInterface.BUSINESS_RMI_REMOTE)
{
// Serialize a WrapperId for a RMI remote business interface.
int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
Class<?> biClass = bmd.ivBusinessRemoteInterfaceClasses[interfaceIndex];
String interfaceName = biClass.getName();
WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
, interfaceName
, interfaceIndex);
idBytes = wrapperId.getBytes();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
+ ", RMI remote business interface = " + interfaceName);
}
}
else
{
// Not a business interface, so must be a local or remote interface of
// a 2.1 bean or a 2.1 view of a EJB 3 bean. Either case, we only need
// to save the BeanId for this kind of wrapper.
idBytes = beanId.getByteArrayBytes(); //d466573
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "serialized a BeanId = " + beanId);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.exit(tc, "serialize");
}
return idBytes;
} } | public class class_name {
@Override
public byte[] serialize(Object theObject)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.entry(tc, "serialize = " + theObject.getClass()); // depends on control dependency: [if], data = [none]
}
byte[] idBytes = null;
if (theObject instanceof WrapperProxy) // F58064
{
WrapperProxyState state = WrapperProxyState.getWrapperProxyState(theObject);
idBytes = state.getSerializerBytes(); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "serialized a WrapperProxy for " + state);
}
else
{
EJSWrapperBase wrapper = null;
if (theObject instanceof EJSWrapperBase)
{
wrapper = (EJSWrapperBase) theObject; // depends on control dependency: [if], data = [none]
}
else if (theObject instanceof LocalBeanWrapper) // d609263
{
wrapper = EJSWrapperCommon.getLocalBeanWrapperBase((LocalBeanWrapper) theObject); // depends on control dependency: [if], data = [none]
}
else
{
throw new IllegalArgumentException(" theObject parameter must be a EJB_LOCAL, EJB_LOCAL_HOME"
+ ", EJB_BUSINESS_LOCAL, or EJB_BUSINESS_REMOTE ObjectType. Use the getObjectType"
+ " to obtain the ObjectType.");
}
// Get the BeanId and WrapperInterface from the wrapper.
BeanId beanId = wrapper.beanId;
WrapperInterface wrapperInterface = wrapper.ivInterface;
BeanMetaData bmd = wrapper.bmd;
// Use type of wrapper interface to determine whether to
// serialize a WrapperId or a BeanId object.
if (wrapperInterface == WrapperInterface.BUSINESS_LOCAL)
{
// Serialize a WrapperId for local business interface.
int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
String interfaceName;
if (interfaceIndex == EJSWrapperBase.AGGREGATE_LOCAL_INDEX) { // F743-34304
interfaceName = EJSWrapperBase.AGGREGATE_EYE_CATCHER; // d677413 // depends on control dependency: [if], data = [none]
} else {
Class<?> biClass = bmd.ivBusinessLocalInterfaceClasses[interfaceIndex];
interfaceName = biClass.getName();
}
WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
, interfaceName
, interfaceIndex);
idBytes = wrapperId.getBytes(); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
+ ", local business interface = " + interfaceName); // depends on control dependency: [if], data = [none]
}
}
else if (wrapperInterface == WrapperInterface.BUSINESS_REMOTE)
{
// Serialize a WrapperId for remote business interface.
int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
Class<?> biClass = bmd.ivBusinessRemoteInterfaceClasses[interfaceIndex];
String interfaceName = biClass.getName();
WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
, interfaceName
, interfaceIndex);
idBytes = wrapperId.getBytes();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
+ ", remote business interface = " + interfaceName);
}
}
else if (wrapperInterface == WrapperInterface.BUSINESS_RMI_REMOTE)
{
// Serialize a WrapperId for a RMI remote business interface.
int interfaceIndex = wrapper.ivBusinessInterfaceIndex;
Class<?> biClass = bmd.ivBusinessRemoteInterfaceClasses[interfaceIndex];
String interfaceName = biClass.getName();
WrapperId wrapperId = new WrapperId(beanId.getByteArrayBytes() //d458325
, interfaceName
, interfaceIndex);
idBytes = wrapperId.getBytes();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "serialized a WrapperId for BeanId = " + beanId
+ ", RMI remote business interface = " + interfaceName);
}
}
else
{
// Not a business interface, so must be a local or remote interface of
// a 2.1 bean or a 2.1 view of a EJB 3 bean. Either case, we only need
// to save the BeanId for this kind of wrapper.
idBytes = beanId.getByteArrayBytes(); //d466573 // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "serialized a BeanId = " + beanId); // depends on control dependency: [if], data = [none]
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.exit(tc, "serialize"); // depends on control dependency: [if], data = [none]
}
return idBytes;
} } |
public class class_name {
public boolean isKieContainerUpdateDuringRolloutAllowed(ConfigMap cm, KieServerState newState) {
KieServerState state = (KieServerState) xs.fromXML(cm.getData().get(CFG_MAP_DATA_KEY));
for (KieContainerResource container : state.getContainers()) {
if (container.getStatus().equals(KieContainerStatus.STARTED) &&
newState.getContainers().stream()
.anyMatch(c -> c.getContainerId().equals(container.getContainerId()) &&
c.getStatus().equals(KieContainerStatus.STOPPED))) {
logger.warn("Non KieServer process updated KieServerState during DC rollout for STOPPING containers.");
return true;
}
}
logger.warn("Non KieServer process updates KieServerState during DC rollout is prohibited!");
return false;
} } | public class class_name {
public boolean isKieContainerUpdateDuringRolloutAllowed(ConfigMap cm, KieServerState newState) {
KieServerState state = (KieServerState) xs.fromXML(cm.getData().get(CFG_MAP_DATA_KEY));
for (KieContainerResource container : state.getContainers()) {
if (container.getStatus().equals(KieContainerStatus.STARTED) &&
newState.getContainers().stream()
.anyMatch(c -> c.getContainerId().equals(container.getContainerId()) &&
c.getStatus().equals(KieContainerStatus.STOPPED))) {
logger.warn("Non KieServer process updated KieServerState during DC rollout for STOPPING containers."); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
logger.warn("Non KieServer process updates KieServerState during DC rollout is prohibited!");
return false;
} } |
public class class_name {
protected String convertToHex(int i) {
String hexString = Integer.toHexString(i);
while (hexString.length() < 2) {
hexString = "0" + hexString;
}
return hexString;
} } | public class class_name {
protected String convertToHex(int i) {
String hexString = Integer.toHexString(i);
while (hexString.length() < 2) {
hexString = "0" + hexString; // depends on control dependency: [while], data = [none]
}
return hexString;
} } |
public class class_name {
@SuppressWarnings("unchecked")
private CompletionStage<List<V>> invokeMapBatchLoader(List<K> keys, BatchLoaderEnvironment environment) {
CompletionStage<Map<K, V>> loadResult;
Set<K> setOfKeys = new LinkedHashSet<>(keys);
if (batchLoadFunction instanceof MappedBatchLoaderWithContext) {
loadResult = ((MappedBatchLoaderWithContext<K, V>) batchLoadFunction).load(setOfKeys, environment);
} else {
loadResult = ((MappedBatchLoader<K, V>) batchLoadFunction).load(setOfKeys);
}
CompletionStage<Map<K, V>> mapBatchLoad = nonNull(loadResult, "Your batch loader function MUST return a non null CompletionStage promise");
return mapBatchLoad.thenApply(map -> {
List<V> values = new ArrayList<>();
for (K key : keys) {
V value = map.get(key);
values.add(value);
}
return values;
});
} } | public class class_name {
@SuppressWarnings("unchecked")
private CompletionStage<List<V>> invokeMapBatchLoader(List<K> keys, BatchLoaderEnvironment environment) {
CompletionStage<Map<K, V>> loadResult;
Set<K> setOfKeys = new LinkedHashSet<>(keys);
if (batchLoadFunction instanceof MappedBatchLoaderWithContext) {
loadResult = ((MappedBatchLoaderWithContext<K, V>) batchLoadFunction).load(setOfKeys, environment); // depends on control dependency: [if], data = [none]
} else {
loadResult = ((MappedBatchLoader<K, V>) batchLoadFunction).load(setOfKeys); // depends on control dependency: [if], data = [none]
}
CompletionStage<Map<K, V>> mapBatchLoad = nonNull(loadResult, "Your batch loader function MUST return a non null CompletionStage promise");
return mapBatchLoad.thenApply(map -> {
List<V> values = new ArrayList<>();
for (K key : keys) {
V value = map.get(key);
values.add(value); // depends on control dependency: [for], data = [none]
}
return values;
});
} } |
public class class_name {
protected Object[] getBatch() {
Object[] objectArray = new Object[batchSize];
int index = 1;
synchronized (this) {
objectArray[0] = get(); // always get at least 1
while (getCurrentNumElements() > minPoolSize / 2 && index < batchSize) {
objectArray[index] = get();
index++;
}
}
return objectArray;
} } | public class class_name {
protected Object[] getBatch() {
Object[] objectArray = new Object[batchSize];
int index = 1;
synchronized (this) {
objectArray[0] = get(); // always get at least 1
while (getCurrentNumElements() > minPoolSize / 2 && index < batchSize) {
objectArray[index] = get(); // depends on control dependency: [while], data = [none]
index++; // depends on control dependency: [while], data = [none]
}
}
return objectArray;
} } |
public class class_name {
String mappedTypeName(String internalName) {
String remappedInternalName = classesToRemap.get(internalName);
if (remappedInternalName != null) {
return remappedInternalName;
} else {
return internalName;
}
} } | public class class_name {
String mappedTypeName(String internalName) {
String remappedInternalName = classesToRemap.get(internalName);
if (remappedInternalName != null) {
return remappedInternalName; // depends on control dependency: [if], data = [none]
} else {
return internalName; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ListAuditTasksResult withTasks(AuditTaskMetadata... tasks) {
if (this.tasks == null) {
setTasks(new java.util.ArrayList<AuditTaskMetadata>(tasks.length));
}
for (AuditTaskMetadata ele : tasks) {
this.tasks.add(ele);
}
return this;
} } | public class class_name {
public ListAuditTasksResult withTasks(AuditTaskMetadata... tasks) {
if (this.tasks == null) {
setTasks(new java.util.ArrayList<AuditTaskMetadata>(tasks.length)); // depends on control dependency: [if], data = [none]
}
for (AuditTaskMetadata ele : tasks) {
this.tasks.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private Type getRequiredType(Class<?> clazz)
{
TypeVariable<?>[] typeParameters = clazz.getTypeParameters();
if (typeParameters.length > 0) {
Type[] actualTypeParameters = new Type[typeParameters.length];
for (int i = 0; i < typeParameters.length; i++) {
actualTypeParameters[i] = new WildcardTypeImpl(new Type[] { Object.class }, new Type[] {});
}
return new ParameterizedTypeImpl(clazz, actualTypeParameters, null);
}
return clazz;
} } | public class class_name {
private Type getRequiredType(Class<?> clazz)
{
TypeVariable<?>[] typeParameters = clazz.getTypeParameters();
if (typeParameters.length > 0) {
Type[] actualTypeParameters = new Type[typeParameters.length];
for (int i = 0; i < typeParameters.length; i++) {
actualTypeParameters[i] = new WildcardTypeImpl(new Type[] { Object.class }, new Type[] {}); // depends on control dependency: [for], data = [i]
}
return new ParameterizedTypeImpl(clazz, actualTypeParameters, null); // depends on control dependency: [if], data = [none]
}
return clazz;
} } |
public class class_name {
@Override
public int read(ByteBuffer buffer) throws IOException {
throwIfNotOpen();
// Don't try to read if the buffer has no space.
if (buffer.remaining() == 0) {
return 0;
}
logger.atFine().log(
"Reading %s bytes at %s position from '%s'",
buffer.remaining(), currentPosition, resourceIdString);
// Do not perform any further reads if we already read everything from this channel.
if (currentPosition == size) {
return -1;
}
int totalBytesRead = 0;
int retriesAttempted = 0;
// We read from a streaming source. We may not get all the bytes we asked for
// in the first read. Therefore, loop till we either read the required number of
// bytes or we reach end-of-stream.
do {
int remainingBeforeRead = buffer.remaining();
performLazySeek(remainingBeforeRead);
checkState(
contentChannelPosition == currentPosition,
"contentChannelPosition (%s) should be equal to currentPosition (%s) after lazy seek",
contentChannelPosition, currentPosition);
try {
int numBytesRead = contentChannel.read(buffer);
checkIOPrecondition(numBytesRead != 0, "Read 0 bytes without blocking");
if (numBytesRead < 0) {
// Because we don't know decompressed object size for gzip-encoded objects,
// assume that this is an object end.
if (gzipEncoded) {
size = currentPosition;
contentChannelEnd = currentPosition;
}
// Check that we didn't get a premature End of Stream signal by checking the number of
// bytes read against the stream size. Unfortunately we don't have information about the
// actual size of the data stream when stream compression is used, so we can only ignore
// this case here.
checkIOPrecondition(
currentPosition == contentChannelEnd || currentPosition == size,
String.format(
"Received end of stream result before all the file data has been received; "
+ "totalBytesRead: %d, currentPosition: %d,"
+ " contentChannelEnd %d, size: %d, object: '%s'",
totalBytesRead, currentPosition, contentChannelEnd, size, resourceIdString));
// If we have reached an end of a contentChannel but not an end of an object
// then close contentChannel and continue reading an object if necessary.
if (contentChannelEnd != size && currentPosition == contentChannelEnd) {
closeContentChannel();
} else {
break;
}
}
if (numBytesRead > 0) {
totalBytesRead += numBytesRead;
currentPosition += numBytesRead;
contentChannelPosition += numBytesRead;
checkState(
contentChannelPosition == currentPosition,
"contentChannelPosition (%s) should be equal to currentPosition (%s)"
+ " after successful read",
contentChannelPosition, currentPosition);
}
if (retriesAttempted != 0) {
logger.atInfo().log(
"Success after %s retries on reading '%s'", retriesAttempted, resourceIdString);
}
// The count of retriesAttempted is per low-level contentChannel.read call;
// each time we make progress we reset the retry counter.
retriesAttempted = 0;
} catch (IOException ioe) {
logger.atFine().log(
"Closing contentChannel after %s exception for '%s'.",
ioe.getMessage(), resourceIdString);
closeContentChannel();
if (buffer.remaining() != remainingBeforeRead) {
int partialRead = remainingBeforeRead - buffer.remaining();
logger.atInfo().log(
"Despite exception, had partial read of %s bytes from '%s'; resetting retry count.",
partialRead, resourceIdString);
retriesAttempted = 0;
totalBytesRead += partialRead;
currentPosition += partialRead;
}
// TODO(user): Refactor any reusable logic for retries into a separate RetryHelper class.
if (retriesAttempted == maxRetries) {
logger.atSevere().log(
"Throwing exception after reaching max read retries (%s) for '%s'.",
maxRetries, resourceIdString);
throw ioe;
}
if (retriesAttempted == 0) {
// If this is the first of a series of retries, we also want to reset the readBackOff
// to have fresh initial values.
readBackOff.get().reset();
}
++retriesAttempted;
logger.atWarning().withCause(ioe).log(
"Failed read retry #%s/%s for '%s'. Sleeping...",
retriesAttempted, maxRetries, resourceIdString);
try {
boolean backOffSuccessful = BackOffUtils.next(sleeper, readBackOff.get());
if (!backOffSuccessful) {
logger.atSevere().log(
"BackOff returned false; maximum total elapsed time exhausted."
+ " Giving up after %s/%s retries for '%s'",
retriesAttempted, maxRetries, resourceIdString);
throw ioe;
}
} catch (InterruptedException ie) {
logger.atSevere().log(
"Interrupted while sleeping before retry. Giving up after %s/%s retries for '%s'",
retriesAttempted, maxRetries, resourceIdString);
ioe.addSuppressed(ie);
throw ioe;
}
logger.atInfo().log(
"Done sleeping before retry #%s/%s for '%s'",
retriesAttempted, maxRetries, resourceIdString);
} catch (RuntimeException r) {
closeContentChannel();
throw r;
}
} while (buffer.remaining() > 0 && currentPosition < size);
// If this method was called when the stream was already at EOF
// (indicated by totalBytesRead == 0) then return EOF else,
// return the number of bytes read.
boolean isEndOfStream = (totalBytesRead == 0);
if (isEndOfStream) {
// Check that we didn't get a premature End of Stream signal by checking the number of bytes
// read against the stream size. Unfortunately we don't have information about the actual size
// of the data stream when stream compression is used, so we can only ignore this case here.
checkIOPrecondition(
currentPosition == size,
String.format(
"Failed to read any data before all the file data has been received;"
+ " currentPosition: %d, size: %d, object '%s'",
currentPosition, size, resourceIdString));
return -1;
}
return totalBytesRead;
} } | public class class_name {
@Override
public int read(ByteBuffer buffer) throws IOException {
throwIfNotOpen();
// Don't try to read if the buffer has no space.
if (buffer.remaining() == 0) {
return 0;
}
logger.atFine().log(
"Reading %s bytes at %s position from '%s'",
buffer.remaining(), currentPosition, resourceIdString);
// Do not perform any further reads if we already read everything from this channel.
if (currentPosition == size) {
return -1;
}
int totalBytesRead = 0;
int retriesAttempted = 0;
// We read from a streaming source. We may not get all the bytes we asked for
// in the first read. Therefore, loop till we either read the required number of
// bytes or we reach end-of-stream.
do {
int remainingBeforeRead = buffer.remaining();
performLazySeek(remainingBeforeRead);
checkState(
contentChannelPosition == currentPosition,
"contentChannelPosition (%s) should be equal to currentPosition (%s) after lazy seek",
contentChannelPosition, currentPosition);
try {
int numBytesRead = contentChannel.read(buffer);
checkIOPrecondition(numBytesRead != 0, "Read 0 bytes without blocking");
if (numBytesRead < 0) {
// Because we don't know decompressed object size for gzip-encoded objects,
// assume that this is an object end.
if (gzipEncoded) {
size = currentPosition; // depends on control dependency: [if], data = [none]
contentChannelEnd = currentPosition; // depends on control dependency: [if], data = [none]
}
// Check that we didn't get a premature End of Stream signal by checking the number of
// bytes read against the stream size. Unfortunately we don't have information about the
// actual size of the data stream when stream compression is used, so we can only ignore
// this case here.
checkIOPrecondition(
currentPosition == contentChannelEnd || currentPosition == size,
String.format(
"Received end of stream result before all the file data has been received; "
+ "totalBytesRead: %d, currentPosition: %d,"
+ " contentChannelEnd %d, size: %d, object: '%s'",
totalBytesRead, currentPosition, contentChannelEnd, size, resourceIdString));
// If we have reached an end of a contentChannel but not an end of an object
// then close contentChannel and continue reading an object if necessary.
if (contentChannelEnd != size && currentPosition == contentChannelEnd) {
closeContentChannel();
} else {
break;
}
}
if (numBytesRead > 0) {
totalBytesRead += numBytesRead;
currentPosition += numBytesRead;
contentChannelPosition += numBytesRead;
checkState(
contentChannelPosition == currentPosition,
"contentChannelPosition (%s) should be equal to currentPosition (%s)"
+ " after successful read",
contentChannelPosition, currentPosition);
}
if (retriesAttempted != 0) {
logger.atInfo().log(
"Success after %s retries on reading '%s'", retriesAttempted, resourceIdString);
}
// The count of retriesAttempted is per low-level contentChannel.read call;
// each time we make progress we reset the retry counter.
retriesAttempted = 0;
} catch (IOException ioe) {
logger.atFine().log(
"Closing contentChannel after %s exception for '%s'.",
ioe.getMessage(), resourceIdString);
closeContentChannel();
if (buffer.remaining() != remainingBeforeRead) {
int partialRead = remainingBeforeRead - buffer.remaining();
logger.atInfo().log(
"Despite exception, had partial read of %s bytes from '%s'; resetting retry count.",
partialRead, resourceIdString);
retriesAttempted = 0;
totalBytesRead += partialRead;
currentPosition += partialRead;
}
// TODO(user): Refactor any reusable logic for retries into a separate RetryHelper class.
if (retriesAttempted == maxRetries) {
logger.atSevere().log(
"Throwing exception after reaching max read retries (%s) for '%s'.",
maxRetries, resourceIdString);
throw ioe;
}
if (retriesAttempted == 0) {
// If this is the first of a series of retries, we also want to reset the readBackOff
// to have fresh initial values.
readBackOff.get().reset();
}
++retriesAttempted;
logger.atWarning().withCause(ioe).log(
"Failed read retry #%s/%s for '%s'. Sleeping...",
retriesAttempted, maxRetries, resourceIdString);
try {
boolean backOffSuccessful = BackOffUtils.next(sleeper, readBackOff.get());
if (!backOffSuccessful) {
logger.atSevere().log(
"BackOff returned false; maximum total elapsed time exhausted."
+ " Giving up after %s/%s retries for '%s'",
retriesAttempted, maxRetries, resourceIdString);
throw ioe;
}
} catch (InterruptedException ie) {
logger.atSevere().log(
"Interrupted while sleeping before retry. Giving up after %s/%s retries for '%s'",
retriesAttempted, maxRetries, resourceIdString);
ioe.addSuppressed(ie);
throw ioe;
}
logger.atInfo().log(
"Done sleeping before retry #%s/%s for '%s'",
retriesAttempted, maxRetries, resourceIdString);
} catch (RuntimeException r) {
closeContentChannel();
throw r;
}
} while (buffer.remaining() > 0 && currentPosition < size);
// If this method was called when the stream was already at EOF
// (indicated by totalBytesRead == 0) then return EOF else,
// return the number of bytes read.
boolean isEndOfStream = (totalBytesRead == 0);
if (isEndOfStream) {
// Check that we didn't get a premature End of Stream signal by checking the number of bytes
// read against the stream size. Unfortunately we don't have information about the actual size
// of the data stream when stream compression is used, so we can only ignore this case here.
checkIOPrecondition(
currentPosition == size,
String.format(
"Failed to read any data before all the file data has been received;"
+ " currentPosition: %d, size: %d, object '%s'",
currentPosition, size, resourceIdString)); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
return totalBytesRead;
} } |
public class class_name {
final SIBUuid12 getTopicSpaceUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getTopicSpaceUuid");
SibTr.exit(tc, "getTopicSpaceUuid", _topicSpaceUuid);
}
return _topicSpaceUuid;
} } | public class class_name {
final SIBUuid12 getTopicSpaceUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getTopicSpaceUuid"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "getTopicSpaceUuid", _topicSpaceUuid); // depends on control dependency: [if], data = [none]
}
return _topicSpaceUuid;
} } |
public class class_name {
public void startReading() {
logcat.setListener(new Logcat.Listener() {
@Override public void onTraceRead(String logcatTrace) {
try {
addTraceToTheBuffer(logcatTrace);
} catch (IllegalTraceException e) {
return;
}
notifyNewTraces();
}
});
boolean logcatWasNotStarted = Thread.State.NEW.equals(logcat.getState());
if (logcatWasNotStarted) {
logcat.start();
}
} } | public class class_name {
public void startReading() {
logcat.setListener(new Logcat.Listener() {
@Override public void onTraceRead(String logcatTrace) {
try {
addTraceToTheBuffer(logcatTrace); // depends on control dependency: [try], data = [none]
} catch (IllegalTraceException e) {
return;
} // depends on control dependency: [catch], data = [none]
notifyNewTraces();
}
});
boolean logcatWasNotStarted = Thread.State.NEW.equals(logcat.getState());
if (logcatWasNotStarted) {
logcat.start(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String toRFC2253String(boolean canonical) {
if (canonical == false) {
return toRFC2253StringInternal
(false, Collections.<String, String>emptyMap());
}
String c = canonicalString;
if (c == null) {
c = toRFC2253StringInternal
(true, Collections.<String, String>emptyMap());
canonicalString = c;
}
return c;
} } | public class class_name {
public String toRFC2253String(boolean canonical) {
if (canonical == false) {
return toRFC2253StringInternal
(false, Collections.<String, String>emptyMap()); // depends on control dependency: [if], data = [none]
}
String c = canonicalString;
if (c == null) {
c = toRFC2253StringInternal
(true, Collections.<String, String>emptyMap()); // depends on control dependency: [if], data = [none]
canonicalString = c; // depends on control dependency: [if], data = [none]
}
return c;
} } |
public class class_name {
private List<String> filterMonadics(String[] args) {// name-value for monads
List<String> filteredArgs = new ArrayList<>(); // Y <- return List
for (String arg : args) { // iterate over args
filteredArgs.add(arg);
Parameter param = parameters.get(arg);
if (param != null && param.paramType == ParameterType.MONADIC) {
filteredArgs.add("1"); // insert a value to "1"
}
}
return filteredArgs; // return List of args
} } | public class class_name {
private List<String> filterMonadics(String[] args) {// name-value for monads
List<String> filteredArgs = new ArrayList<>(); // Y <- return List
for (String arg : args) { // iterate over args
filteredArgs.add(arg); // depends on control dependency: [for], data = [arg]
Parameter param = parameters.get(arg);
if (param != null && param.paramType == ParameterType.MONADIC) {
filteredArgs.add("1"); // insert a value to "1" // depends on control dependency: [if], data = [none]
}
}
return filteredArgs; // return List of args
} } |
public class class_name {
public static Integer getS3StreamBufferSize() {
String s =
System.getProperty(SDKGlobalConfiguration.DEFAULT_S3_STREAM_BUFFER_SIZE);
if (s == null)
return null;
try {
return Integer.valueOf(s);
} catch (Exception e) {
log.warn("Unable to parse buffer size override from value: " + s);
}
return null;
} } | public class class_name {
public static Integer getS3StreamBufferSize() {
String s =
System.getProperty(SDKGlobalConfiguration.DEFAULT_S3_STREAM_BUFFER_SIZE);
if (s == null)
return null;
try {
return Integer.valueOf(s); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.warn("Unable to parse buffer size override from value: " + s);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public <C extends RpcGateway> C getSelfGateway(Class<C> selfGatewayType) {
if (selfGatewayType.isInstance(rpcServer)) {
@SuppressWarnings("unchecked")
C selfGateway = ((C) rpcServer);
return selfGateway;
} else {
throw new RuntimeException("RpcEndpoint does not implement the RpcGateway interface of type " + selfGatewayType + '.');
}
} } | public class class_name {
public <C extends RpcGateway> C getSelfGateway(Class<C> selfGatewayType) {
if (selfGatewayType.isInstance(rpcServer)) {
@SuppressWarnings("unchecked")
C selfGateway = ((C) rpcServer);
return selfGateway; // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("RpcEndpoint does not implement the RpcGateway interface of type " + selfGatewayType + '.'); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void add(byte b, Collection c) {
if ((c != null) && (c.size() > 0)) {
String s2 = get(b);
for (Object aC : c) {
String s = (String) aC;
if (s2 == null)
s2 = s;
else
s2 += lineSeparator + s;
}
set(b, s2);
}
} } | public class class_name {
public void add(byte b, Collection c) {
if ((c != null) && (c.size() > 0)) {
String s2 = get(b);
for (Object aC : c) {
String s = (String) aC;
if (s2 == null)
s2 = s;
else
s2 += lineSeparator + s;
}
set(b, s2);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected Map<String,RDFNode> readNext() throws SparqlException {
try {
// read <result> or </results>
int eventType = reader.nextTag();
// if a closing element, then it should be </results>
if (eventType == END_ELEMENT) {
// already read the final result, so clean up and return nothing
if (nameIs(RESULTS)) {
cleanup();
return null;
}
else throw new SparqlException("Bad element closure with: " + reader.getLocalName());
}
// we only expect a <result> here
testOpen(eventType, RESULT, "Expected a new result. Got :" +
((eventType == END_ELEMENT) ? "/" : "") + reader.getLocalName());
Map<String,RDFNode> result = new HashMap<String,RDFNode>();
// read <binding> list
while ((eventType = reader.nextTag()) == START_ELEMENT && nameIs(BINDING)) {
// get the name of the binding
String name = reader.getAttributeValue(null, VAR_NAME);
result.put(name, parseValue());
testClose(reader.nextTag(), BINDING, "Single Binding not closed correctly");
}
// a non- <binding> was read, so it should have been a </result>
testClose(eventType, RESULT, "Single Result not closed correctly");
return result;
} catch (XMLStreamException e) {
throw new SparqlException("Error reading from XML stream", e);
}
} } | public class class_name {
protected Map<String,RDFNode> readNext() throws SparqlException {
try {
// read <result> or </results>
int eventType = reader.nextTag();
// if a closing element, then it should be </results>
if (eventType == END_ELEMENT) {
// already read the final result, so clean up and return nothing
if (nameIs(RESULTS)) {
cleanup(); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
else throw new SparqlException("Bad element closure with: " + reader.getLocalName());
}
// we only expect a <result> here
testOpen(eventType, RESULT, "Expected a new result. Got :" +
((eventType == END_ELEMENT) ? "/" : "") + reader.getLocalName());
Map<String,RDFNode> result = new HashMap<String,RDFNode>();
// read <binding> list
while ((eventType = reader.nextTag()) == START_ELEMENT && nameIs(BINDING)) {
// get the name of the binding
String name = reader.getAttributeValue(null, VAR_NAME);
result.put(name, parseValue());
testClose(reader.nextTag(), BINDING, "Single Binding not closed correctly");
}
// a non- <binding> was read, so it should have been a </result>
testClose(eventType, RESULT, "Single Result not closed correctly");
return result;
} catch (XMLStreamException e) {
throw new SparqlException("Error reading from XML stream", e);
}
} } |
public class class_name {
@Override
public InputStream getInputStream(String fileName) throws IOException {
InputStream inputStream = null;
if (fileExists(fileName)) {
String extension = getExtension(fileName);
if (isExternalSupported(extension)) {
inputStream = startExternal(fileName);
} else if (isInternalSupported(extension)) {
inputStream = internalSupport.get(extension).getInputStream(
fileName);
} else {
inputStream = getDefault(fileName);
}
}
return inputStream;
} } | public class class_name {
@Override
public InputStream getInputStream(String fileName) throws IOException {
InputStream inputStream = null;
if (fileExists(fileName)) {
String extension = getExtension(fileName);
if (isExternalSupported(extension)) {
inputStream = startExternal(fileName); // depends on control dependency: [if], data = [none]
} else if (isInternalSupported(extension)) {
inputStream = internalSupport.get(extension).getInputStream(
fileName); // depends on control dependency: [if], data = [none]
} else {
inputStream = getDefault(fileName); // depends on control dependency: [if], data = [none]
}
}
return inputStream;
} } |
public class class_name {
public Matrix getMatrix(int i0, int i1, int j0, int j1)
{
Matrix X = new Matrix(i1 - i0 + 1, j1 - j0 + 1);
double[][] B = X.getArray();
try
{
for (int i = i0; i <= i1; i++)
{
for (int j = j0; j <= j1; j++)
{
B[i - i0][j - j0] = A[i][j];
}
}
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new ArrayIndexOutOfBoundsException("Submatrix indices");
}
return X;
} } | public class class_name {
public Matrix getMatrix(int i0, int i1, int j0, int j1)
{
Matrix X = new Matrix(i1 - i0 + 1, j1 - j0 + 1);
double[][] B = X.getArray();
try
{
for (int i = i0; i <= i1; i++)
{
for (int j = j0; j <= j1; j++)
{
B[i - i0][j - j0] = A[i][j]; // depends on control dependency: [for], data = [j]
}
}
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new ArrayIndexOutOfBoundsException("Submatrix indices");
} // depends on control dependency: [catch], data = [none]
return X;
} } |
public class class_name {
static Statement ifElseChain(final List<IfBlock> ifs, final Optional<Statement> elseBlock) {
checkArgument(!ifs.isEmpty());
return new Statement() {
@Override
protected void doGen(CodeBuilder adapter) {
Label end = new Label();
Label next;
for (int i = 0; i < ifs.size(); i++) {
IfBlock curr = ifs.get(i);
boolean isLastIfBlock = i == ifs.size() - 1;
if (isLastIfBlock && !elseBlock.isPresent()) {
next = end;
} else {
next = new Label();
}
curr.condition().gen(adapter);
adapter.ifZCmp(Opcodes.IFEQ, next);
curr.block().gen(adapter);
if (end != next) {
adapter.goTo(end);
}
adapter.mark(next);
}
if (elseBlock.isPresent()) {
elseBlock.get().gen(adapter);
adapter.mark(end);
}
}
};
} } | public class class_name {
static Statement ifElseChain(final List<IfBlock> ifs, final Optional<Statement> elseBlock) {
checkArgument(!ifs.isEmpty());
return new Statement() {
@Override
protected void doGen(CodeBuilder adapter) {
Label end = new Label();
Label next;
for (int i = 0; i < ifs.size(); i++) {
IfBlock curr = ifs.get(i);
boolean isLastIfBlock = i == ifs.size() - 1;
if (isLastIfBlock && !elseBlock.isPresent()) {
next = end; // depends on control dependency: [if], data = [none]
} else {
next = new Label(); // depends on control dependency: [if], data = [none]
}
curr.condition().gen(adapter); // depends on control dependency: [for], data = [none]
adapter.ifZCmp(Opcodes.IFEQ, next); // depends on control dependency: [for], data = [none]
curr.block().gen(adapter); // depends on control dependency: [for], data = [none]
if (end != next) {
adapter.goTo(end); // depends on control dependency: [if], data = [(end]
}
adapter.mark(next); // depends on control dependency: [for], data = [none]
}
if (elseBlock.isPresent()) {
elseBlock.get().gen(adapter); // depends on control dependency: [if], data = [none]
adapter.mark(end); // depends on control dependency: [if], data = [none]
}
}
};
} } |
public class class_name {
String showDetail() {
if (isDefault() || isEmpty()) {
return "";
} else {
return entries.stream()
.map(sue -> "---- " + sue.name
+ (sue.timeStamp.isEmpty()
? ""
: " @ " + sue.timeStamp)
+ " ----\n" + sue.content)
.collect(joining());
}
} } | public class class_name {
String showDetail() {
if (isDefault() || isEmpty()) {
return ""; // depends on control dependency: [if], data = [none]
} else {
return entries.stream()
.map(sue -> "---- " + sue.name
+ (sue.timeStamp.isEmpty()
? ""
: " @ " + sue.timeStamp)
+ " ----\n" + sue.content)
.collect(joining()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static base_responses add(nitro_service client, route6 resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
route6 addresources[] = new route6[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new route6();
addresources[i].network = resources[i].network;
addresources[i].gateway = resources[i].gateway;
addresources[i].vlan = resources[i].vlan;
addresources[i].weight = resources[i].weight;
addresources[i].distance = resources[i].distance;
addresources[i].cost = resources[i].cost;
addresources[i].advertise = resources[i].advertise;
addresources[i].msr = resources[i].msr;
addresources[i].monitor = resources[i].monitor;
addresources[i].td = resources[i].td;
}
result = add_bulk_request(client, addresources);
}
return result;
} } | public class class_name {
public static base_responses add(nitro_service client, route6 resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
route6 addresources[] = new route6[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new route6(); // depends on control dependency: [for], data = [i]
addresources[i].network = resources[i].network; // depends on control dependency: [for], data = [i]
addresources[i].gateway = resources[i].gateway; // depends on control dependency: [for], data = [i]
addresources[i].vlan = resources[i].vlan; // depends on control dependency: [for], data = [i]
addresources[i].weight = resources[i].weight; // depends on control dependency: [for], data = [i]
addresources[i].distance = resources[i].distance; // depends on control dependency: [for], data = [i]
addresources[i].cost = resources[i].cost; // depends on control dependency: [for], data = [i]
addresources[i].advertise = resources[i].advertise; // depends on control dependency: [for], data = [i]
addresources[i].msr = resources[i].msr; // depends on control dependency: [for], data = [i]
addresources[i].monitor = resources[i].monitor; // depends on control dependency: [for], data = [i]
addresources[i].td = resources[i].td; // depends on control dependency: [for], data = [i]
}
result = add_bulk_request(client, addresources);
}
return result;
} } |
public class class_name {
public static void transmit(TracingSetter tracingSetter) {
if (TracingContext.tracing().hasGroup()) {
log.debug("tracing transmit group:{}", TracingContext.tracing().groupId());
tracingSetter.set(TracingConstants.HEADER_KEY_GROUP_ID, TracingContext.tracing().groupId());
tracingSetter.set(TracingConstants.HEADER_KEY_APP_MAP,
Base64Utils.encodeToString(TracingContext.tracing().appMapString().getBytes(StandardCharsets.UTF_8)));
}
} } | public class class_name {
public static void transmit(TracingSetter tracingSetter) {
if (TracingContext.tracing().hasGroup()) {
log.debug("tracing transmit group:{}", TracingContext.tracing().groupId()); // depends on control dependency: [if], data = [none]
tracingSetter.set(TracingConstants.HEADER_KEY_GROUP_ID, TracingContext.tracing().groupId()); // depends on control dependency: [if], data = [none]
tracingSetter.set(TracingConstants.HEADER_KEY_APP_MAP,
Base64Utils.encodeToString(TracingContext.tracing().appMapString().getBytes(StandardCharsets.UTF_8))); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void processMessage(CommsByteBuffer buffer, boolean asyncMessage,
boolean enableReadAhead, Conversation conversation, boolean chunk)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "processMessage",
new Object[]{buffer, asyncMessage, enableReadAhead, conversation, chunk});
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) buffer.dump(this, tc, CommsByteBuffer.ENTIRE_BUFFER);
// Connection object ID - not needed by us
short connectionObjectID = buffer.getShort();
// Client session ID (proxy ID)
short clientSessionID = buffer.getShort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "connectionObjectId: ", ""+connectionObjectID);
SibTr.debug(this, tc, "clientSessionID: ", ""+clientSessionID);
}
boolean lastInBatch = false;
if (asyncMessage)
{
// Flags
short flags = buffer.getShort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "lastInBatchFlag: ", ""+flags);
if (flags == 0x0001) lastInBatch = true;
}
// Message Batch
short messageBatch = buffer.getShort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "messageBatch: ", ""+messageBatch);
// Data length for debug purposes only
if (chunk)
{
// Get the next 8 bytes which will contain 1 byte of flags, 4 bytes of length and then some
// message data
long next8bytes = buffer.peekLong();
// Chop the message data
long messageLength = next8bytes >> 24;
// Chop off the 5th byte
messageLength &= ~0xFF00000000L;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a message chunk of length: " + messageLength);
}
else
{
int messageLength = (int) buffer.peekLong();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a message of length: " + messageLength);
}
// Now pass the info off to the proxy queue
// Get the conversation state and the get the proxy group from it
ProxyQueueConversationGroup pqcg = ((ClientConversationState) conversation.getAttachment()).getProxyQueueConversationGroup();
// If this is null, something has gone wrong here
if (pqcg == null)
{
SIErrorException e = new SIErrorException(nls.getFormattedMessage("NO_PROXY_CONV_GROUP_SICO1011", null, null));
FFDCFilter.processException(e, CLASS_NAME + ".processAsyncMessage",
CommsConstants.PROXYRECEIVELISTENER_PROCESSMSG_01, this);
SibTr.error(tc, "NO_PROXY_CONV_GROUP_SICO1011", e);
throw e;
}
// Otherwise get the proxy queue
ProxyQueue proxyQueue = pqcg.find(clientSessionID);
if (proxyQueue == null)
{
SIErrorException e = new SIErrorException(nls.getFormattedMessage("UNABLE_TO_FIND_PROXY_QUEUE_SICO1012", null, null));
FFDCFilter.processException(e, CLASS_NAME + ".processAsyncMessage",
CommsConstants.PROXYRECEIVELISTENER_PROCESSMSG_01, this);
SibTr.error(tc, "UNABLE_TO_FIND_PROXY_QUEUE_SICO1012", e);
throw e;
}
// and put the message
proxyQueue.put(buffer, messageBatch, lastInBatch, chunk);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "processMessage");
} } | public class class_name {
private void processMessage(CommsByteBuffer buffer, boolean asyncMessage,
boolean enableReadAhead, Conversation conversation, boolean chunk)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "processMessage",
new Object[]{buffer, asyncMessage, enableReadAhead, conversation, chunk});
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) buffer.dump(this, tc, CommsByteBuffer.ENTIRE_BUFFER);
// Connection object ID - not needed by us
short connectionObjectID = buffer.getShort();
// Client session ID (proxy ID)
short clientSessionID = buffer.getShort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "connectionObjectId: ", ""+connectionObjectID); // depends on control dependency: [if], data = [none]
SibTr.debug(this, tc, "clientSessionID: ", ""+clientSessionID); // depends on control dependency: [if], data = [none]
}
boolean lastInBatch = false;
if (asyncMessage)
{
// Flags
short flags = buffer.getShort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "lastInBatchFlag: ", ""+flags);
if (flags == 0x0001) lastInBatch = true;
}
// Message Batch
short messageBatch = buffer.getShort();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "messageBatch: ", ""+messageBatch);
// Data length for debug purposes only
if (chunk)
{
// Get the next 8 bytes which will contain 1 byte of flags, 4 bytes of length and then some
// message data
long next8bytes = buffer.peekLong();
// Chop the message data
long messageLength = next8bytes >> 24;
// Chop off the 5th byte
messageLength &= ~0xFF00000000L; // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a message chunk of length: " + messageLength);
}
else
{
int messageLength = (int) buffer.peekLong();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received a message of length: " + messageLength);
}
// Now pass the info off to the proxy queue
// Get the conversation state and the get the proxy group from it
ProxyQueueConversationGroup pqcg = ((ClientConversationState) conversation.getAttachment()).getProxyQueueConversationGroup();
// If this is null, something has gone wrong here
if (pqcg == null)
{
SIErrorException e = new SIErrorException(nls.getFormattedMessage("NO_PROXY_CONV_GROUP_SICO1011", null, null));
FFDCFilter.processException(e, CLASS_NAME + ".processAsyncMessage",
CommsConstants.PROXYRECEIVELISTENER_PROCESSMSG_01, this); // depends on control dependency: [if], data = [none]
SibTr.error(tc, "NO_PROXY_CONV_GROUP_SICO1011", e); // depends on control dependency: [if], data = [none]
throw e;
}
// Otherwise get the proxy queue
ProxyQueue proxyQueue = pqcg.find(clientSessionID);
if (proxyQueue == null)
{
SIErrorException e = new SIErrorException(nls.getFormattedMessage("UNABLE_TO_FIND_PROXY_QUEUE_SICO1012", null, null));
FFDCFilter.processException(e, CLASS_NAME + ".processAsyncMessage",
CommsConstants.PROXYRECEIVELISTENER_PROCESSMSG_01, this); // depends on control dependency: [if], data = [none]
SibTr.error(tc, "UNABLE_TO_FIND_PROXY_QUEUE_SICO1012", e); // depends on control dependency: [if], data = [none]
throw e;
}
// and put the message
proxyQueue.put(buffer, messageBatch, lastInBatch, chunk);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "processMessage");
} } |
public class class_name {
public static GrayU8 yu12ToGray(byte[] data , int width , int height , GrayU8 output ) {
if( output != null ) {
if( output.width != width || output.height != height )
throw new IllegalArgumentException("output width and height must be "+width+" "+height);
} else {
output = new GrayU8(width,height);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToGray(data, output);
} else {
ImplConvertNV21.nv21ToGray(data, output);
}
return output;
} } | public class class_name {
public static GrayU8 yu12ToGray(byte[] data , int width , int height , GrayU8 output ) {
if( output != null ) {
if( output.width != width || output.height != height )
throw new IllegalArgumentException("output width and height must be "+width+" "+height);
} else {
output = new GrayU8(width,height); // depends on control dependency: [if], data = [none]
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToGray(data, output); // depends on control dependency: [if], data = [none]
} else {
ImplConvertNV21.nv21ToGray(data, output); // depends on control dependency: [if], data = [none]
}
return output;
} } |
public class class_name {
public synchronized static void install() {
if (!isInstalled()) {
InputStream is = BMPCLocalLauncher.class.getResourceAsStream(BMP_LOCAL_ZIP_RES);
try {
// Unzip BrowserMob Proxy contained in the project "/resources"
unzip(is, BMPC_USER_DIR);
// Set executable permissions on the BrowserMob Proxy lanching scripts
new File(BMP_LOCAL_EXEC_UNIX).setExecutable(true);
new File(BMP_LOCAL_EXEC_WIN).setExecutable(true);
// Check there is an installed version
installedVersion();
} catch (Exception e) {
throw new BMPCUnexpectedErrorException("Installation failed", e);
}
}
} } | public class class_name {
public synchronized static void install() {
if (!isInstalled()) {
InputStream is = BMPCLocalLauncher.class.getResourceAsStream(BMP_LOCAL_ZIP_RES);
try {
// Unzip BrowserMob Proxy contained in the project "/resources"
unzip(is, BMPC_USER_DIR); // depends on control dependency: [try], data = [none]
// Set executable permissions on the BrowserMob Proxy lanching scripts
new File(BMP_LOCAL_EXEC_UNIX).setExecutable(true); // depends on control dependency: [try], data = [none]
new File(BMP_LOCAL_EXEC_WIN).setExecutable(true); // depends on control dependency: [try], data = [none]
// Check there is an installed version
installedVersion(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new BMPCUnexpectedErrorException("Installation failed", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void purge(Instant limit) {
Instant firstKeeper = values.floorKey(limit);
if (firstKeeper == null) return;
Set<Instant> purgables = values.headMap(firstKeeper).keySet();
if (purgables == null) return;
for (Instant purgable : purgables) {
values.remove(purgable);
}
} } | public class class_name {
public void purge(Instant limit) {
Instant firstKeeper = values.floorKey(limit);
if (firstKeeper == null) return;
Set<Instant> purgables = values.headMap(firstKeeper).keySet();
if (purgables == null) return;
for (Instant purgable : purgables) {
values.remove(purgable); // depends on control dependency: [for], data = [purgable]
}
} } |
public class class_name {
private EntryEventType getCQCEventTypeOrNull(EntryEventType eventType, EventFilter eventFilter,
Data dataKey, Data dataNewValue, Data dataOldValue, String mapName) {
boolean newValueMatching = filteringStrategy.doFilter(eventFilter, dataKey, dataOldValue, dataNewValue,
eventType, mapName) != FilteringStrategy.FILTER_DOES_NOT_MATCH;
if (eventType == UPDATED) {
// UPDATED event has a special handling as it might result in either ADDING or REMOVING an entry to/from CQC
// depending on a predicate
boolean oldValueMatching = filteringStrategy.doFilter(eventFilter, dataKey, null, dataOldValue,
EntryEventType.ADDED, mapName) != FilteringStrategy.FILTER_DOES_NOT_MATCH;
if (oldValueMatching) {
if (!newValueMatching) {
eventType = REMOVED;
}
} else {
if (newValueMatching) {
eventType = ADDED;
} else {
//neither old value nor new value is matching -> it's a non-event for the CQC
return null;
}
}
} else if (!newValueMatching) {
return null;
}
return eventType;
} } | public class class_name {
private EntryEventType getCQCEventTypeOrNull(EntryEventType eventType, EventFilter eventFilter,
Data dataKey, Data dataNewValue, Data dataOldValue, String mapName) {
boolean newValueMatching = filteringStrategy.doFilter(eventFilter, dataKey, dataOldValue, dataNewValue,
eventType, mapName) != FilteringStrategy.FILTER_DOES_NOT_MATCH;
if (eventType == UPDATED) {
// UPDATED event has a special handling as it might result in either ADDING or REMOVING an entry to/from CQC
// depending on a predicate
boolean oldValueMatching = filteringStrategy.doFilter(eventFilter, dataKey, null, dataOldValue,
EntryEventType.ADDED, mapName) != FilteringStrategy.FILTER_DOES_NOT_MATCH;
if (oldValueMatching) {
if (!newValueMatching) {
eventType = REMOVED; // depends on control dependency: [if], data = [none]
}
} else {
if (newValueMatching) {
eventType = ADDED; // depends on control dependency: [if], data = [none]
} else {
//neither old value nor new value is matching -> it's a non-event for the CQC
return null; // depends on control dependency: [if], data = [none]
}
}
} else if (!newValueMatching) {
return null; // depends on control dependency: [if], data = [none]
}
return eventType;
} } |
public class class_name {
public String getName()
{
GVRSceneObject owner = getOwnerObject();
String name = "";
if (owner != null)
{
name = owner.getName();
if (name == null)
return "";
}
return name;
} } | public class class_name {
public String getName()
{
GVRSceneObject owner = getOwnerObject();
String name = "";
if (owner != null)
{
name = owner.getName(); // depends on control dependency: [if], data = [none]
if (name == null)
return "";
}
return name;
} } |
public class class_name {
private RouteImpl createRouteImpl(String path, String acceptType, Route route) {
if (defaultResponseTransformer != null) {
return ResponseTransformerRouteImpl.create(path, acceptType, route, defaultResponseTransformer);
}
return RouteImpl.create(path, acceptType, route);
} } | public class class_name {
private RouteImpl createRouteImpl(String path, String acceptType, Route route) {
if (defaultResponseTransformer != null) {
return ResponseTransformerRouteImpl.create(path, acceptType, route, defaultResponseTransformer); // depends on control dependency: [if], data = [none]
}
return RouteImpl.create(path, acceptType, route);
} } |
public class class_name {
public static int equal(int b, int c) {
int result = 0;
int xor = b ^ c;
for (int i = 0; i < 8; i++) {
result |= xor >> i;
}
return (result ^ 0x01) & 0x01;
} } | public class class_name {
public static int equal(int b, int c) {
int result = 0;
int xor = b ^ c;
for (int i = 0; i < 8; i++) {
result |= xor >> i; // depends on control dependency: [for], data = [i]
}
return (result ^ 0x01) & 0x01;
} } |
public class class_name {
public void setBuildWorkspaceReader(List<Artifact> artifacts) {
BuildWorkspaceReader reader = new BuildWorkspaceReader();
for ( Artifact artifact : artifacts ) {
reader.addArtifact( artifact );
}
systemSession = (MavenRepositorySystemSession)systemSession.setWorkspaceReader( reader );
} } | public class class_name {
public void setBuildWorkspaceReader(List<Artifact> artifacts) {
BuildWorkspaceReader reader = new BuildWorkspaceReader();
for ( Artifact artifact : artifacts ) {
reader.addArtifact( artifact ); // depends on control dependency: [for], data = [artifact]
}
systemSession = (MavenRepositorySystemSession)systemSession.setWorkspaceReader( reader );
} } |
public class class_name {
public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws UnsupportedRepositoryOperationException,
NoSuchWorkspaceException, AccessDeniedException, MergeException, RepositoryException, InvalidItemStateException
{
checkValid();
if (!session.getAccessManager().hasPermission(getACL(),
new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
{
throw new AccessDeniedException("Access denied: checkin operation " + getPath() + " for: "
+ session.getUserID() + " item owner " + getACL().getOwner());
}
if (session.hasPendingChanges())
{
throw new InvalidItemStateException("Session has pending changes ");
}
Map<String, String> failed = new HashMap<String, String>();
// get corresponding node
SessionImpl corrSession =
((RepositoryImpl)session.getRepository()).internalLogin(session.getUserState(), srcWorkspace);
ItemDataMergeVisitor visitor = new ItemDataMergeVisitor(this.session, corrSession, failed, bestEffort);
this.nodeData().accept(visitor);
SessionChangesLog changes = visitor.getMergeChanges();
EntityCollection failedIter = createMergeFailed(failed, changes);
if (changes.getSize() > 0)
{
dataManager.getTransactManager().save(changes);
}
return failedIter;
} } | public class class_name {
public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws UnsupportedRepositoryOperationException,
NoSuchWorkspaceException, AccessDeniedException, MergeException, RepositoryException, InvalidItemStateException
{
checkValid();
if (!session.getAccessManager().hasPermission(getACL(),
new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
{
throw new AccessDeniedException("Access denied: checkin operation " + getPath() + " for: "
+ session.getUserID() + " item owner " + getACL().getOwner());
}
if (session.hasPendingChanges())
{
throw new InvalidItemStateException("Session has pending changes ");
}
Map<String, String> failed = new HashMap<String, String>();
// get corresponding node
SessionImpl corrSession =
((RepositoryImpl)session.getRepository()).internalLogin(session.getUserState(), srcWorkspace);
ItemDataMergeVisitor visitor = new ItemDataMergeVisitor(this.session, corrSession, failed, bestEffort);
this.nodeData().accept(visitor);
SessionChangesLog changes = visitor.getMergeChanges();
EntityCollection failedIter = createMergeFailed(failed, changes);
if (changes.getSize() > 0)
{
dataManager.getTransactManager().save(changes); // depends on control dependency: [if], data = [none]
}
return failedIter;
} } |
public class class_name {
private static boolean matchesPrototypeInstanceVar(Node node, NodeMetadata metadata,
String name) {
String[] parts = name.split(".prototype.");
String className = parts[0];
String propertyName = parts[1];
JSType providedJsType = getJsType(metadata, className);
if (providedJsType == null) {
return false;
}
JSType jsType = null;
if (node.hasChildren()) {
jsType = node.getFirstChild().getJSType();
}
if (jsType == null) {
return false;
}
jsType = jsType.restrictByNotNullOrUndefined();
if (!jsType.isUnknownType()
&& !jsType.isAllType()
&& jsType.isSubtypeOf(providedJsType)) {
if (node.isName() && propertyName.equals(node.getString())) {
return true;
} else if (node.isGetProp()
&& propertyName.equals(node.getLastChild().getString())) {
return true;
}
}
return false;
} } | public class class_name {
private static boolean matchesPrototypeInstanceVar(Node node, NodeMetadata metadata,
String name) {
String[] parts = name.split(".prototype.");
String className = parts[0];
String propertyName = parts[1];
JSType providedJsType = getJsType(metadata, className);
if (providedJsType == null) {
return false; // depends on control dependency: [if], data = [none]
}
JSType jsType = null;
if (node.hasChildren()) {
jsType = node.getFirstChild().getJSType(); // depends on control dependency: [if], data = [none]
}
if (jsType == null) {
return false; // depends on control dependency: [if], data = [none]
}
jsType = jsType.restrictByNotNullOrUndefined();
if (!jsType.isUnknownType()
&& !jsType.isAllType()
&& jsType.isSubtypeOf(providedJsType)) {
if (node.isName() && propertyName.equals(node.getString())) {
return true; // depends on control dependency: [if], data = [none]
} else if (node.isGetProp()
&& propertyName.equals(node.getLastChild().getString())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@Override
public Iterator<Map.Entry<String, MaintenanceOp>> listMaintenanceOps() {
final Iterator<Map<String, Object>> tableIter =
_backingStore.scan(_systemTable, null, LimitCounter.max(), ReadConsistency.STRONG);
return new AbstractIterator<Map.Entry<String, MaintenanceOp>>() {
@Override
protected Map.Entry<String, MaintenanceOp> computeNext() {
while (tableIter.hasNext()) {
TableJson json = new TableJson(tableIter.next());
MaintenanceOp op = getNextMaintenanceOp(json, false/*don't expose task outside this class*/);
if (op != null) {
return Maps.immutableEntry(json.getTable(), op);
}
}
return endOfData();
}
};
} } | public class class_name {
@Override
public Iterator<Map.Entry<String, MaintenanceOp>> listMaintenanceOps() {
final Iterator<Map<String, Object>> tableIter =
_backingStore.scan(_systemTable, null, LimitCounter.max(), ReadConsistency.STRONG);
return new AbstractIterator<Map.Entry<String, MaintenanceOp>>() {
@Override
protected Map.Entry<String, MaintenanceOp> computeNext() {
while (tableIter.hasNext()) {
TableJson json = new TableJson(tableIter.next());
MaintenanceOp op = getNextMaintenanceOp(json, false/*don't expose task outside this class*/);
if (op != null) {
return Maps.immutableEntry(json.getTable(), op); // depends on control dependency: [if], data = [none]
}
}
return endOfData();
}
};
} } |
public class class_name {
protected void ensureProcessDefinitionInitialized() {
if ((processDefinition == null) && (processDefinitionId != null)) {
ProcessDefinitionEntity deployedProcessDefinition = Context.getProcessEngineConfiguration().getDeploymentCache()
.findDeployedProcessDefinitionById(processDefinitionId);
setProcessDefinition(deployedProcessDefinition);
}
} } | public class class_name {
protected void ensureProcessDefinitionInitialized() {
if ((processDefinition == null) && (processDefinitionId != null)) {
ProcessDefinitionEntity deployedProcessDefinition = Context.getProcessEngineConfiguration().getDeploymentCache()
.findDeployedProcessDefinitionById(processDefinitionId);
setProcessDefinition(deployedProcessDefinition); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
ModuleMarshal marshal(Class<?> sourceType)
{
ModuleMarshal marshal = _marshalSourceMap.get(sourceType);
if (marshal == null) {
marshal = marshalImpl(sourceType);
_marshalSourceMap.put(sourceType, marshal);
}
return marshal;
} } | public class class_name {
ModuleMarshal marshal(Class<?> sourceType)
{
ModuleMarshal marshal = _marshalSourceMap.get(sourceType);
if (marshal == null) {
marshal = marshalImpl(sourceType); // depends on control dependency: [if], data = [none]
_marshalSourceMap.put(sourceType, marshal); // depends on control dependency: [if], data = [none]
}
return marshal;
} } |
public class class_name {
@Override
public ConfigObject include(final ConfigIncludeContext context, String name) {
ConfigObject obj = includeWithoutFallback(context, name);
// now use the fallback includer if any and merge
// its result.
if (fallback != null) {
return obj.withFallback(fallback.include(context, name));
} else {
return obj;
}
} } | public class class_name {
@Override
public ConfigObject include(final ConfigIncludeContext context, String name) {
ConfigObject obj = includeWithoutFallback(context, name);
// now use the fallback includer if any and merge
// its result.
if (fallback != null) {
return obj.withFallback(fallback.include(context, name)); // depends on control dependency: [if], data = [(fallback]
} else {
return obj; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public BaseVertex getOpposite(BaseVertex vertex) {
// If null or not part of this connection
if ( vertex == null || (!vertex.equals( getSource() ) && !vertex.equals( getTarget() )) ) {
return null;
}
if ( vertex.equals( getSource() ) ) {
return getTarget();
}
return getSource();
} } | public class class_name {
public BaseVertex getOpposite(BaseVertex vertex) {
// If null or not part of this connection
if ( vertex == null || (!vertex.equals( getSource() ) && !vertex.equals( getTarget() )) ) {
return null; // depends on control dependency: [if], data = [none]
}
if ( vertex.equals( getSource() ) ) {
return getTarget(); // depends on control dependency: [if], data = [none]
}
return getSource();
} } |
public class class_name {
public void printHtmlSeeAlso(PrintWriter out, String strTag, String strParams, String strData)
{
String strSeeAlso = m_recDetail.getSeeAlso();
if ((strSeeAlso != null) && (strSeeAlso.length() > 0) && (strSeeAlso.indexOf('<') == -1))
{ // List of classes to reference
int iStartClass = 0;
while (true)
{
int iEndClass = strSeeAlso.indexOf(',', iStartClass);
if (iEndClass == -1)
iEndClass = strSeeAlso.length();
String strClass = strSeeAlso.substring(iStartClass, iEndClass);
this.parseHtmlClassInfo(out, strTag, strParams, strData, strClass);
iStartClass = iEndClass + 1;
if (iStartClass >= strSeeAlso.length())
break;
if (strSeeAlso.charAt(iStartClass) == ' ')
iStartClass++;
}
}
else
this.parseHtmlData(out, strSeeAlso);
} } | public class class_name {
public void printHtmlSeeAlso(PrintWriter out, String strTag, String strParams, String strData)
{
String strSeeAlso = m_recDetail.getSeeAlso();
if ((strSeeAlso != null) && (strSeeAlso.length() > 0) && (strSeeAlso.indexOf('<') == -1))
{ // List of classes to reference
int iStartClass = 0;
while (true)
{
int iEndClass = strSeeAlso.indexOf(',', iStartClass);
if (iEndClass == -1)
iEndClass = strSeeAlso.length();
String strClass = strSeeAlso.substring(iStartClass, iEndClass);
this.parseHtmlClassInfo(out, strTag, strParams, strData, strClass); // depends on control dependency: [while], data = [none]
iStartClass = iEndClass + 1; // depends on control dependency: [while], data = [none]
if (iStartClass >= strSeeAlso.length())
break;
if (strSeeAlso.charAt(iStartClass) == ' ')
iStartClass++;
}
}
else
this.parseHtmlData(out, strSeeAlso);
} } |
public class class_name {
public void registerListener(IPluginEvent listener) {
if (pluginEventListeners1 == null) {
pluginEventListeners1 = new ArrayList<>();
}
if (!pluginEventListeners1.contains(listener)) {
pluginEventListeners1.add(listener);
}
} } | public class class_name {
public void registerListener(IPluginEvent listener) {
if (pluginEventListeners1 == null) {
pluginEventListeners1 = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
if (!pluginEventListeners1.contains(listener)) {
pluginEventListeners1.add(listener); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Axis generateAxisFromRange(float start, float stop, float step) {
List<AxisValue> values = new ArrayList<AxisValue>();
for (float value = start; value <= stop; value += step) {
AxisValue axisValue = new AxisValue(value);
values.add(axisValue);
}
Axis axis = new Axis(values);
return axis;
} } | public class class_name {
public static Axis generateAxisFromRange(float start, float stop, float step) {
List<AxisValue> values = new ArrayList<AxisValue>();
for (float value = start; value <= stop; value += step) {
AxisValue axisValue = new AxisValue(value);
values.add(axisValue); // depends on control dependency: [for], data = [none]
}
Axis axis = new Axis(values);
return axis;
} } |
public class class_name {
@Override
public Mappings matchAll(final IAtomContainer target) {
final EdgeToBondMap bonds2;
final int[][] g2;
AdjListCache cached = target.getProperty(AdjListCache.class.getName());
if (cached == null || !cached.validate(target)) {
cached = new AdjListCache(target);
target.setProperty(AdjListCache.class.getName(), cached);
}
bonds2 = cached.bmap;
g2 = cached.g;
Iterable<int[]> iterable = new VFIterable(query, target,
g1, g2,
bonds1, bonds2,
atomMatcher, bondMatcher,
subgraph);
Mappings mappings = new Mappings(query, target, iterable);
return filter(mappings, query, target);
} } | public class class_name {
@Override
public Mappings matchAll(final IAtomContainer target) {
final EdgeToBondMap bonds2;
final int[][] g2;
AdjListCache cached = target.getProperty(AdjListCache.class.getName());
if (cached == null || !cached.validate(target)) {
cached = new AdjListCache(target); // depends on control dependency: [if], data = [none]
target.setProperty(AdjListCache.class.getName(), cached); // depends on control dependency: [if], data = [none]
}
bonds2 = cached.bmap;
g2 = cached.g;
Iterable<int[]> iterable = new VFIterable(query, target,
g1, g2,
bonds1, bonds2,
atomMatcher, bondMatcher,
subgraph);
Mappings mappings = new Mappings(query, target, iterable);
return filter(mappings, query, target);
} } |
public class class_name {
@Override
public void configurationChanged() {
HashSet<Param> changedParams = new HashSet();
// read dynamic parameters
for (Param param : parameters) {
if (! param.isStatic()) {
// preserve current value
Object oldValue = param.getValue();
// read new value
readAndValidateParameter(param);
// get if parameter value had changed
if (! ConfigUtil.equalValues(oldValue, param.getValue())) {
changedParams.add(param);
}
}
}
// invoke listeners for all changed parameters
if (! changedParams.isEmpty()) {
for (ConfigChangeListener listener : configChangeListeners) {
listener.configurationChanged(changedParams);
}
}
} } | public class class_name {
@Override
public void configurationChanged() {
HashSet<Param> changedParams = new HashSet();
// read dynamic parameters
for (Param param : parameters) {
if (! param.isStatic()) {
// preserve current value
Object oldValue = param.getValue();
// read new value
readAndValidateParameter(param); // depends on control dependency: [if], data = [none]
// get if parameter value had changed
if (! ConfigUtil.equalValues(oldValue, param.getValue())) {
changedParams.add(param); // depends on control dependency: [if], data = [none]
}
}
}
// invoke listeners for all changed parameters
if (! changedParams.isEmpty()) {
for (ConfigChangeListener listener : configChangeListeners) {
listener.configurationChanged(changedParams); // depends on control dependency: [for], data = [listener]
}
}
} } |
public class class_name {
protected void fadeInCurrentTheme() {
if (currentTheme != null) {
currentTheme.setLooping(false);
currentTheme.setVolume(0f);
currentTheme.setOnCompletionListener(listener);
stage.addAction(
VolumeAction.setVolume(currentTheme, 0f, musicVolume.getPercent(), duration, Interpolation.fade));
currentTheme.play();
}
} } | public class class_name {
protected void fadeInCurrentTheme() {
if (currentTheme != null) {
currentTheme.setLooping(false); // depends on control dependency: [if], data = [none]
currentTheme.setVolume(0f); // depends on control dependency: [if], data = [none]
currentTheme.setOnCompletionListener(listener); // depends on control dependency: [if], data = [none]
stage.addAction(
VolumeAction.setVolume(currentTheme, 0f, musicVolume.getPercent(), duration, Interpolation.fade)); // depends on control dependency: [if], data = [none]
currentTheme.play(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public String describe(Session session, int blanks) {
StringBuffer sb = new StringBuffer();
sb.append('\n');
for (int i = 0; i < blanks; i++) {
sb.append(' ');
}
sb.append("FUNCTION ").append("=[\n");
sb.append(name).append("(");
for (int i = 0; i < nodes.length; i++) {
if (nodes[i] != null) {
sb.append("[").append(nodes[i].describe(session)).append("]");
}
}
sb.append(") returns ").append(dataType.getNameString());
sb.append("]\n");
return sb.toString();
} } | public class class_name {
@Override
public String describe(Session session, int blanks) {
StringBuffer sb = new StringBuffer();
sb.append('\n');
for (int i = 0; i < blanks; i++) {
sb.append(' '); // depends on control dependency: [for], data = [none]
}
sb.append("FUNCTION ").append("=[\n");
sb.append(name).append("(");
for (int i = 0; i < nodes.length; i++) {
if (nodes[i] != null) {
sb.append("[").append(nodes[i].describe(session)).append("]"); // depends on control dependency: [if], data = [(nodes[i]]
}
}
sb.append(") returns ").append(dataType.getNameString());
sb.append("]\n");
return sb.toString();
} } |
public class class_name {
public HumanNameDataType getHumanNameDataType(RolodexContract rolodex) {
HumanNameDataType humanName = HumanNameDataType.Factory.newInstance();
if (rolodex != null) {
humanName.setFirstName(rolodex.getFirstName());
humanName.setLastName(rolodex.getLastName());
String middleName = rolodex.getMiddleName();
if (middleName != null && !middleName.equals("")) {
humanName.setMiddleName(middleName);
}
}
return humanName;
} } | public class class_name {
public HumanNameDataType getHumanNameDataType(RolodexContract rolodex) {
HumanNameDataType humanName = HumanNameDataType.Factory.newInstance();
if (rolodex != null) {
humanName.setFirstName(rolodex.getFirstName()); // depends on control dependency: [if], data = [(rolodex]
humanName.setLastName(rolodex.getLastName()); // depends on control dependency: [if], data = [(rolodex]
String middleName = rolodex.getMiddleName();
if (middleName != null && !middleName.equals("")) {
humanName.setMiddleName(middleName); // depends on control dependency: [if], data = [(middleName]
}
}
return humanName;
} } |
public class class_name {
static StructureMembers
computemembers(DapVariable var)
{
DapStructure ds = (DapStructure)var.getBaseType();
StructureMembers sm
= new StructureMembers(ds.getShortName());
List<DapVariable> fields = ds.getFields();
for(int i = 0; i < fields.size(); i++) {
DapVariable field = fields.get(i);
DapType dt = field.getBaseType();
DataType cdmtype = CDMTypeFcns.daptype2cdmtype(dt);
StructureMembers.Member m =
sm.addMember(
field.getShortName(), "", null,
cdmtype,
CDMUtil.computeEffectiveShape(field.getDimensions()));
m.setDataParam(i); // So we can index into various lists
// recurse if this field is itself a structure
if(dt.getTypeSort().isStructType()) {
StructureMembers subsm = computemembers(field);
m.setStructureMembers(subsm);
}
}
return sm;
} } | public class class_name {
static StructureMembers
computemembers(DapVariable var)
{
DapStructure ds = (DapStructure)var.getBaseType();
StructureMembers sm
= new StructureMembers(ds.getShortName());
List<DapVariable> fields = ds.getFields();
for(int i = 0; i < fields.size(); i++) {
DapVariable field = fields.get(i);
DapType dt = field.getBaseType();
DataType cdmtype = CDMTypeFcns.daptype2cdmtype(dt);
StructureMembers.Member m =
sm.addMember(
field.getShortName(), "", null,
cdmtype,
CDMUtil.computeEffectiveShape(field.getDimensions()));
m.setDataParam(i); // So we can index into various lists // depends on control dependency: [for], data = [i]
// recurse if this field is itself a structure
if(dt.getTypeSort().isStructType()) {
StructureMembers subsm = computemembers(field);
m.setStructureMembers(subsm); // depends on control dependency: [if], data = [none]
}
}
return sm;
} } |
public class class_name {
public synchronized Object[] getIds() {
String[] keys = getAllKeys();
int size = keys.length + indexedProps.size();
Object[] res = new Object[size];
System.arraycopy(keys, 0, res, 0, keys.length);
int i = keys.length;
// now add all indexed properties
for (Object index : indexedProps.keySet()) {
res[i++] = index;
}
return res;
} } | public class class_name {
public synchronized Object[] getIds() {
String[] keys = getAllKeys();
int size = keys.length + indexedProps.size();
Object[] res = new Object[size];
System.arraycopy(keys, 0, res, 0, keys.length);
int i = keys.length;
// now add all indexed properties
for (Object index : indexedProps.keySet()) {
res[i++] = index; // depends on control dependency: [for], data = [index]
}
return res;
} } |
public class class_name {
public static DOTComponent createDOTComponent(Reader r) {
try {
return new DOTComponent(r);
} catch (IOException e) {
JOptionPane.showMessageDialog(null,
"Could not run DOT: " + e.getMessage(),
"Failed to run DOT",
JOptionPane.ERROR_MESSAGE);
return null;
}
} } | public class class_name {
public static DOTComponent createDOTComponent(Reader r) {
try {
return new DOTComponent(r); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
JOptionPane.showMessageDialog(null,
"Could not run DOT: " + e.getMessage(),
"Failed to run DOT",
JOptionPane.ERROR_MESSAGE);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
@FFDCIgnore({ EntryNotFoundException.class, RegistryException.class })
public Root search(Root root) throws WIMException {
final String METHODNAME = "search";
String uniqueName = null;
Root returnRoot = new Root();
AuditManager auditManager = new AuditManager();
List<Entity> entitys = root.getEntities();
if (entitys != null && !entitys.isEmpty()) {
Entity entitee = entitys.get(0);
if (entitee != null) {
IdentifierType identifier = entitee.getIdentifier();
if (identifier != null)
uniqueName = identifier.getUniqueName();
}
}
try {
int countLimit = 0;
Map<String, Control> ctrlMap = ControlsHelper.getControlMap(root);
SearchControl searchControl = (SearchControl) ctrlMap.get(SchemaConstants.DO_SEARCH_CONTROL);
if (searchControl.isSetCountLimit()) {
countLimit = searchControl.getCountLimit();
}
String expression = searchControl.getExpression();
if (expression == null || expression.trim().length() == 0) {
Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), AuditConstants.SEARCH_AUDIT, reposId, uniqueName,
userRegistry.getRealm(),
returnRoot,
Integer.valueOf("217"), AuditConstants.URBRIDGE);
throw new SearchControlException(WIMMessageKey.MISSING_SEARCH_EXPRESSION, Tr.formatMessage(tc, WIMMessageKey.MISSING_SEARCH_EXPRESSION));
}
URBridgeXPathHelper xpathHelper = new URBridgeXPathHelper(expression);
expression = xpathHelper.getExpression();
boolean returnSubType = searchControl.isReturnSubType();
List<String> entityTypes = xpathHelper.getEntityTypes();
Set<String> entityTypeSet = new HashSet<String>();
List<String> entityTypeList = null;
if (returnSubType) {
for (int i = 0; i < entityTypes.size(); i++) {
String type = entityTypes.get(i);
Set<String> subTypes = Entity.getSubEntityTypes(type);
entityTypeSet.add(type);
if (subTypes != null) {
entityTypeSet.addAll(subTypes);
}
}
} else {
entityTypeSet.addAll(entityTypes);
}
entityTypeList = new ArrayList<String>(entityTypeSet);
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " entityType List: " + entityTypeList);
String type;
for (int i = 0; i < entityTypeList.size(); i++) {
type = entityTypeList.get(i);
if (Service.DO_GROUP.equalsIgnoreCase(type) || Entity.getSubEntityTypes(Service.DO_GROUP).contains(type)) {
List<String> searchAttrs = getAttributes(searchControl, type);
List<String> returnNames = new ArrayList<String>();
if (isSafRegistry() && !expression.endsWith(SchemaConstants.VALUE_WILD_CARD)) {
try {
returnNames.add(userRegistry.getGroupSecurityName(expression));
} catch (EntryNotFoundException enfe) {
} catch (RegistryException re) {
}
} else {
if (!expression.contains(SchemaConstants.VALUE_WILD_CARD)) {
countLimit = 1;
}
returnNames = searchGroups(expression, countLimit).getList();
}
if (returnNames.size() > 0) {
URBridgeEntityFactory osEntityFactory = new URBridgeEntityFactory();
for (int j = 0; j < returnNames.size(); j++) {
Entity matchDO = null;
if (type.equalsIgnoreCase(Service.DO_PERSON_ACCOUNT))
matchDO = new PersonAccount();
else
matchDO = new Group();
returnRoot.getEntities().add(matchDO);
IdentifierType id = new IdentifierType();
matchDO.setIdentifier(id);
// Populate the entity with all requested attributes.
URBridgeEntity osEntity = osEntityFactory.createObject(matchDO, this, propsMap, baseEntryName,
entityConfigMap);
osEntity.setSecurityNameProp(returnNames.get(j));
osEntity.populateEntity(searchAttrs);
//set identifier
id.setRepositoryId(reposId);
}
}
break;
}
}
for (int i = 0; i < entityTypeList.size(); i++) {
type = entityTypeList.get(i);
if (Entity.getSubEntityTypes(Service.DO_LOGIN_ACCOUNT).contains(type)) {
List<String> searchAttrs = getAttributes(searchControl, type);
List<String> returnNames = new ArrayList<String>();
if (isSafRegistry() && !expression.endsWith(SchemaConstants.VALUE_WILD_CARD)) {
try {
returnNames.add(userRegistry.getUserSecurityName(expression));
} catch (EntryNotFoundException enfe) {
} catch (RegistryException re) {
}
} else {
if (!expression.contains(SchemaConstants.VALUE_WILD_CARD)) {
countLimit = 1;
}
returnNames = searchUsers(expression, countLimit).getList();
}
if (returnNames.size() > 0) {
URBridgeEntityFactory osEntityFactory = new URBridgeEntityFactory();
if (type.equalsIgnoreCase(Service.DO_LOGIN_ACCOUNT)) {
type = URBridgeHelper.getPersonAccountType();
}
for (int j = 0; j < returnNames.size(); j++) {
Entity matchDO = new PersonAccount();
returnRoot.getEntities().add(matchDO);
IdentifierType id = new IdentifierType();
matchDO.setIdentifier(id);
// Populate the entity with all requested attributes.
URBridgeEntity osEntity = osEntityFactory.createObject(matchDO, this, propsMap, baseEntryName,
entityConfigMap);
osEntity.setSecurityNameProp(returnNames.get(j));
osEntity.populateEntity(searchAttrs);
//set identifier
id.setRepositoryId(reposId);
}
}
break;
}
}
} catch (WIMException we) {
throw we;
} catch (Exception e) {
Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), AuditConstants.SEARCH_AUDIT, reposId, uniqueName, userRegistry.getRealm(),
returnRoot,
Integer.valueOf("221"), AuditConstants.URBRIDGE);
throw new WIMApplicationException(WIMMessageKey.ENTITY_SEARCH_FAILED, Tr.formatMessage(tc, WIMMessageKey.ENTITY_SEARCH_FAILED,
WIMMessageHelper.generateMsgParms(e.toString())));
}
if (returnRoot != null && !returnRoot.getEntities().isEmpty()) {
auditManager.setRealm(userRegistry.getRealm());
Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), AuditConstants.SEARCH_AUDIT, reposId, uniqueName, userRegistry.getRealm(),
returnRoot,
Integer.valueOf("200"), AuditConstants.URBRIDGE);
}
return returnRoot;
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
@FFDCIgnore({ EntryNotFoundException.class, RegistryException.class })
public Root search(Root root) throws WIMException {
final String METHODNAME = "search";
String uniqueName = null;
Root returnRoot = new Root();
AuditManager auditManager = new AuditManager();
List<Entity> entitys = root.getEntities();
if (entitys != null && !entitys.isEmpty()) {
Entity entitee = entitys.get(0);
if (entitee != null) {
IdentifierType identifier = entitee.getIdentifier();
if (identifier != null)
uniqueName = identifier.getUniqueName();
}
}
try {
int countLimit = 0;
Map<String, Control> ctrlMap = ControlsHelper.getControlMap(root);
SearchControl searchControl = (SearchControl) ctrlMap.get(SchemaConstants.DO_SEARCH_CONTROL);
if (searchControl.isSetCountLimit()) {
countLimit = searchControl.getCountLimit(); // depends on control dependency: [if], data = [none]
}
String expression = searchControl.getExpression();
if (expression == null || expression.trim().length() == 0) {
Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), AuditConstants.SEARCH_AUDIT, reposId, uniqueName,
userRegistry.getRealm(),
returnRoot,
Integer.valueOf("217"), AuditConstants.URBRIDGE); // depends on control dependency: [if], data = [none]
throw new SearchControlException(WIMMessageKey.MISSING_SEARCH_EXPRESSION, Tr.formatMessage(tc, WIMMessageKey.MISSING_SEARCH_EXPRESSION));
}
URBridgeXPathHelper xpathHelper = new URBridgeXPathHelper(expression);
expression = xpathHelper.getExpression();
boolean returnSubType = searchControl.isReturnSubType();
List<String> entityTypes = xpathHelper.getEntityTypes();
Set<String> entityTypeSet = new HashSet<String>();
List<String> entityTypeList = null;
if (returnSubType) {
for (int i = 0; i < entityTypes.size(); i++) {
String type = entityTypes.get(i);
Set<String> subTypes = Entity.getSubEntityTypes(type);
entityTypeSet.add(type); // depends on control dependency: [for], data = [none]
if (subTypes != null) {
entityTypeSet.addAll(subTypes); // depends on control dependency: [if], data = [(subTypes]
}
}
} else {
entityTypeSet.addAll(entityTypes); // depends on control dependency: [if], data = [none]
}
entityTypeList = new ArrayList<String>(entityTypeSet);
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " entityType List: " + entityTypeList);
String type;
for (int i = 0; i < entityTypeList.size(); i++) {
type = entityTypeList.get(i); // depends on control dependency: [for], data = [i]
if (Service.DO_GROUP.equalsIgnoreCase(type) || Entity.getSubEntityTypes(Service.DO_GROUP).contains(type)) {
List<String> searchAttrs = getAttributes(searchControl, type);
List<String> returnNames = new ArrayList<String>();
if (isSafRegistry() && !expression.endsWith(SchemaConstants.VALUE_WILD_CARD)) {
try {
returnNames.add(userRegistry.getGroupSecurityName(expression)); // depends on control dependency: [try], data = [none]
} catch (EntryNotFoundException enfe) {
} catch (RegistryException re) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} else {
if (!expression.contains(SchemaConstants.VALUE_WILD_CARD)) {
countLimit = 1; // depends on control dependency: [if], data = [none]
}
returnNames = searchGroups(expression, countLimit).getList(); // depends on control dependency: [if], data = [none]
}
if (returnNames.size() > 0) {
URBridgeEntityFactory osEntityFactory = new URBridgeEntityFactory();
for (int j = 0; j < returnNames.size(); j++) {
Entity matchDO = null;
if (type.equalsIgnoreCase(Service.DO_PERSON_ACCOUNT))
matchDO = new PersonAccount();
else
matchDO = new Group();
returnRoot.getEntities().add(matchDO); // depends on control dependency: [for], data = [none]
IdentifierType id = new IdentifierType();
matchDO.setIdentifier(id); // depends on control dependency: [for], data = [none]
// Populate the entity with all requested attributes.
URBridgeEntity osEntity = osEntityFactory.createObject(matchDO, this, propsMap, baseEntryName,
entityConfigMap);
osEntity.setSecurityNameProp(returnNames.get(j)); // depends on control dependency: [for], data = [j]
osEntity.populateEntity(searchAttrs); // depends on control dependency: [for], data = [none]
//set identifier
id.setRepositoryId(reposId); // depends on control dependency: [for], data = [none]
}
}
break;
}
}
for (int i = 0; i < entityTypeList.size(); i++) {
type = entityTypeList.get(i); // depends on control dependency: [for], data = [i]
if (Entity.getSubEntityTypes(Service.DO_LOGIN_ACCOUNT).contains(type)) {
List<String> searchAttrs = getAttributes(searchControl, type);
List<String> returnNames = new ArrayList<String>();
if (isSafRegistry() && !expression.endsWith(SchemaConstants.VALUE_WILD_CARD)) {
try {
returnNames.add(userRegistry.getUserSecurityName(expression)); // depends on control dependency: [try], data = [none]
} catch (EntryNotFoundException enfe) {
} catch (RegistryException re) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} else {
if (!expression.contains(SchemaConstants.VALUE_WILD_CARD)) {
countLimit = 1; // depends on control dependency: [if], data = [none]
}
returnNames = searchUsers(expression, countLimit).getList(); // depends on control dependency: [if], data = [none]
}
if (returnNames.size() > 0) {
URBridgeEntityFactory osEntityFactory = new URBridgeEntityFactory();
if (type.equalsIgnoreCase(Service.DO_LOGIN_ACCOUNT)) {
type = URBridgeHelper.getPersonAccountType(); // depends on control dependency: [if], data = [none]
}
for (int j = 0; j < returnNames.size(); j++) {
Entity matchDO = new PersonAccount();
returnRoot.getEntities().add(matchDO); // depends on control dependency: [for], data = [none]
IdentifierType id = new IdentifierType();
matchDO.setIdentifier(id); // depends on control dependency: [for], data = [none]
// Populate the entity with all requested attributes.
URBridgeEntity osEntity = osEntityFactory.createObject(matchDO, this, propsMap, baseEntryName,
entityConfigMap);
osEntity.setSecurityNameProp(returnNames.get(j)); // depends on control dependency: [for], data = [j]
osEntity.populateEntity(searchAttrs); // depends on control dependency: [for], data = [none]
//set identifier
id.setRepositoryId(reposId); // depends on control dependency: [for], data = [none]
}
}
break;
}
}
} catch (WIMException we) {
throw we;
} catch (Exception e) {
Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), AuditConstants.SEARCH_AUDIT, reposId, uniqueName, userRegistry.getRealm(),
returnRoot,
Integer.valueOf("221"), AuditConstants.URBRIDGE);
throw new WIMApplicationException(WIMMessageKey.ENTITY_SEARCH_FAILED, Tr.formatMessage(tc, WIMMessageKey.ENTITY_SEARCH_FAILED,
WIMMessageHelper.generateMsgParms(e.toString())));
}
if (returnRoot != null && !returnRoot.getEntities().isEmpty()) {
auditManager.setRealm(userRegistry.getRealm());
Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), AuditConstants.SEARCH_AUDIT, reposId, uniqueName, userRegistry.getRealm(),
returnRoot,
Integer.valueOf("200"), AuditConstants.URBRIDGE);
}
return returnRoot;
} } |
public class class_name {
public OptionalLong maxByDouble(LongToDoubleFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, l) -> {
double key = keyExtractor.applyAsDouble(l);
if (!box.b || Double.compare(box.d, key) < 0) {
box.b = true;
box.d = key;
box.l = l;
}
}, PrimitiveBox.MAX_DOUBLE).asLong();
} } | public class class_name {
public OptionalLong maxByDouble(LongToDoubleFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, l) -> {
double key = keyExtractor.applyAsDouble(l);
if (!box.b || Double.compare(box.d, key) < 0) {
box.b = true;
// depends on control dependency: [if], data = [none]
box.d = key;
// depends on control dependency: [if], data = [none]
box.l = l;
// depends on control dependency: [if], data = [none]
}
}, PrimitiveBox.MAX_DOUBLE).asLong();
} } |
public class class_name {
private void store() {
Object parent = stack.peek();
if (isObject(parent))
o(parent).put((String) missingKey, current);
else if (isArray(parent)) {
int index = ((Number) missingKey).intValue();
List<Object> lst = a(parent);
while (lst.size() <= index)
lst.add(null);
lst.set(index, current);
}
} } | public class class_name {
private void store() {
Object parent = stack.peek();
if (isObject(parent))
o(parent).put((String) missingKey, current);
else if (isArray(parent)) {
int index = ((Number) missingKey).intValue();
List<Object> lst = a(parent);
while (lst.size() <= index)
lst.add(null);
lst.set(index, current); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<Double> parse(String values) {
List<Double> inputValues = new ArrayList<Double>();
if (!(values.isEmpty() || values.charAt(0) == '#')) {
StringTokenizer tokenizer = new StringTokenizer(values);
while (tokenizer.hasMoreTokens()) {
inputValues.add(Op.toDouble(tokenizer.nextToken()));
}
}
return inputValues;
} } | public class class_name {
public List<Double> parse(String values) {
List<Double> inputValues = new ArrayList<Double>();
if (!(values.isEmpty() || values.charAt(0) == '#')) {
StringTokenizer tokenizer = new StringTokenizer(values);
while (tokenizer.hasMoreTokens()) {
inputValues.add(Op.toDouble(tokenizer.nextToken())); // depends on control dependency: [while], data = [none]
}
}
return inputValues;
} } |
public class class_name {
public static boolean isServiceSpecified(String command, Configuration conf,
String[] argv) {
if (conf.get(FSConstants.DFS_FEDERATION_NAMESERVICES) != null) {
for (int i = 0; i < argv.length; i++) {
if (argv[i].equals("-service")) {
// found service specs
return true;
}
}
// no service specs
printServiceErrorMessage(command, conf);
return false;
}
return true;
} } | public class class_name {
public static boolean isServiceSpecified(String command, Configuration conf,
String[] argv) {
if (conf.get(FSConstants.DFS_FEDERATION_NAMESERVICES) != null) {
for (int i = 0; i < argv.length; i++) {
if (argv[i].equals("-service")) {
// found service specs
return true; // depends on control dependency: [if], data = [none]
}
}
// no service specs
printServiceErrorMessage(command, conf); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
@Override
public String parameter(String name) {
String s = request.params().get(name);
if (s == null) {
// Check form parameter
if (formData != null) {
List<String> l = formData.get(name);
if (l != null && !l.isEmpty()) {
return l.get(0);
}
}
return null;
} else {
return s;
}
} } | public class class_name {
@Override
public String parameter(String name) {
String s = request.params().get(name);
if (s == null) {
// Check form parameter
if (formData != null) {
List<String> l = formData.get(name);
if (l != null && !l.isEmpty()) {
return l.get(0); // depends on control dependency: [if], data = [none]
}
}
return null; // depends on control dependency: [if], data = [none]
} else {
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public URLNormalizer addDomainTrailingSlash() {
String urlRoot = HttpURL.getRoot(url);
String path = toURL().getPath();
if (StringUtils.isNotBlank(path)) {
// there is a path so do nothing
return this;
}
String urlRootAndPath = urlRoot + "/";
url = StringUtils.replaceOnce(url, urlRoot, urlRootAndPath);
return this;
} } | public class class_name {
public URLNormalizer addDomainTrailingSlash() {
String urlRoot = HttpURL.getRoot(url);
String path = toURL().getPath();
if (StringUtils.isNotBlank(path)) {
// there is a path so do nothing
return this; // depends on control dependency: [if], data = [none]
}
String urlRootAndPath = urlRoot + "/";
url = StringUtils.replaceOnce(url, urlRoot, urlRootAndPath);
return this;
} } |
public class class_name {
@Override
public String readString() {
log.trace("readString - amf3_mode: {}", amf3_mode);
String string;
// check current type to ensure reading the string as AMF3 is intended
if (currentDataType == AMF3.TYPE_STRING || amf3_mode > 0) {
int len = readInteger();
log.debug("readString - length: {}", len);
// get the length of the string (0x03 = 1, 0x05 = 2, 0x07 = 3 etc..)
// 0x01 is special and it means "empty"
if (len == 1) {
// Empty string
return "";
}
if ((len & 1) == 0) {
//if the refs are empty an IndexOutOfBoundsEx will be thrown
if (refStorage.stringReferences.isEmpty()) {
log.debug("String reference list is empty");
}
// Reference
return refStorage.stringReferences.get(len >> 1);
}
len >>= 1;
log.debug("readString - new length: {}", len);
int limit = buf.limit();
log.debug("readString - limit: {}", limit);
final ByteBuffer strBuf = buf.buf();
strBuf.limit(strBuf.position() + len);
string = AMF.CHARSET.decode(strBuf).toString();
log.debug("String: {}", string);
buf.limit(limit); // reset the limit
refStorage.stringReferences.add(string);
} else {
// read the string as AMF0
string = super.readString();
}
return string;
} } | public class class_name {
@Override
public String readString() {
log.trace("readString - amf3_mode: {}", amf3_mode);
String string;
// check current type to ensure reading the string as AMF3 is intended
if (currentDataType == AMF3.TYPE_STRING || amf3_mode > 0) {
int len = readInteger();
log.debug("readString - length: {}", len);
// depends on control dependency: [if], data = [none]
// get the length of the string (0x03 = 1, 0x05 = 2, 0x07 = 3 etc..)
// 0x01 is special and it means "empty"
if (len == 1) {
// Empty string
return "";
// depends on control dependency: [if], data = [none]
}
if ((len & 1) == 0) {
//if the refs are empty an IndexOutOfBoundsEx will be thrown
if (refStorage.stringReferences.isEmpty()) {
log.debug("String reference list is empty");
// depends on control dependency: [if], data = [none]
}
// Reference
return refStorage.stringReferences.get(len >> 1);
// depends on control dependency: [if], data = [none]
}
len >>= 1;
// depends on control dependency: [if], data = [none]
log.debug("readString - new length: {}", len);
// depends on control dependency: [if], data = [none]
int limit = buf.limit();
log.debug("readString - limit: {}", limit);
// depends on control dependency: [if], data = [none]
final ByteBuffer strBuf = buf.buf();
strBuf.limit(strBuf.position() + len);
// depends on control dependency: [if], data = [none]
string = AMF.CHARSET.decode(strBuf).toString();
// depends on control dependency: [if], data = [none]
log.debug("String: {}", string);
// depends on control dependency: [if], data = [none]
buf.limit(limit); // reset the limit
// depends on control dependency: [if], data = [none]
refStorage.stringReferences.add(string);
// depends on control dependency: [if], data = [none]
} else {
// read the string as AMF0
string = super.readString();
// depends on control dependency: [if], data = [none]
}
return string;
} } |
public class class_name {
public boolean runOnMainThread(final Runnable r) {
assert handler != null;
if (!sanityCheck("runOnMainThread " + r)) {
return false;
}
Runnable wrapper = new Runnable() {
public void run() {
FPSCounter.timeCheck("runOnMainThread <START> " + r);
r.run();
FPSCounter.timeCheck("runOnMainThread <END> " + r);
}
};
if (isMainThread()) {
wrapper.run();
return true;
} else {
return runOnMainThreadNext(wrapper);
}
} } | public class class_name {
public boolean runOnMainThread(final Runnable r) {
assert handler != null;
if (!sanityCheck("runOnMainThread " + r)) {
return false; // depends on control dependency: [if], data = [none]
}
Runnable wrapper = new Runnable() {
public void run() {
FPSCounter.timeCheck("runOnMainThread <START> " + r);
r.run();
FPSCounter.timeCheck("runOnMainThread <END> " + r);
}
};
if (isMainThread()) {
wrapper.run(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return runOnMainThreadNext(wrapper); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<Artifact> getArtifacts(final Boolean hasLicense) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactsPath());
final ClientResponse response = resource.queryParam(ServerAPI.HAS_LICENSE_PARAM, hasLicense.toString())
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to get artifacts";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(ArtifactList.class);
} } | public class class_name {
public List<Artifact> getArtifacts(final Boolean hasLicense) throws GrapesCommunicationException {
final Client client = getClient();
final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactsPath());
final ClientResponse response = resource.queryParam(ServerAPI.HAS_LICENSE_PARAM, hasLicense.toString())
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
client.destroy();
if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
final String message = "Failed to get artifacts";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); // depends on control dependency: [if], data = [none]
}
throw new GrapesCommunicationException(message, response.getStatus());
}
return response.getEntity(ArtifactList.class);
} } |
public class class_name {
public static void close(final Source input) throws IOException {
if (input != null && input instanceof StreamSource) {
final StreamSource s = (StreamSource) input;
final InputStream i = s.getInputStream();
if (i != null) {
i.close();
} else {
final Reader w = s.getReader();
if (w != null) {
w.close();
}
}
}
} } | public class class_name {
public static void close(final Source input) throws IOException {
if (input != null && input instanceof StreamSource) {
final StreamSource s = (StreamSource) input;
final InputStream i = s.getInputStream();
if (i != null) {
i.close(); // depends on control dependency: [if], data = [none]
} else {
final Reader w = s.getReader();
if (w != null) {
w.close(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public void setCenterX(float centerX) {
if ((points == null) || (center == null)) {
checkPoints();
}
float xDiff = centerX - getCenterX();
setX(x + xDiff);
} } | public class class_name {
public void setCenterX(float centerX) {
if ((points == null) || (center == null)) {
checkPoints();
// depends on control dependency: [if], data = [none]
}
float xDiff = centerX - getCenterX();
setX(x + xDiff);
} } |
public class class_name {
void mirror() {
for (int x = 0; x < bitMatrix.getWidth(); x++) {
for (int y = x + 1; y < bitMatrix.getHeight(); y++) {
if (bitMatrix.get(x, y) != bitMatrix.get(y, x)) {
bitMatrix.flip(y, x);
bitMatrix.flip(x, y);
}
}
}
} } | public class class_name {
void mirror() {
for (int x = 0; x < bitMatrix.getWidth(); x++) {
for (int y = x + 1; y < bitMatrix.getHeight(); y++) {
if (bitMatrix.get(x, y) != bitMatrix.get(y, x)) {
bitMatrix.flip(y, x); // depends on control dependency: [if], data = [none]
bitMatrix.flip(x, y); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
private JSONObject getJsonFormattedSpellcheckResult(CmsSpellcheckingRequest request) {
final JSONObject response = new JSONObject();
try {
if (null != request.m_id) {
response.put(JSON_ID, request.m_id);
}
response.put(JSON_RESULT, request.m_wordSuggestions);
} catch (Exception e) {
try {
response.put(JSON_ERROR, true);
LOG.debug("Error while assembling spellcheck response in JSON format.", e);
} catch (JSONException ex) {
LOG.debug("Error while assembling spellcheck response in JSON format.", ex);
}
}
return response;
} } | public class class_name {
private JSONObject getJsonFormattedSpellcheckResult(CmsSpellcheckingRequest request) {
final JSONObject response = new JSONObject();
try {
if (null != request.m_id) {
response.put(JSON_ID, request.m_id); // depends on control dependency: [if], data = [request.m_id)]
}
response.put(JSON_RESULT, request.m_wordSuggestions); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
try {
response.put(JSON_ERROR, true); // depends on control dependency: [try], data = [none]
LOG.debug("Error while assembling spellcheck response in JSON format.", e); // depends on control dependency: [try], data = [none]
} catch (JSONException ex) {
LOG.debug("Error while assembling spellcheck response in JSON format.", ex);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
return response;
} } |
public class class_name {
@Override
public boolean checkUserLoginable(LoginCredential credential) {
final CredentialChecker checker = new CredentialChecker(credential);
checkCredential(checker);
if (!checker.isChecked()) {
handleUnknownLoginCredential(credential);
}
return checker.isLoginable();
} } | public class class_name {
@Override
public boolean checkUserLoginable(LoginCredential credential) {
final CredentialChecker checker = new CredentialChecker(credential);
checkCredential(checker);
if (!checker.isChecked()) {
handleUnknownLoginCredential(credential); // depends on control dependency: [if], data = [none]
}
return checker.isLoginable();
} } |
public class class_name {
public IntervalConverter getIntervalConverter(Object object) {
IntervalConverter converter =
(IntervalConverter)iIntervalConverters.select(object == null ? null : object.getClass());
if (converter != null) {
return converter;
}
throw new IllegalArgumentException("No interval converter found for type: " +
(object == null ? "null" : object.getClass().getName()));
} } | public class class_name {
public IntervalConverter getIntervalConverter(Object object) {
IntervalConverter converter =
(IntervalConverter)iIntervalConverters.select(object == null ? null : object.getClass());
if (converter != null) {
return converter; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("No interval converter found for type: " +
(object == null ? "null" : object.getClass().getName()));
} } |
public class class_name {
public Object invokeMethod(String name, Object args) {
try {
return getMetaClass().invokeMethod(this, name, args);
}
catch (MissingMethodException e) {
// lets apply the method to each item in the collection
List answer = new ArrayList(size());
for (Iterator iter = iterator(); iter.hasNext(); ) {
Object element = iter.next();
Object value = InvokerHelper.invokeMethod(element, name, args);
answer.add(value);
}
return answer;
}
} } | public class class_name {
public Object invokeMethod(String name, Object args) {
try {
return getMetaClass().invokeMethod(this, name, args); // depends on control dependency: [try], data = [none]
}
catch (MissingMethodException e) {
// lets apply the method to each item in the collection
List answer = new ArrayList(size());
for (Iterator iter = iterator(); iter.hasNext(); ) {
Object element = iter.next();
Object value = InvokerHelper.invokeMethod(element, name, args);
answer.add(value); // depends on control dependency: [for], data = [none]
}
return answer;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void initMappings() throws Exception {
checkClient();
// We extract indexes and mappings to manage from mappings definition
if (mappings != null && mappings.length > 0) {
Map<String, Collection<String>> indices = getIndexMappings(mappings);
// Let's initialize indexes and mappings if needed
for (String index : indices.keySet()) {
createIndex(client.getLowLevelClient(), classpathRoot, index, forceMapping);
if (mergeSettings) {
updateSettings(client.getLowLevelClient(), classpathRoot, index);
}
createMapping(client, classpathRoot, index, mergeMapping);
}
}
} } | public class class_name {
private void initMappings() throws Exception {
checkClient();
// We extract indexes and mappings to manage from mappings definition
if (mappings != null && mappings.length > 0) {
Map<String, Collection<String>> indices = getIndexMappings(mappings);
// Let's initialize indexes and mappings if needed
for (String index : indices.keySet()) {
createIndex(client.getLowLevelClient(), classpathRoot, index, forceMapping); // depends on control dependency: [for], data = [index]
if (mergeSettings) {
updateSettings(client.getLowLevelClient(), classpathRoot, index); // depends on control dependency: [if], data = [none]
}
createMapping(client, classpathRoot, index, mergeMapping); // depends on control dependency: [for], data = [index]
}
}
} } |
public class class_name {
@Deprecated
public void generateErrorAndRequiredClassForLabels(UIInput input, ResponseWriter rw, String clientId,
String additionalClass) throws IOException {
String styleClass = getErrorAndRequiredClass(input, clientId);
if (null != additionalClass) {
additionalClass = additionalClass.trim();
if (additionalClass.trim().length() > 0) {
styleClass += " " + additionalClass;
}
}
UIForm currentForm = AJAXRenderer.getSurroundingForm((UIComponent) input, true);
if (currentForm instanceof Form) {
if (((Form) currentForm).isHorizontal()) {
styleClass += " control-label";
}
}
if (input instanceof IResponsiveLabel) {
String responsiveLabelClass = Responsive.getResponsiveLabelClass((IResponsiveLabel) input);
if (null != responsiveLabelClass) {
styleClass += " " + responsiveLabelClass;
}
}
rw.writeAttribute("class", styleClass, "class");
} } | public class class_name {
@Deprecated
public void generateErrorAndRequiredClassForLabels(UIInput input, ResponseWriter rw, String clientId,
String additionalClass) throws IOException {
String styleClass = getErrorAndRequiredClass(input, clientId);
if (null != additionalClass) {
additionalClass = additionalClass.trim();
if (additionalClass.trim().length() > 0) {
styleClass += " " + additionalClass;
// depends on control dependency: [if], data = [none]
}
}
UIForm currentForm = AJAXRenderer.getSurroundingForm((UIComponent) input, true);
if (currentForm instanceof Form) {
if (((Form) currentForm).isHorizontal()) {
styleClass += " control-label";
// depends on control dependency: [if], data = [none]
}
}
if (input instanceof IResponsiveLabel) {
String responsiveLabelClass = Responsive.getResponsiveLabelClass((IResponsiveLabel) input);
if (null != responsiveLabelClass) {
styleClass += " " + responsiveLabelClass;
// depends on control dependency: [if], data = [none]
}
}
rw.writeAttribute("class", styleClass, "class");
} } |
public class class_name {
public File[] listFiles(FileFilter filter) {
List ret = new LinkedList();
Iterator it = this.childs.iterator();
File next;
while (it.hasNext()) {
next = (File)it.next();
if (filter.accept(next)) {
ret.add(next);
}
}
return (File[])ret.toArray(new File[ret.size()]);
} } | public class class_name {
public File[] listFiles(FileFilter filter) {
List ret = new LinkedList();
Iterator it = this.childs.iterator();
File next;
while (it.hasNext()) {
next = (File)it.next(); // depends on control dependency: [while], data = [none]
if (filter.accept(next)) {
ret.add(next); // depends on control dependency: [if], data = [none]
}
}
return (File[])ret.toArray(new File[ret.size()]);
} } |
public class class_name {
public CmsClientSitemapEntry getParentEntry(CmsClientSitemapEntry entry) {
String path = entry.getSitePath();
String parentPath = CmsResource.getParentFolder(path);
if (parentPath == null) {
return null;
}
return getEntry(parentPath);
} } | public class class_name {
public CmsClientSitemapEntry getParentEntry(CmsClientSitemapEntry entry) {
String path = entry.getSitePath();
String parentPath = CmsResource.getParentFolder(path);
if (parentPath == null) {
return null; // depends on control dependency: [if], data = [none]
}
return getEntry(parentPath);
} } |
public class class_name {
private String findMessage(final String messageKey) {
String message = null;
try {
if (!this.resourceBundles.isEmpty()) {
for (int i = this.resourceBundles.size() - 1; i >= 0 && message == null; i--) {
if (this.resourceBundles.get(i).containsKey(messageKey)) {
message = this.resourceBundles.get(i).getString(messageKey);
}
}
}
} catch (final MissingResourceException e) {
LOGGER.error("Message key not found into resource bundle", e);
}
return message;
} } | public class class_name {
private String findMessage(final String messageKey) {
String message = null;
try {
if (!this.resourceBundles.isEmpty()) {
for (int i = this.resourceBundles.size() - 1; i >= 0 && message == null; i--) {
if (this.resourceBundles.get(i).containsKey(messageKey)) {
message = this.resourceBundles.get(i).getString(messageKey);
// depends on control dependency: [if], data = [none]
}
}
}
} catch (final MissingResourceException e) {
LOGGER.error("Message key not found into resource bundle", e);
}
// depends on control dependency: [catch], data = [none]
return message;
} } |
public class class_name {
private void mergePages() throws CmsException {
int size = m_foldersEqualnames.size();
if (size > 0) {
m_report.println(
Messages.get().container(Messages.RPT_MERGE_PAGES_BEGIN_1, String.valueOf(size)),
I_CmsReport.FORMAT_HEADLINE);
String defaultLocale = CmsLocaleManager.getDefaultLocale().toString();
String locale2 = m_cms.readPropertyObject(getParamFolder2(), "locale", true).getValue(defaultLocale);
// lock the source and the target folder
m_report.print(Messages.get().container(Messages.RPT_LOCK_FOLDER_0), I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
getParamFolder1()));
m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
m_cms.lockResource(getParamFolder1());
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
m_report.print(Messages.get().container(Messages.RPT_LOCK_FOLDER_0), I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
getParamFolder2()));
m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
m_cms.lockResource(getParamFolder2());
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
// now loop through all collected resources
int count = 1;
Iterator i = m_foldersEqualnames.iterator();
while (i.hasNext()) {
String resFolder1Name = (String)i.next();
try {
String resFolder2Name = getResourceNameInOtherFolder(
resFolder1Name,
getParamFolder1(),
getParamFolder2());
m_report.print(org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
String.valueOf(count++),
String.valueOf(size)), I_CmsReport.FORMAT_NOTE);
m_report.print(Messages.get().container(Messages.RPT_PROCESS_0), I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
resFolder1Name));
m_report.print(Messages.get().container(Messages.RPT_DOUBLE_ARROW_0), I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
resFolder2Name));
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
// get the content of the resource in folder1
String locale = m_cms.readPropertyObject(resFolder1Name, "locale", true).getValue(defaultLocale);
m_report.print(
Messages.get().container(Messages.RPT_READ_CONTENT_2, resFolder1Name, locale),
I_CmsReport.FORMAT_NOTE);
CmsResource resFolder1 = m_cms.readResource(resFolder1Name, CmsResourceFilter.IGNORE_EXPIRATION);
CmsFile fileFolder1 = m_cms.readFile(resFolder1);
CmsXmlPage pageFolder1 = CmsXmlPageFactory.unmarshal(m_cms, fileFolder1);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
// get the content of the resource in folder2
locale = m_cms.readPropertyObject(resFolder2Name, "locale", true).getValue(defaultLocale);
m_report.print(
Messages.get().container(Messages.RPT_READ_CONTENT_2, resFolder2Name, locale),
I_CmsReport.FORMAT_NOTE);
CmsResource resFolder2 = m_cms.readResource(resFolder2Name, CmsResourceFilter.IGNORE_EXPIRATION);
CmsFile fileFolder2 = m_cms.readFile(resFolder2);
CmsXmlPage pageFolder2 = CmsXmlPageFactory.unmarshal(m_cms, fileFolder2);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
// now get all the text elements from the resource in folder 2 which match the the locale of folder 2
Locale loc = CmsLocaleManager.getLocale(locale2);
List textElements2 = pageFolder2.getNames(loc);
Iterator j = textElements2.iterator();
while (j.hasNext()) {
String textElementName = (String)j.next();
m_report.print(
Messages.get().container(Messages.RPT_PROCESS_TEXT_ELEM_1, textElementName),
I_CmsReport.FORMAT_NOTE);
// get the text element from the resource in folder 2...
String textElement = pageFolder2.getValue(textElementName, loc).getStringValue(m_cms);
// and set it in the resource in folder 1...
// WARNING: An existing content will be overwritten!
if (!pageFolder1.hasValue(textElementName, loc)) {
pageFolder1.addValue(textElementName, loc);
}
pageFolder1.setStringValue(m_cms, textElementName, loc, textElement);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
}
// the resource in folder 1 now has all text elements in both locales, so update it in the vfs
m_report.print(
Messages.get().container(Messages.RPT_WRITE_CONTENT_1, resFolder1Name),
I_CmsReport.FORMAT_NOTE);
fileFolder1.setContents(pageFolder1.marshal());
m_cms.writeFile(fileFolder1);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
// save all properties from the resource in folder2
m_report.print(
Messages.get().container(Messages.RPT_READ_PROPERTIES_1, resFolder2Name),
I_CmsReport.FORMAT_NOTE);
List properties = m_cms.readPropertyObjects(resFolder2Name, false);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
// the next thing to do is to delete the old resource in folder 2
m_report.print(
Messages.get().container(Messages.RPT_DELETE_PAGE_1, resFolder2Name),
I_CmsReport.FORMAT_NOTE);
m_cms.deleteResource(resFolder2Name, CmsResource.DELETE_PRESERVE_SIBLINGS);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
// copy a sibling of the resource from folder 1 to folder 2
m_report.print(
Messages.get().container(Messages.RPT_COPY_2, resFolder1Name, resFolder2Name),
I_CmsReport.FORMAT_NOTE);
m_cms.copyResource(resFolder1Name, resFolder2Name, CmsResource.COPY_AS_SIBLING);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
// restore the properties at the sibling in folder 2
m_report.print(
Messages.get().container(Messages.RPT_RESORE_PROPERTIES_1, resFolder2Name),
I_CmsReport.FORMAT_NOTE);
m_cms.writePropertyObjects(resFolder2Name, properties);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
resFolder1 = null;
resFolder2 = null;
fileFolder1 = null;
fileFolder2 = null;
pageFolder1 = null;
pageFolder2 = null;
} catch (CmsException e) {
m_report.println(e);
}
}
// lock the source and the target folder
m_report.print(Messages.get().container(Messages.RPT_UNLOCK_1, getParamFolder1()), I_CmsReport.FORMAT_NOTE);
m_cms.unlockResource(getParamFolder1());
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
m_report.print(Messages.get().container(Messages.RPT_UNLOCK_1, getParamFolder2()), I_CmsReport.FORMAT_NOTE);
m_cms.unlockResource(getParamFolder2());
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
m_report.println(Messages.get().container(Messages.RPT_MERGE_PAGES_END_0), I_CmsReport.FORMAT_HEADLINE);
}
} } | public class class_name {
private void mergePages() throws CmsException {
int size = m_foldersEqualnames.size();
if (size > 0) {
m_report.println(
Messages.get().container(Messages.RPT_MERGE_PAGES_BEGIN_1, String.valueOf(size)),
I_CmsReport.FORMAT_HEADLINE);
String defaultLocale = CmsLocaleManager.getDefaultLocale().toString();
String locale2 = m_cms.readPropertyObject(getParamFolder2(), "locale", true).getValue(defaultLocale);
// lock the source and the target folder
m_report.print(Messages.get().container(Messages.RPT_LOCK_FOLDER_0), I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
getParamFolder1()));
m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
m_cms.lockResource(getParamFolder1());
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
m_report.print(Messages.get().container(Messages.RPT_LOCK_FOLDER_0), I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
getParamFolder2()));
m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
m_cms.lockResource(getParamFolder2());
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
// now loop through all collected resources
int count = 1;
Iterator i = m_foldersEqualnames.iterator();
while (i.hasNext()) {
String resFolder1Name = (String)i.next();
try {
String resFolder2Name = getResourceNameInOtherFolder(
resFolder1Name,
getParamFolder1(),
getParamFolder2());
m_report.print(org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
String.valueOf(count++),
String.valueOf(size)), I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
m_report.print(Messages.get().container(Messages.RPT_PROCESS_0), I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
resFolder1Name)); // depends on control dependency: [try], data = [none]
m_report.print(Messages.get().container(Messages.RPT_DOUBLE_ARROW_0), I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
resFolder2Name)); // depends on control dependency: [try], data = [none]
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); // depends on control dependency: [try], data = [none]
// get the content of the resource in folder1
String locale = m_cms.readPropertyObject(resFolder1Name, "locale", true).getValue(defaultLocale);
m_report.print(
Messages.get().container(Messages.RPT_READ_CONTENT_2, resFolder1Name, locale),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
CmsResource resFolder1 = m_cms.readResource(resFolder1Name, CmsResourceFilter.IGNORE_EXPIRATION);
CmsFile fileFolder1 = m_cms.readFile(resFolder1);
CmsXmlPage pageFolder1 = CmsXmlPageFactory.unmarshal(m_cms, fileFolder1);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [try], data = [none]
// get the content of the resource in folder2
locale = m_cms.readPropertyObject(resFolder2Name, "locale", true).getValue(defaultLocale); // depends on control dependency: [try], data = [none]
m_report.print(
Messages.get().container(Messages.RPT_READ_CONTENT_2, resFolder2Name, locale),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
CmsResource resFolder2 = m_cms.readResource(resFolder2Name, CmsResourceFilter.IGNORE_EXPIRATION);
CmsFile fileFolder2 = m_cms.readFile(resFolder2);
CmsXmlPage pageFolder2 = CmsXmlPageFactory.unmarshal(m_cms, fileFolder2);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [try], data = [none]
// now get all the text elements from the resource in folder 2 which match the the locale of folder 2
Locale loc = CmsLocaleManager.getLocale(locale2);
List textElements2 = pageFolder2.getNames(loc);
Iterator j = textElements2.iterator();
while (j.hasNext()) {
String textElementName = (String)j.next();
m_report.print(
Messages.get().container(Messages.RPT_PROCESS_TEXT_ELEM_1, textElementName),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [while], data = [none]
// get the text element from the resource in folder 2...
String textElement = pageFolder2.getValue(textElementName, loc).getStringValue(m_cms);
// and set it in the resource in folder 1...
// WARNING: An existing content will be overwritten!
if (!pageFolder1.hasValue(textElementName, loc)) {
pageFolder1.addValue(textElementName, loc); // depends on control dependency: [if], data = [none]
}
pageFolder1.setStringValue(m_cms, textElementName, loc, textElement); // depends on control dependency: [while], data = [none]
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [while], data = [none]
}
// the resource in folder 1 now has all text elements in both locales, so update it in the vfs
m_report.print(
Messages.get().container(Messages.RPT_WRITE_CONTENT_1, resFolder1Name),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
fileFolder1.setContents(pageFolder1.marshal()); // depends on control dependency: [try], data = [none]
m_cms.writeFile(fileFolder1); // depends on control dependency: [try], data = [none]
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [try], data = [none]
// save all properties from the resource in folder2
m_report.print(
Messages.get().container(Messages.RPT_READ_PROPERTIES_1, resFolder2Name),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
List properties = m_cms.readPropertyObjects(resFolder2Name, false);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [try], data = [none]
// the next thing to do is to delete the old resource in folder 2
m_report.print(
Messages.get().container(Messages.RPT_DELETE_PAGE_1, resFolder2Name),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
m_cms.deleteResource(resFolder2Name, CmsResource.DELETE_PRESERVE_SIBLINGS); // depends on control dependency: [try], data = [none]
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [try], data = [none]
// copy a sibling of the resource from folder 1 to folder 2
m_report.print(
Messages.get().container(Messages.RPT_COPY_2, resFolder1Name, resFolder2Name),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
m_cms.copyResource(resFolder1Name, resFolder2Name, CmsResource.COPY_AS_SIBLING); // depends on control dependency: [try], data = [none]
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [try], data = [none]
// restore the properties at the sibling in folder 2
m_report.print(
Messages.get().container(Messages.RPT_RESORE_PROPERTIES_1, resFolder2Name),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [try], data = [none]
m_cms.writePropertyObjects(resFolder2Name, properties); // depends on control dependency: [try], data = [none]
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [try], data = [none]
resFolder1 = null; // depends on control dependency: [try], data = [none]
resFolder2 = null; // depends on control dependency: [try], data = [none]
fileFolder1 = null; // depends on control dependency: [try], data = [none]
fileFolder2 = null; // depends on control dependency: [try], data = [none]
pageFolder1 = null; // depends on control dependency: [try], data = [none]
pageFolder2 = null; // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
m_report.println(e);
} // depends on control dependency: [catch], data = [none]
}
// lock the source and the target folder
m_report.print(Messages.get().container(Messages.RPT_UNLOCK_1, getParamFolder1()), I_CmsReport.FORMAT_NOTE);
m_cms.unlockResource(getParamFolder1());
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
m_report.print(Messages.get().container(Messages.RPT_UNLOCK_1, getParamFolder2()), I_CmsReport.FORMAT_NOTE);
m_cms.unlockResource(getParamFolder2());
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
m_report.println(Messages.get().container(Messages.RPT_MERGE_PAGES_END_0), I_CmsReport.FORMAT_HEADLINE);
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T, K> Join<T, K> findJoinedType(Root<T> root, Class<T> rootClass, Class<K> joinClass) {
Join<T, K> join = null;
for (Join<T, ?> j : root.getJoins()) {
if (j.getJavaType().equals(joinClass)) {
join = (Join<T, K>) j;
}
}
return join;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T, K> Join<T, K> findJoinedType(Root<T> root, Class<T> rootClass, Class<K> joinClass) {
Join<T, K> join = null;
for (Join<T, ?> j : root.getJoins()) {
if (j.getJavaType().equals(joinClass)) {
join = (Join<T, K>) j; // depends on control dependency: [if], data = [none]
}
}
return join;
} } |
public class class_name {
public EClass getFNN() {
if (fnnEClass == null) {
fnnEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(266);
}
return fnnEClass;
} } | public class class_name {
public EClass getFNN() {
if (fnnEClass == null) {
fnnEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(266); // depends on control dependency: [if], data = [none]
}
return fnnEClass;
} } |
public class class_name {
public ItemImpl getItemByIdentifier(String identifier, boolean pool, boolean apiRead) throws RepositoryException
{
long start = 0;
if (LOG.isDebugEnabled())
{
start = System.currentTimeMillis();
LOG.debug("getItemByIdentifier(" + identifier + " ) >>>>>");
}
ItemImpl item = null;
try
{
return item = readItem(getItemData(identifier), null, pool, apiRead);
}
finally
{
if (LOG.isDebugEnabled())
{
LOG.debug("getItemByIdentifier(" + identifier + ") --> " + (item != null ? item.getPath() : "null")
+ " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec");
}
}
} } | public class class_name {
public ItemImpl getItemByIdentifier(String identifier, boolean pool, boolean apiRead) throws RepositoryException
{
long start = 0;
if (LOG.isDebugEnabled())
{
start = System.currentTimeMillis();
LOG.debug("getItemByIdentifier(" + identifier + " ) >>>>>");
}
ItemImpl item = null;
try
{
return item = readItem(getItemData(identifier), null, pool, apiRead);
}
finally
{
if (LOG.isDebugEnabled())
{
LOG.debug("getItemByIdentifier(" + identifier + ") --> " + (item != null ? item.getPath() : "null")
+ " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void connectionReleased(IManagedConnectionEvent<C> event) {
// physical connection is already set free
if (!event.getManagedConnection().hasCoreConnection()) {
return;
}
C con = event.getManagedConnection().getCoreConnection();
if (con == null || !(con instanceof IXADataRecorderAware)) {
return;
}
IXADataRecorderAware messageAwareConnection = (IXADataRecorderAware) con;
// Transaction is closed and the xaDataRecorder is destroyed ...
IXADataRecorder xaDataRecorder = messageAwareConnection
.getXADataRecorder();
if (xaDataRecorder == null) {
return;
}
// if commit/rollback was performed, nothing happened. If no the logged
// data is closed but not destroy. So recovery can happen
xaDataRecorder.disqualify();
} } | public class class_name {
@Override
public void connectionReleased(IManagedConnectionEvent<C> event) {
// physical connection is already set free
if (!event.getManagedConnection().hasCoreConnection()) {
return; // depends on control dependency: [if], data = [none]
}
C con = event.getManagedConnection().getCoreConnection();
if (con == null || !(con instanceof IXADataRecorderAware)) {
return; // depends on control dependency: [if], data = [none]
}
IXADataRecorderAware messageAwareConnection = (IXADataRecorderAware) con;
// Transaction is closed and the xaDataRecorder is destroyed ...
IXADataRecorder xaDataRecorder = messageAwareConnection
.getXADataRecorder();
if (xaDataRecorder == null) {
return; // depends on control dependency: [if], data = [none]
}
// if commit/rollback was performed, nothing happened. If no the logged
// data is closed but not destroy. So recovery can happen
xaDataRecorder.disqualify();
} } |
public class class_name {
public void marshall(UpdateLagRequest updateLagRequest, ProtocolMarshaller protocolMarshaller) {
if (updateLagRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateLagRequest.getLagId(), LAGID_BINDING);
protocolMarshaller.marshall(updateLagRequest.getLagName(), LAGNAME_BINDING);
protocolMarshaller.marshall(updateLagRequest.getMinimumLinks(), MINIMUMLINKS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateLagRequest updateLagRequest, ProtocolMarshaller protocolMarshaller) {
if (updateLagRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateLagRequest.getLagId(), LAGID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateLagRequest.getLagName(), LAGNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateLagRequest.getMinimumLinks(), MINIMUMLINKS_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]
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.