code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
@Override
public void writeFile(String arg0, Map result) {
long estTime = 0;
try {
if (getObjectOr(result, "experiments", new ArrayList()).isEmpty()
&& getObjectOr(result, "soils", new ArrayList()).isEmpty()
&& getObjectOr(result, "weathers", new ArrayList()).isEmpty()) {
// Calculate estimated time consume
HashMap wth = getObjectOr(result, "weather", new HashMap());
estTime += getObjectOr(wth, "dailyWeather", new ArrayList()).size();
// Write files
recordSWData(result, new DssatSoilOutput());
recordSWData(result, new DssatWeatherOutput());
writeWthFiles(arg0);
writeSoilFiles(arg0);
String exname = getValueOr(result, "exname", "N/A");
writeSingleExp(arg0, result, new DssatXFileOutput(), exname + "_X");
writeSingleExp(arg0, result, new DssatAFileOutput(), exname + "_A");
writeSingleExp(arg0, result, new DssatTFileOutput(), exname + "_T");
writeSingleExp(arg0, result, new DssatCulFileOutput(), exname + "_Cul");
writeSingleExp(arg0, result, new DssatBatchFileOutput(DssatVersion.DSSAT45), "DSSBatch.v45");
writeSingleExp(arg0, result, new DssatBatchFileOutput(DssatVersion.DSSAT46), "DSSBatch.v46");
writeSingleExp(arg0, result, new DssatRunFileOutput(DssatVersion.DSSAT45), "Run45.bat");
writeSingleExp(arg0, result, new DssatRunFileOutput(DssatVersion.DSSAT46), "Run46.bat");
// compress all output files into one zip file
outputFile = new File(revisePath(arg0) + exname + ".ZIP");
//createZip();
} else {
// Calculate estimated time consume
for (HashMap wth : (ArrayList<HashMap>) getObjectOr(result, "weathers", new ArrayList<HashMap>())) {
estTime += getObjectOr(wth, "dailyWeather", new ArrayList()).size();
}
writeMultipleExp(arg0, result);
}
if (estTime > 0) {
estTime *= 10;
} else {
estTime = 10000;
}
executor.shutdown();
long timer = System.currentTimeMillis();
HashSet<String> keys = new HashSet(futFiles.keySet());
int counter = 0;
while (!executor.isTerminated()) {
if (System.currentTimeMillis() - timer > estTime) {
counter++;
timer = System.currentTimeMillis();
if (keys.isEmpty()) {
LOG.info("The executor should be terminated");
executor.shutdownNow();
} else if (counter > 3) {
LOG.info("The executor is going to be force terminated");
executor.shutdownNow();
}
String[] arr = keys.toArray(new String[0]);
for (String key : arr) {
Future futFile = futFiles.get(key);
if (futFile.isCancelled() || futFile.isDone()) {
keys.remove(key);
} else {
LOG.info("DSSAT translation for {} is still under processing...", key);
}
}
}
}
executor = null;
LOG.debug("Consume {} s", (System.currentTimeMillis() - timer) / 1000.0);
// Get output result files into output array
for (String key : futFiles.keySet()) {
try {
File f = futFiles.get(key).get();
if (f != null) {
files.put(f.getPath(), f);
}
} catch (InterruptedException ex) {
LOG.error(getStackTrace(ex));
} catch (ExecutionException ex) {
if (!ex.getMessage().contains("NoOutputFileException")) {
LOG.error(getStackTrace(ex));
}
}
}
} catch (FileNotFoundException e) {
LOG.error(getStackTrace(e));
} catch (IOException e) {
LOG.error(getStackTrace(e));
}
} }
|
public class class_name {
@Override
public void writeFile(String arg0, Map result) {
long estTime = 0;
try {
if (getObjectOr(result, "experiments", new ArrayList()).isEmpty()
&& getObjectOr(result, "soils", new ArrayList()).isEmpty()
&& getObjectOr(result, "weathers", new ArrayList()).isEmpty()) {
// Calculate estimated time consume
HashMap wth = getObjectOr(result, "weather", new HashMap());
estTime += getObjectOr(wth, "dailyWeather", new ArrayList()).size(); // depends on control dependency: [if], data = [none]
// Write files
recordSWData(result, new DssatSoilOutput()); // depends on control dependency: [if], data = [none]
recordSWData(result, new DssatWeatherOutput()); // depends on control dependency: [if], data = [none]
writeWthFiles(arg0); // depends on control dependency: [if], data = [none]
writeSoilFiles(arg0); // depends on control dependency: [if], data = [none]
String exname = getValueOr(result, "exname", "N/A");
writeSingleExp(arg0, result, new DssatXFileOutput(), exname + "_X"); // depends on control dependency: [if], data = [none]
writeSingleExp(arg0, result, new DssatAFileOutput(), exname + "_A"); // depends on control dependency: [if], data = [none]
writeSingleExp(arg0, result, new DssatTFileOutput(), exname + "_T"); // depends on control dependency: [if], data = [none]
writeSingleExp(arg0, result, new DssatCulFileOutput(), exname + "_Cul"); // depends on control dependency: [if], data = [none]
writeSingleExp(arg0, result, new DssatBatchFileOutput(DssatVersion.DSSAT45), "DSSBatch.v45");
writeSingleExp(arg0, result, new DssatBatchFileOutput(DssatVersion.DSSAT46), "DSSBatch.v46");
writeSingleExp(arg0, result, new DssatRunFileOutput(DssatVersion.DSSAT45), "Run45.bat");
writeSingleExp(arg0, result, new DssatRunFileOutput(DssatVersion.DSSAT46), "Run46.bat");
// compress all output files into one zip file
outputFile = new File(revisePath(arg0) + exname + ".ZIP"); // depends on control dependency: [if], data = [none]
//createZip();
} else {
// Calculate estimated time consume
for (HashMap wth : (ArrayList<HashMap>) getObjectOr(result, "weathers", new ArrayList<HashMap>())) {
estTime += getObjectOr(wth, "dailyWeather", new ArrayList()).size(); // depends on control dependency: [for], data = [wth]
}
writeMultipleExp(arg0, result); // depends on control dependency: [if], data = [none]
}
if (estTime > 0) {
estTime *= 10; // depends on control dependency: [if], data = [none]
} else {
estTime = 10000; // depends on control dependency: [if], data = [none]
}
executor.shutdown(); // depends on control dependency: [try], data = [none]
long timer = System.currentTimeMillis();
HashSet<String> keys = new HashSet(futFiles.keySet());
int counter = 0;
while (!executor.isTerminated()) {
if (System.currentTimeMillis() - timer > estTime) {
counter++; // depends on control dependency: [if], data = [none]
timer = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
if (keys.isEmpty()) {
LOG.info("The executor should be terminated"); // depends on control dependency: [if], data = [none]
executor.shutdownNow(); // depends on control dependency: [if], data = [none]
} else if (counter > 3) {
LOG.info("The executor is going to be force terminated"); // depends on control dependency: [if], data = [none]
executor.shutdownNow(); // depends on control dependency: [if], data = [none]
}
String[] arr = keys.toArray(new String[0]);
for (String key : arr) {
Future futFile = futFiles.get(key);
if (futFile.isCancelled() || futFile.isDone()) {
keys.remove(key); // depends on control dependency: [if], data = [none]
} else {
LOG.info("DSSAT translation for {} is still under processing...", key); // depends on control dependency: [if], data = [none]
}
}
}
}
executor = null; // depends on control dependency: [try], data = [none]
LOG.debug("Consume {} s", (System.currentTimeMillis() - timer) / 1000.0); // depends on control dependency: [try], data = [none]
// Get output result files into output array
for (String key : futFiles.keySet()) {
try {
File f = futFiles.get(key).get();
if (f != null) {
files.put(f.getPath(), f); // depends on control dependency: [if], data = [(f]
}
} catch (InterruptedException ex) {
LOG.error(getStackTrace(ex));
} catch (ExecutionException ex) { // depends on control dependency: [catch], data = [none]
if (!ex.getMessage().contains("NoOutputFileException")) {
LOG.error(getStackTrace(ex)); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
} catch (FileNotFoundException e) {
LOG.error(getStackTrace(e));
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
LOG.error(getStackTrace(e));
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Object cacheGetMove(int iRowOrRelative, int iRowCount, int iAbsoluteRow, boolean bGet) throws DBException, RemoteException
{
m_bhtGet = bGet;
m_objCurrentPhysicalRecord = NONE;
m_objCurrentCacheRecord = NONE;
m_iCurrentLogicalPosition = iAbsoluteRow;
if ((m_iPhysicalLastRecordPlusOne != -1) && (m_iCurrentLogicalPosition >= m_iPhysicalLastRecordPlusOne))
return FieldTable.EOF_RECORD;
try {
Object objData = null;
if ((m_mapCache == null) && (m_htCache == null))
m_mapCache = new ArrayCache();
if (m_mapCache != null) if (iAbsoluteRow != -1)
objData = m_mapCache.get(iAbsoluteRow); // Try to find this in the cache
if (objData == NONE)
{
objData = FieldTable.DELETED_RECORD; // Deleted record
}
else if (objData != null)
{
m_objCurrentCacheRecord = new Integer(iAbsoluteRow);
}
else if (objData == null)
{
m_objCurrentLockedRecord = NONE; // You lose your lock on physical move.
if (m_mapCache != null)
if (iAbsoluteRow == m_mapCache.getEndIndex() + 1)
iRowCount = MULTIPLE_READ_COUNT; // If you are adding to the end of the cache, try reading a bunch at once.
if (bGet)
objData = m_tableRemote.get(iRowOrRelative, iRowCount);
else
objData = m_tableRemote.doMove(iRowOrRelative, iRowCount);
if (objData instanceof Vector)
if (((Vector)objData).size() > 1)
if (!(((Vector)objData).get(0) instanceof Vector))
iRowCount = 1; // Multiple read not supported (This vector is a record).
if (objData instanceof Vector)
{
if (m_mapCache != null)
{
m_objCurrentCacheRecord = new Integer(m_iCurrentLogicalPosition);
if (iRowCount == 1)
{
m_mapCache.set(m_iCurrentLogicalPosition, objData);
m_objCurrentPhysicalRecord = m_objCurrentCacheRecord;
}
else
{
Vector<Object> objectVector = (Vector)objData;
for (int i = objectVector.size() - 1; i >= 0; i--)
{ // I go in reverse, so the objData object will be the object at the iAbsoluteRow.
objData = objectVector.get(i);
if (objData instanceof Vector)
{
if (iAbsoluteRow != -1)
{
m_mapCache.set(iAbsoluteRow + i, objData);
if (i == objectVector.size() - 1)
m_objCurrentPhysicalRecord = new Integer(iAbsoluteRow + i);
}
}
else
if ((m_iPhysicalLastRecordPlusOne == -1) || (m_iPhysicalLastRecordPlusOne <= m_iCurrentLogicalPosition + i))
m_iPhysicalLastRecordPlusOne = m_iCurrentLogicalPosition + i; // Recordstatus = EOF
else
objData = FieldTable.DELETED_RECORD; // Deleted record
}
}
}
}
else
{
if ((m_iPhysicalLastRecordPlusOne == -1) || (m_iPhysicalLastRecordPlusOne <= m_iCurrentLogicalPosition))
m_iPhysicalLastRecordPlusOne = m_iCurrentLogicalPosition;
else
{
if ((!FieldTable.DELETED_RECORD.equals(objData)) && (!FieldTable.EOF_RECORD.equals(objData)))
objData = FieldTable.DELETED_RECORD; // Deleted record (if not one that I recognize)
}
}
}
return objData;
} catch (RemoteException ex) {
throw ex;
}
} }
|
public class class_name {
public Object cacheGetMove(int iRowOrRelative, int iRowCount, int iAbsoluteRow, boolean bGet) throws DBException, RemoteException
{
m_bhtGet = bGet;
m_objCurrentPhysicalRecord = NONE;
m_objCurrentCacheRecord = NONE;
m_iCurrentLogicalPosition = iAbsoluteRow;
if ((m_iPhysicalLastRecordPlusOne != -1) && (m_iCurrentLogicalPosition >= m_iPhysicalLastRecordPlusOne))
return FieldTable.EOF_RECORD;
try {
Object objData = null;
if ((m_mapCache == null) && (m_htCache == null))
m_mapCache = new ArrayCache();
if (m_mapCache != null) if (iAbsoluteRow != -1)
objData = m_mapCache.get(iAbsoluteRow); // Try to find this in the cache
if (objData == NONE)
{
objData = FieldTable.DELETED_RECORD; // Deleted record // depends on control dependency: [if], data = [none]
}
else if (objData != null)
{
m_objCurrentCacheRecord = new Integer(iAbsoluteRow); // depends on control dependency: [if], data = [none]
}
else if (objData == null)
{
m_objCurrentLockedRecord = NONE; // You lose your lock on physical move. // depends on control dependency: [if], data = [none]
if (m_mapCache != null)
if (iAbsoluteRow == m_mapCache.getEndIndex() + 1)
iRowCount = MULTIPLE_READ_COUNT; // If you are adding to the end of the cache, try reading a bunch at once.
if (bGet)
objData = m_tableRemote.get(iRowOrRelative, iRowCount);
else
objData = m_tableRemote.doMove(iRowOrRelative, iRowCount);
if (objData instanceof Vector)
if (((Vector)objData).size() > 1)
if (!(((Vector)objData).get(0) instanceof Vector))
iRowCount = 1; // Multiple read not supported (This vector is a record).
if (objData instanceof Vector)
{
if (m_mapCache != null)
{
m_objCurrentCacheRecord = new Integer(m_iCurrentLogicalPosition); // depends on control dependency: [if], data = [none]
if (iRowCount == 1)
{
m_mapCache.set(m_iCurrentLogicalPosition, objData); // depends on control dependency: [if], data = [none]
m_objCurrentPhysicalRecord = m_objCurrentCacheRecord; // depends on control dependency: [if], data = [none]
}
else
{
Vector<Object> objectVector = (Vector)objData;
for (int i = objectVector.size() - 1; i >= 0; i--)
{ // I go in reverse, so the objData object will be the object at the iAbsoluteRow.
objData = objectVector.get(i); // depends on control dependency: [for], data = [i]
if (objData instanceof Vector)
{
if (iAbsoluteRow != -1)
{
m_mapCache.set(iAbsoluteRow + i, objData); // depends on control dependency: [if], data = [(iAbsoluteRow]
if (i == objectVector.size() - 1)
m_objCurrentPhysicalRecord = new Integer(iAbsoluteRow + i);
}
}
else
if ((m_iPhysicalLastRecordPlusOne == -1) || (m_iPhysicalLastRecordPlusOne <= m_iCurrentLogicalPosition + i))
m_iPhysicalLastRecordPlusOne = m_iCurrentLogicalPosition + i; // Recordstatus = EOF
else
objData = FieldTable.DELETED_RECORD; // Deleted record
}
}
}
}
else
{
if ((m_iPhysicalLastRecordPlusOne == -1) || (m_iPhysicalLastRecordPlusOne <= m_iCurrentLogicalPosition))
m_iPhysicalLastRecordPlusOne = m_iCurrentLogicalPosition;
else
{
if ((!FieldTable.DELETED_RECORD.equals(objData)) && (!FieldTable.EOF_RECORD.equals(objData)))
objData = FieldTable.DELETED_RECORD; // Deleted record (if not one that I recognize)
}
}
}
return objData;
} catch (RemoteException ex) {
throw ex;
}
} }
|
public class class_name {
public static void main(String[] arg) {
System.getProperties().put("sun.java2d.noddraw", "true");
// (ulrivo): read all arguments from the command line
String lowerArg;
String urlid = null;
String rcFile = null;
boolean autoConnect = false;
boolean urlidConnect = false;
bMustExit = true;
for (int i = 0; i < arg.length; i++) {
lowerArg = arg[i].toLowerCase();
if (lowerArg.startsWith("--")) {
lowerArg = lowerArg.substring(1);
}
i++;
if (i == arg.length) {
showUsage();
return;
}
if (lowerArg.equals("-driver")) {
defDriver = arg[i];
autoConnect = true;
} else if (lowerArg.equals("-url")) {
defURL = arg[i];
autoConnect = true;
} else if (lowerArg.equals("-user")) {
defUser = arg[i];
autoConnect = true;
} else if (lowerArg.equals("-password")) {
defPassword = arg[i];
autoConnect = true;
} else if (lowerArg.equals("-urlid")) {
urlid = arg[i];
urlidConnect = true;
} else if (lowerArg.equals("-rcfile")) {
rcFile = arg[i];
urlidConnect = true;
} else if (lowerArg.equals("-dir")) {
defDirectory = arg[i];
} else if (lowerArg.equals("-script")) {
defScript = arg[i];
} else if (lowerArg.equals("-noexit")) {
bMustExit = false;
i--;
} else if (lowerArg.equals("-help")) {
showUsage();
return;
} else {
/* Syntax ERRORS should either throw or exit with non-0 status.
* In our case, it may be unsafe to exit, so we throw.
* (I.e. should provide easy way for caller to programmatically
* determine that there was an invocation problem).
*/
throw new IllegalArgumentException(
"Try: java... " + DatabaseManagerSwing.class.getName()
+ " --help");
// No reason to localize, since the main syntax message is
// not localized.
}
}
DatabaseManager m = new DatabaseManager();
m.main();
Connection c = null;
try {
if (autoConnect && urlidConnect) {
throw new IllegalArgumentException(
"You may not specify both (urlid) AND (url/user/password).");
}
if (autoConnect) {
c = ConnectionDialog.createConnection(defDriver, defURL,
defUser, defPassword);
} else if (urlidConnect) {
if (urlid == null) {
throw new IllegalArgumentException(
"You must specify an 'urlid' to use an RC file");
}
autoConnect = true;
if (rcFile == null) {
rcFile = DEFAULT_RCFILE;
}
c = new RCData(new File(rcFile), urlid).getConnection(null,
System.getProperty("sqlfile.charset"),
System.getProperty("javax.net.ssl.trustStore"));
} else {
c = ConnectionDialog.createConnection(m.fMain, "Connect");
}
} catch (Exception e) {
e.printStackTrace();
}
if (c == null) {
return;
}
m.connect(c);
} }
|
public class class_name {
public static void main(String[] arg) {
System.getProperties().put("sun.java2d.noddraw", "true");
// (ulrivo): read all arguments from the command line
String lowerArg;
String urlid = null;
String rcFile = null;
boolean autoConnect = false;
boolean urlidConnect = false;
bMustExit = true;
for (int i = 0; i < arg.length; i++) {
lowerArg = arg[i].toLowerCase(); // depends on control dependency: [for], data = [i]
if (lowerArg.startsWith("--")) {
lowerArg = lowerArg.substring(1); // depends on control dependency: [if], data = [none]
}
i++; // depends on control dependency: [for], data = [i]
if (i == arg.length) {
showUsage(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (lowerArg.equals("-driver")) {
defDriver = arg[i]; // depends on control dependency: [if], data = [none]
autoConnect = true; // depends on control dependency: [if], data = [none]
} else if (lowerArg.equals("-url")) {
defURL = arg[i]; // depends on control dependency: [if], data = [none]
autoConnect = true; // depends on control dependency: [if], data = [none]
} else if (lowerArg.equals("-user")) {
defUser = arg[i]; // depends on control dependency: [if], data = [none]
autoConnect = true; // depends on control dependency: [if], data = [none]
} else if (lowerArg.equals("-password")) {
defPassword = arg[i]; // depends on control dependency: [if], data = [none]
autoConnect = true; // depends on control dependency: [if], data = [none]
} else if (lowerArg.equals("-urlid")) {
urlid = arg[i]; // depends on control dependency: [if], data = [none]
urlidConnect = true; // depends on control dependency: [if], data = [none]
} else if (lowerArg.equals("-rcfile")) {
rcFile = arg[i]; // depends on control dependency: [if], data = [none]
urlidConnect = true; // depends on control dependency: [if], data = [none]
} else if (lowerArg.equals("-dir")) {
defDirectory = arg[i]; // depends on control dependency: [if], data = [none]
} else if (lowerArg.equals("-script")) {
defScript = arg[i]; // depends on control dependency: [if], data = [none]
} else if (lowerArg.equals("-noexit")) {
bMustExit = false; // depends on control dependency: [if], data = [none]
i--; // depends on control dependency: [if], data = [none]
} else if (lowerArg.equals("-help")) {
showUsage(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else {
/* Syntax ERRORS should either throw or exit with non-0 status.
* In our case, it may be unsafe to exit, so we throw.
* (I.e. should provide easy way for caller to programmatically
* determine that there was an invocation problem).
*/
throw new IllegalArgumentException(
"Try: java... " + DatabaseManagerSwing.class.getName()
+ " --help");
// No reason to localize, since the main syntax message is
// not localized.
}
}
DatabaseManager m = new DatabaseManager();
m.main();
Connection c = null;
try {
if (autoConnect && urlidConnect) {
throw new IllegalArgumentException(
"You may not specify both (urlid) AND (url/user/password).");
}
if (autoConnect) {
c = ConnectionDialog.createConnection(defDriver, defURL,
defUser, defPassword);
} else if (urlidConnect) {
if (urlid == null) {
throw new IllegalArgumentException(
"You must specify an 'urlid' to use an RC file");
}
autoConnect = true;
if (rcFile == null) {
rcFile = DEFAULT_RCFILE; // depends on control dependency: [if], data = [none]
}
c = new RCData(new File(rcFile), urlid).getConnection(null,
System.getProperty("sqlfile.charset"),
System.getProperty("javax.net.ssl.trustStore"));
} else {
c = ConnectionDialog.createConnection(m.fMain, "Connect");
}
} catch (Exception e) {
e.printStackTrace();
}
if (c == null) {
return;
}
m.connect(c);
} }
|
public class class_name {
public static void setField(Object instance, Class<?> type, String fieldName, Object fieldValue) {
try {
final Field field = type.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(instance, fieldValue);
} catch (Exception exception) {
throw new Error(exception);
}
} }
|
public class class_name {
public static void setField(Object instance, Class<?> type, String fieldName, Object fieldValue) {
try {
final Field field = type.getDeclaredField(fieldName);
field.setAccessible(true); // depends on control dependency: [try], data = [none]
field.set(instance, fieldValue); // depends on control dependency: [try], data = [none]
} catch (Exception exception) {
throw new Error(exception);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int getHeight ()
{
// Return the maximal height of our component mirages.
int height = 0;
for (Mirage m : _mirages) {
height = Math.max(height, m.getHeight());
}
return height;
} }
|
public class class_name {
public int getHeight ()
{
// Return the maximal height of our component mirages.
int height = 0;
for (Mirage m : _mirages) {
height = Math.max(height, m.getHeight()); // depends on control dependency: [for], data = [m]
}
return height;
} }
|
public class class_name {
public void notifyStateChangeToAvailable() {
final List<ConsumerStateListener> onAvailable = consumerConfig.getOnAvailable();
if (onAvailable != null) {
AsyncRuntime.getAsyncThreadPool().execute(new Runnable() {
@Override
public void run() {
// ็ถๆๅๅ้็ฅ็ๅฌๅจ
for (ConsumerStateListener listener : onAvailable) {
try {
listener.onAvailable(consumerConfig.getConsumerBootstrap().getProxyIns());
} catch (Exception e) {
LOGGER.warnWithApp(consumerConfig.getAppName(),
"Failed to notify consumer state listener when state change to available");
}
}
}
});
}
} }
|
public class class_name {
public void notifyStateChangeToAvailable() {
final List<ConsumerStateListener> onAvailable = consumerConfig.getOnAvailable();
if (onAvailable != null) {
AsyncRuntime.getAsyncThreadPool().execute(new Runnable() {
@Override
public void run() {
// ็ถๆๅๅ้็ฅ็ๅฌๅจ
for (ConsumerStateListener listener : onAvailable) {
try {
listener.onAvailable(consumerConfig.getConsumerBootstrap().getProxyIns()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.warnWithApp(consumerConfig.getAppName(),
"Failed to notify consumer state listener when state change to available");
} // depends on control dependency: [catch], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void close() {
if (!this.closed.get()) {
Futures.await(Services.stopAsync(this, this.executor));
log.info("{}: Closed.", this.traceObjectId);
this.closed.set(true);
}
} }
|
public class class_name {
@Override
public void close() {
if (!this.closed.get()) {
Futures.await(Services.stopAsync(this, this.executor)); // depends on control dependency: [if], data = [none]
log.info("{}: Closed.", this.traceObjectId); // depends on control dependency: [if], data = [none]
this.closed.set(true); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public TextTemplate interpolate(final Map<String, ?> variables)
{
if (variables != null)
{
final String result = new MapVariableInterpolator(buffer.toString(), variables)
.toString();
buffer.delete(0, buffer.length());
buffer.append(result);
}
return this;
} }
|
public class class_name {
@Override
public TextTemplate interpolate(final Map<String, ?> variables)
{
if (variables != null)
{
final String result = new MapVariableInterpolator(buffer.toString(), variables)
.toString();
buffer.delete(0, buffer.length());
// depends on control dependency: [if], data = [none]
buffer.append(result);
// depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
private void replaceUris(uk.ac.open.kmi.msm4j.Resource resource,
URI newUriBase) throws URISyntaxException {
// Exit early
if (resource == null || newUriBase == null || !newUriBase.isAbsolute())
return;
resource.setUri(URIUtil.replaceNamespace(resource.getUri(), newUriBase));
// Replace recursively each of the URLs of the inner elements
// Handling of Service
if (resource instanceof Service) {
// Replace Operations
List<Operation> operations = ((Service) resource).getOperations();
for (Operation op : operations) {
replaceUris(op, resource.getUri());
}
}
// Handling of Operation
if (resource instanceof Operation) {
List<MessageContent> mcs;
// Replace Inputs, Outputs, InFaults, and Outfaults
mcs = ((Operation) resource).getInputs();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri());
}
mcs = ((Operation) resource).getInputFaults();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri());
}
mcs = ((Operation) resource).getOutputs();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri());
}
mcs = ((Operation) resource).getOutputFaults();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri());
}
mcs = ((Operation) resource).getFaults();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri());
}
}
// Handling for MessageParts
if (resource instanceof MessagePart) {
// Deal with optional and mandatory parts
List<MessagePart> mps;
mps = ((MessagePart) resource).getMandatoryParts();
for (MessagePart mp : mps) {
replaceUris(mp, resource.getUri());
}
mps = ((MessagePart) resource).getOptionalParts();
for (MessagePart mp : mps) {
replaceUris(mp, resource.getUri());
}
}
// Handling for Invocable Entities
if (resource instanceof InvocableEntity) {
// Replace Effects
List<Effect> effects = ((InvocableEntity) resource).getEffects();
for (Effect effect : effects) {
replaceUris(effect, resource.getUri());
}
// Replace Conditions
List<Condition> conditions = ((InvocableEntity) resource).getConditions();
for (Condition condition : conditions) {
replaceUris(condition, resource.getUri());
}
}
// Handling for Annotable Resources
if (resource instanceof AnnotableResource) {
// Replace NFPs
List<NonFunctionalProperty> nfps = ((AnnotableResource) resource).getNfps();
for (NonFunctionalProperty nfp : nfps) {
replaceUris(nfp, resource.getUri());
}
}
} }
|
public class class_name {
private void replaceUris(uk.ac.open.kmi.msm4j.Resource resource,
URI newUriBase) throws URISyntaxException {
// Exit early
if (resource == null || newUriBase == null || !newUriBase.isAbsolute())
return;
resource.setUri(URIUtil.replaceNamespace(resource.getUri(), newUriBase));
// Replace recursively each of the URLs of the inner elements
// Handling of Service
if (resource instanceof Service) {
// Replace Operations
List<Operation> operations = ((Service) resource).getOperations();
for (Operation op : operations) {
replaceUris(op, resource.getUri()); // depends on control dependency: [for], data = [op]
}
}
// Handling of Operation
if (resource instanceof Operation) {
List<MessageContent> mcs;
// Replace Inputs, Outputs, InFaults, and Outfaults
mcs = ((Operation) resource).getInputs();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri()); // depends on control dependency: [for], data = [mc]
}
mcs = ((Operation) resource).getInputFaults();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri()); // depends on control dependency: [for], data = [mc]
}
mcs = ((Operation) resource).getOutputs();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri()); // depends on control dependency: [for], data = [mc]
}
mcs = ((Operation) resource).getOutputFaults();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri()); // depends on control dependency: [for], data = [mc]
}
mcs = ((Operation) resource).getFaults();
for (MessageContent mc : mcs) {
replaceUris(mc, resource.getUri()); // depends on control dependency: [for], data = [mc]
}
}
// Handling for MessageParts
if (resource instanceof MessagePart) {
// Deal with optional and mandatory parts
List<MessagePart> mps;
mps = ((MessagePart) resource).getMandatoryParts();
for (MessagePart mp : mps) {
replaceUris(mp, resource.getUri()); // depends on control dependency: [for], data = [mp]
}
mps = ((MessagePart) resource).getOptionalParts();
for (MessagePart mp : mps) {
replaceUris(mp, resource.getUri()); // depends on control dependency: [for], data = [mp]
}
}
// Handling for Invocable Entities
if (resource instanceof InvocableEntity) {
// Replace Effects
List<Effect> effects = ((InvocableEntity) resource).getEffects();
for (Effect effect : effects) {
replaceUris(effect, resource.getUri()); // depends on control dependency: [for], data = [effect]
}
// Replace Conditions
List<Condition> conditions = ((InvocableEntity) resource).getConditions();
for (Condition condition : conditions) {
replaceUris(condition, resource.getUri()); // depends on control dependency: [for], data = [condition]
}
}
// Handling for Annotable Resources
if (resource instanceof AnnotableResource) {
// Replace NFPs
List<NonFunctionalProperty> nfps = ((AnnotableResource) resource).getNfps();
for (NonFunctionalProperty nfp : nfps) {
replaceUris(nfp, resource.getUri()); // depends on control dependency: [for], data = [nfp]
}
}
} }
|
public class class_name {
URI generateOutputFile(final URI ref) {
final FileInfo srcFi = job.getFileInfo(ref);
final URI newSrc = srcFi.src.resolve(generateFilename());
final URI tmp = tempFileNameScheme.generateTempFileName(newSrc);
if (job.getFileInfo(tmp) == null) {
job.add(new FileInfo.Builder()
.result(newSrc)
.uri(tmp)
.build());
}
return job.tempDirURI.resolve(tmp);
} }
|
public class class_name {
URI generateOutputFile(final URI ref) {
final FileInfo srcFi = job.getFileInfo(ref);
final URI newSrc = srcFi.src.resolve(generateFilename());
final URI tmp = tempFileNameScheme.generateTempFileName(newSrc);
if (job.getFileInfo(tmp) == null) {
job.add(new FileInfo.Builder()
.result(newSrc)
.uri(tmp)
.build()); // depends on control dependency: [if], data = [none]
}
return job.tempDirURI.resolve(tmp);
} }
|
public class class_name {
private void sendLocalRestoreInformation(Long max, Set<SnapshotInfo> snapshots) {
String jsonData = serializeRestoreInformation(max, snapshots);
String zkNode = VoltZK.restore + "/" + m_hostId;
try {
m_zk.create(zkNode, jsonData.getBytes(StandardCharsets.UTF_8),
Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
} catch (Exception e) {
throw new RuntimeException("Failed to create Zookeeper node: " +
e.getMessage(), e);
}
} }
|
public class class_name {
private void sendLocalRestoreInformation(Long max, Set<SnapshotInfo> snapshots) {
String jsonData = serializeRestoreInformation(max, snapshots);
String zkNode = VoltZK.restore + "/" + m_hostId;
try {
m_zk.create(zkNode, jsonData.getBytes(StandardCharsets.UTF_8),
Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Failed to create Zookeeper node: " +
e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int compareSpecificness(final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs) {
final int a_fixLen = a.length - (a_varArgs ? 1 : 0);
final int b_fixLen = b.length - (b_varArgs ? 1 : 0);
final int fixLen = Math.min(a_fixLen, b_fixLen);
int c = 0; // result of comparison
// compare fix args
for (int i = 0; i < fixLen; i++) {
int newC = compareParameter(a[i], b[i]);
if (newC != 0 && newC != c) {
if (c == 0) c = newC;
else return 0; // ambiguous
}
}
// compare varargs of the shorter signature against fixargs of other
Class<?> a_varType = a_varArgs ? a[a_fixLen] : null;
Class<?> b_varType = b_varArgs ? b[b_fixLen] : null;
if (a_varArgs && a_fixLen < b_fixLen) {
// compare remaining fixArgs of b
for (int i = fixLen; i < b_fixLen; i++) {
int newC = compareParameter(a_varType, b[i]);
if (newC != 0 && newC != c) {
if (c == 0) c = newC;
else return 0; // ambiguous
}
}
}
if (b_varArgs && b_fixLen < a_fixLen) {
// compare remaining fixArgs of a
for (int i = fixLen; i < a_fixLen; i++) {
int newC = compareParameter(a[i], b_varType);
if (newC != 0 && newC != c) {
if (c == 0) c = newC;
else return 0; // ambiguous
}
}
}
boolean a_varArgsUsed = a_varArgs && argTypes.length > a_fixLen;
boolean b_varArgsUsed = b_varArgs && argTypes.length > b_fixLen;
if (a_varArgsUsed && b_varArgsUsed) {
// if var args are needed, compare them
int newC = compareParameter(a_varType, b_varType);
if (newC != 0 && newC != c) {
if (c == 0) c = newC;
else return 0; // ambiguous
}
}
if (c == 0) {
// if still equal, more fix args wins
if (a_fixLen > b_fixLen) {
return -1;
} else if (b_fixLen > a_fixLen) {
return 1;
}
}
return c;
} }
|
public class class_name {
public int compareSpecificness(final Class<?>[] a, boolean a_varArgs, final Class<?>[] b, boolean b_varArgs) {
final int a_fixLen = a.length - (a_varArgs ? 1 : 0);
final int b_fixLen = b.length - (b_varArgs ? 1 : 0);
final int fixLen = Math.min(a_fixLen, b_fixLen);
int c = 0; // result of comparison
// compare fix args
for (int i = 0; i < fixLen; i++) {
int newC = compareParameter(a[i], b[i]);
if (newC != 0 && newC != c) {
if (c == 0) c = newC;
else return 0; // ambiguous
}
}
// compare varargs of the shorter signature against fixargs of other
Class<?> a_varType = a_varArgs ? a[a_fixLen] : null;
Class<?> b_varType = b_varArgs ? b[b_fixLen] : null;
if (a_varArgs && a_fixLen < b_fixLen) {
// compare remaining fixArgs of b
for (int i = fixLen; i < b_fixLen; i++) {
int newC = compareParameter(a_varType, b[i]);
if (newC != 0 && newC != c) {
if (c == 0) c = newC;
else return 0; // ambiguous
}
}
}
if (b_varArgs && b_fixLen < a_fixLen) {
// compare remaining fixArgs of a
for (int i = fixLen; i < a_fixLen; i++) {
int newC = compareParameter(a[i], b_varType);
if (newC != 0 && newC != c) {
if (c == 0) c = newC;
else return 0; // ambiguous
}
}
}
boolean a_varArgsUsed = a_varArgs && argTypes.length > a_fixLen;
boolean b_varArgsUsed = b_varArgs && argTypes.length > b_fixLen;
if (a_varArgsUsed && b_varArgsUsed) {
// if var args are needed, compare them
int newC = compareParameter(a_varType, b_varType);
if (newC != 0 && newC != c) {
if (c == 0) c = newC;
else return 0; // ambiguous
}
}
if (c == 0) {
// if still equal, more fix args wins
if (a_fixLen > b_fixLen) {
return -1; // depends on control dependency: [if], data = [none]
} else if (b_fixLen > a_fixLen) {
return 1; // depends on control dependency: [if], data = [none]
}
}
return c;
} }
|
public class class_name {
public Description createErrorDescription(
ErrorMessage errorMessage,
@Nullable Tree suggestTree,
Description.Builder descriptionBuilder) {
Description.Builder builder = descriptionBuilder.setMessage(errorMessage.message);
if (config.suggestSuppressions() && suggestTree != null) {
switch (errorMessage.messageType) {
case DEREFERENCE_NULLABLE:
case RETURN_NULLABLE:
case PASS_NULLABLE:
case ASSIGN_FIELD_NULLABLE:
case SWITCH_EXPRESSION_NULLABLE:
if (config.getCastToNonNullMethod() != null) {
builder = addCastToNonNullFix(suggestTree, builder);
} else {
builder = addSuppressWarningsFix(suggestTree, builder, suppressionName);
}
break;
case CAST_TO_NONNULL_ARG_NONNULL:
builder = removeCastToNonNullFix(suggestTree, builder);
break;
case WRONG_OVERRIDE_RETURN:
builder = addSuppressWarningsFix(suggestTree, builder, suppressionName);
break;
case WRONG_OVERRIDE_PARAM:
builder = addSuppressWarningsFix(suggestTree, builder, suppressionName);
break;
case METHOD_NO_INIT:
case FIELD_NO_INIT:
builder = addSuppressWarningsFix(suggestTree, builder, INITIALIZATION_CHECK_NAME);
break;
case ANNOTATION_VALUE_INVALID:
break;
default:
builder = addSuppressWarningsFix(suggestTree, builder, suppressionName);
}
}
// #letbuildersbuild
return builder.build();
} }
|
public class class_name {
public Description createErrorDescription(
ErrorMessage errorMessage,
@Nullable Tree suggestTree,
Description.Builder descriptionBuilder) {
Description.Builder builder = descriptionBuilder.setMessage(errorMessage.message);
if (config.suggestSuppressions() && suggestTree != null) {
switch (errorMessage.messageType) {
case DEREFERENCE_NULLABLE:
case RETURN_NULLABLE:
case PASS_NULLABLE:
case ASSIGN_FIELD_NULLABLE:
case SWITCH_EXPRESSION_NULLABLE:
if (config.getCastToNonNullMethod() != null) {
builder = addCastToNonNullFix(suggestTree, builder); // depends on control dependency: [if], data = [none]
} else {
builder = addSuppressWarningsFix(suggestTree, builder, suppressionName); // depends on control dependency: [if], data = [none]
}
break;
case CAST_TO_NONNULL_ARG_NONNULL:
builder = removeCastToNonNullFix(suggestTree, builder);
break;
case WRONG_OVERRIDE_RETURN:
builder = addSuppressWarningsFix(suggestTree, builder, suppressionName);
break;
case WRONG_OVERRIDE_PARAM:
builder = addSuppressWarningsFix(suggestTree, builder, suppressionName);
break;
case METHOD_NO_INIT:
case FIELD_NO_INIT:
builder = addSuppressWarningsFix(suggestTree, builder, INITIALIZATION_CHECK_NAME);
break;
case ANNOTATION_VALUE_INVALID:
break;
default:
builder = addSuppressWarningsFix(suggestTree, builder, suppressionName);
}
}
// #letbuildersbuild
return builder.build();
} }
|
public class class_name {
public static base_responses add(nitro_service client, authenticationauthnprofile resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
authenticationauthnprofile addresources[] = new authenticationauthnprofile[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new authenticationauthnprofile();
addresources[i].name = resources[i].name;
addresources[i].authnvsname = resources[i].authnvsname;
addresources[i].authenticationhost = resources[i].authenticationhost;
addresources[i].authenticationdomain = resources[i].authenticationdomain;
addresources[i].authenticationlevel = resources[i].authenticationlevel;
}
result = add_bulk_request(client, addresources);
}
return result;
} }
|
public class class_name {
public static base_responses add(nitro_service client, authenticationauthnprofile resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
authenticationauthnprofile addresources[] = new authenticationauthnprofile[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new authenticationauthnprofile(); // depends on control dependency: [for], data = [i]
addresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i]
addresources[i].authnvsname = resources[i].authnvsname; // depends on control dependency: [for], data = [i]
addresources[i].authenticationhost = resources[i].authenticationhost; // depends on control dependency: [for], data = [i]
addresources[i].authenticationdomain = resources[i].authenticationdomain; // depends on control dependency: [for], data = [i]
addresources[i].authenticationlevel = resources[i].authenticationlevel; // depends on control dependency: [for], data = [i]
}
result = add_bulk_request(client, addresources);
}
return result;
} }
|
public class class_name {
@Override
public CPMeasurementUnit fetchByG_T_First(long groupId, int type,
OrderByComparator<CPMeasurementUnit> orderByComparator) {
List<CPMeasurementUnit> list = findByG_T(groupId, type, 0, 1,
orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} }
|
public class class_name {
@Override
public CPMeasurementUnit fetchByG_T_First(long groupId, int type,
OrderByComparator<CPMeasurementUnit> orderByComparator) {
List<CPMeasurementUnit> list = findByG_T(groupId, type, 0, 1,
orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static <T, U> T[] copyOf(final U[] original, final int newLength, final Class<? extends T[]> newType) {
final T[] copy = Object[].class.equals(newType) ? (T[]) new Object[newLength] : (T[]) N.newArray(newType.getComponentType(), newLength);
if (N.notNullOrEmpty(original)) {
copy(original, 0, copy, 0, Math.min(original.length, newLength));
}
return copy;
} }
|
public class class_name {
public static <T, U> T[] copyOf(final U[] original, final int newLength, final Class<? extends T[]> newType) {
final T[] copy = Object[].class.equals(newType) ? (T[]) new Object[newLength] : (T[]) N.newArray(newType.getComponentType(), newLength);
if (N.notNullOrEmpty(original)) {
copy(original, 0, copy, 0, Math.min(original.length, newLength));
// depends on control dependency: [if], data = [none]
}
return copy;
} }
|
public class class_name {
private void writeCategories(CmsFile file, CmsXmlContent content, CmsEntity lastEditedEntity) {
// do nothing if one of the arguments is empty.
if ((null == content) || (null == file)) {
return;
}
CmsObject cms = getCmsObject();
if (!content.getLocales().isEmpty()) {
Locale locale = content.getLocales().iterator().next();
CmsEntity entity = lastEditedEntity;
List<I_CmsXmlContentValue> values = content.getValues(locale);
for (I_CmsXmlContentValue value : values) {
if (value.getTypeName().equals(CmsXmlDynamicCategoryValue.TYPE_NAME)) {
I_CmsWidget widget = CmsWidgetUtil.collectWidgetInfo(value).getWidget();
List<CmsCategory> categories = new ArrayList<CmsCategory>(0);
try {
categories = CmsCategoryService.getInstance().readResourceCategories(cms, file);
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERROR_FAILED_READING_CATEGORIES_1), e);
}
if ((null != widget) && (widget instanceof CmsCategoryWidget)) {
String mainCategoryPath = ((CmsCategoryWidget)widget).getStartingCategory(
cms,
cms.getSitePath(file));
for (CmsCategory category : categories) {
if (category.getPath().startsWith(mainCategoryPath)) {
try {
CmsCategoryService.getInstance().removeResourceFromCategory(
cms,
cms.getSitePath(file),
category);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
if (null == entity) {
try {
CmsContentDefinition definition = readContentDefinition(
file,
content,
"dummy",
null,
locale,
false,
null,
null,
Collections.emptyMap());
entity = definition.getEntity();
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
String checkedCategories = "";
if (null != entity) {
checkedCategories = CmsEntity.getValueForPath(entity, new String[] {value.getPath()});
}
List<String> checkedCategoryList = Arrays.asList(checkedCategories.split(","));
for (String category : checkedCategoryList) {
try {
CmsCategoryService.getInstance().addResourceToCategory(
cms,
cms.getSitePath(file),
CmsCategoryService.getInstance().getCategory(cms, category));
} catch (CmsException e) {
if (LOG.isWarnEnabled()) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
}
}
}
}
}
} }
|
public class class_name {
private void writeCategories(CmsFile file, CmsXmlContent content, CmsEntity lastEditedEntity) {
// do nothing if one of the arguments is empty.
if ((null == content) || (null == file)) {
return; // depends on control dependency: [if], data = [none]
}
CmsObject cms = getCmsObject();
if (!content.getLocales().isEmpty()) {
Locale locale = content.getLocales().iterator().next();
CmsEntity entity = lastEditedEntity;
List<I_CmsXmlContentValue> values = content.getValues(locale);
for (I_CmsXmlContentValue value : values) {
if (value.getTypeName().equals(CmsXmlDynamicCategoryValue.TYPE_NAME)) {
I_CmsWidget widget = CmsWidgetUtil.collectWidgetInfo(value).getWidget();
List<CmsCategory> categories = new ArrayList<CmsCategory>(0);
try {
categories = CmsCategoryService.getInstance().readResourceCategories(cms, file); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERROR_FAILED_READING_CATEGORIES_1), e);
} // depends on control dependency: [catch], data = [none]
if ((null != widget) && (widget instanceof CmsCategoryWidget)) {
String mainCategoryPath = ((CmsCategoryWidget)widget).getStartingCategory(
cms,
cms.getSitePath(file));
for (CmsCategory category : categories) {
if (category.getPath().startsWith(mainCategoryPath)) {
try {
CmsCategoryService.getInstance().removeResourceFromCategory(
cms,
cms.getSitePath(file),
category); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
if (null == entity) {
try {
CmsContentDefinition definition = readContentDefinition(
file,
content,
"dummy",
null,
locale,
false,
null,
null,
Collections.emptyMap());
entity = definition.getEntity(); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
String checkedCategories = "";
if (null != entity) {
checkedCategories = CmsEntity.getValueForPath(entity, new String[] {value.getPath()}); // depends on control dependency: [if], data = [none]
}
List<String> checkedCategoryList = Arrays.asList(checkedCategories.split(","));
for (String category : checkedCategoryList) {
try {
CmsCategoryService.getInstance().addResourceToCategory(
cms,
cms.getSitePath(file),
CmsCategoryService.getInstance().getCategory(cms, category)); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
if (LOG.isWarnEnabled()) {
LOG.warn(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
}
}
}
} }
|
public class class_name {
@Override
public EClass getIfcRelationship() {
if (ifcRelationshipEClass == null) {
ifcRelationshipEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(564);
}
return ifcRelationshipEClass;
} }
|
public class class_name {
@Override
public EClass getIfcRelationship() {
if (ifcRelationshipEClass == null) {
ifcRelationshipEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(564);
// depends on control dependency: [if], data = [none]
}
return ifcRelationshipEClass;
} }
|
public class class_name {
public HotRodRouterConfiguration build() {
if (this.enabled) {
try {
validate();
} catch (Exception e) {
throw logger.configurationValidationError(e);
}
return new HotRodRouterConfiguration(ip, port, sendBufferSize, receiveBufferSize, tcpKeepAlive, tcpNoDelay);
}
return null;
} }
|
public class class_name {
public HotRodRouterConfiguration build() {
if (this.enabled) {
try {
validate(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw logger.configurationValidationError(e);
} // depends on control dependency: [catch], data = [none]
return new HotRodRouterConfiguration(ip, port, sendBufferSize, receiveBufferSize, tcpKeepAlive, tcpNoDelay); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
private void wireBdas(Collection<WebSphereBeanDeploymentArchive> wireFromBdas, Collection<WebSphereBeanDeploymentArchive> wireToBdas) {
for (WebSphereBeanDeploymentArchive wireFromBda : wireFromBdas) {
Collection<BeanDeploymentArchive> accessibleBdas = wireFromBda.getBeanDeploymentArchives();
for (WebSphereBeanDeploymentArchive wireToBda : wireToBdas) {
if ((wireToBda != wireFromBda) && ((accessibleBdas == null) || !accessibleBdas.contains(wireToBda))) {
wireFromBda.addBeanDeploymentArchive(wireToBda);
}
}
}
} }
|
public class class_name {
private void wireBdas(Collection<WebSphereBeanDeploymentArchive> wireFromBdas, Collection<WebSphereBeanDeploymentArchive> wireToBdas) {
for (WebSphereBeanDeploymentArchive wireFromBda : wireFromBdas) {
Collection<BeanDeploymentArchive> accessibleBdas = wireFromBda.getBeanDeploymentArchives();
for (WebSphereBeanDeploymentArchive wireToBda : wireToBdas) {
if ((wireToBda != wireFromBda) && ((accessibleBdas == null) || !accessibleBdas.contains(wireToBda))) {
wireFromBda.addBeanDeploymentArchive(wireToBda); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
private List<Task> getAppTasks(ApplicationDefinition appDef) {
List<Task> appTasks = new ArrayList<>();
try {
StorageService service = SchemaService.instance().getStorageService(appDef);
Collection<Task> appTaskColl = service.getAppTasks(appDef);
if (appTaskColl != null) {
appTasks.addAll(service.getAppTasks(appDef));
}
} catch (IllegalArgumentException e) {
// StorageService has not been initialized; no tasks for this application.
}
return appTasks;
} }
|
public class class_name {
private List<Task> getAppTasks(ApplicationDefinition appDef) {
List<Task> appTasks = new ArrayList<>();
try {
StorageService service = SchemaService.instance().getStorageService(appDef);
Collection<Task> appTaskColl = service.getAppTasks(appDef);
if (appTaskColl != null) {
appTasks.addAll(service.getAppTasks(appDef)); // depends on control dependency: [if], data = [none]
}
} catch (IllegalArgumentException e) {
// StorageService has not been initialized; no tasks for this application.
} // depends on control dependency: [catch], data = [none]
return appTasks;
} }
|
public class class_name {
private static org.tinylog.Level translateLevel(final Level level) {
if (level.intValue() <= Level.FINEST.intValue()) {
return org.tinylog.Level.TRACE;
} else if (level.intValue() <= Level.FINE.intValue()) {
return org.tinylog.Level.DEBUG;
} else if (level.intValue() <= Level.INFO.intValue()) {
return org.tinylog.Level.INFO;
} else if (level.intValue() <= Level.WARNING.intValue()) {
return org.tinylog.Level.WARN;
} else {
return org.tinylog.Level.ERROR;
}
} }
|
public class class_name {
private static org.tinylog.Level translateLevel(final Level level) {
if (level.intValue() <= Level.FINEST.intValue()) {
return org.tinylog.Level.TRACE; // depends on control dependency: [if], data = [none]
} else if (level.intValue() <= Level.FINE.intValue()) {
return org.tinylog.Level.DEBUG; // depends on control dependency: [if], data = [none]
} else if (level.intValue() <= Level.INFO.intValue()) {
return org.tinylog.Level.INFO; // depends on control dependency: [if], data = [none]
} else if (level.intValue() <= Level.WARNING.intValue()) {
return org.tinylog.Level.WARN; // depends on control dependency: [if], data = [none]
} else {
return org.tinylog.Level.ERROR; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void truncateLabelIfLong(JLabel label) {
String originalText = label.getText();
if (originalText.length() > UIConstants.MAX_LABEL_LENGTH) {
label.setToolTipText(originalText);
String truncatedText = originalText.substring(0, UIConstants.MAX_LABEL_LENGTH) + "...";
label.setText(truncatedText);
}
} }
|
public class class_name {
public static void truncateLabelIfLong(JLabel label) {
String originalText = label.getText();
if (originalText.length() > UIConstants.MAX_LABEL_LENGTH) {
label.setToolTipText(originalText); // depends on control dependency: [if], data = [none]
String truncatedText = originalText.substring(0, UIConstants.MAX_LABEL_LENGTH) + "...";
label.setText(truncatedText); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public B annotatedService(String pathPrefix, Object service,
Function<Service<HttpRequest, HttpResponse>,
? extends Service<HttpRequest, HttpResponse>> decorator,
Iterable<?> exceptionHandlersAndConverters) {
requireNonNull(pathPrefix, "pathPrefix");
requireNonNull(service, "service");
requireNonNull(decorator, "decorator");
requireNonNull(exceptionHandlersAndConverters, "exceptionHandlersAndConverters");
final List<AnnotatedHttpServiceElement> elements =
AnnotatedHttpServiceFactory.find(pathPrefix, service, exceptionHandlersAndConverters);
elements.forEach(e -> {
Service<HttpRequest, HttpResponse> s = e.service();
// Apply decorators which are specified in the service class.
s = e.decorator().apply(s);
// Apply decorators which are passed via annotatedService() methods.
s = decorator.apply(s);
// If there is a decorator, we should add one more decorator which handles an exception
// raised from decorators.
if (s != e.service()) {
s = e.service().exceptionHandlingDecorator().apply(s);
}
service(e.pathMapping(), s);
});
return self();
} }
|
public class class_name {
public B annotatedService(String pathPrefix, Object service,
Function<Service<HttpRequest, HttpResponse>,
? extends Service<HttpRequest, HttpResponse>> decorator,
Iterable<?> exceptionHandlersAndConverters) {
requireNonNull(pathPrefix, "pathPrefix");
requireNonNull(service, "service");
requireNonNull(decorator, "decorator");
requireNonNull(exceptionHandlersAndConverters, "exceptionHandlersAndConverters");
final List<AnnotatedHttpServiceElement> elements =
AnnotatedHttpServiceFactory.find(pathPrefix, service, exceptionHandlersAndConverters);
elements.forEach(e -> {
Service<HttpRequest, HttpResponse> s = e.service();
// Apply decorators which are specified in the service class.
s = e.decorator().apply(s);
// Apply decorators which are passed via annotatedService() methods.
s = decorator.apply(s);
// If there is a decorator, we should add one more decorator which handles an exception
// raised from decorators.
if (s != e.service()) {
s = e.service().exceptionHandlingDecorator().apply(s); // depends on control dependency: [if], data = [(s]
}
service(e.pathMapping(), s);
});
return self();
} }
|
public class class_name {
@Override
public synchronized Object get(Object key) {
ConcurrentHashMap<String, Object> tableRef = primaryTable;
CacheEntry curEntry = (CacheEntry) primaryTable.get(key);
// Not found in primary
if (curEntry == null) {
tableRef = secondaryTable;
curEntry = (CacheEntry) secondaryTable.get(key);
// Not found in primary or secondary
if (curEntry == null) {
tableRef = tertiaryTable;
curEntry = (CacheEntry) tertiaryTable.get(key);
}
// Not found in primary, secondary, or tertiary
if (curEntry == null) {
tableRef = null;
}
}
// If not present even in any table, add an empty entry
// that can be found faster for update
if (tableRef == null) {
curEntry = (CacheEntry) primaryTable.get(key);
if (curEntry == null) {
curEntry = new CacheEntry();
primaryTable.put(String.valueOf(key), curEntry);
}
}
return curEntry.value;
} }
|
public class class_name {
@Override
public synchronized Object get(Object key) {
ConcurrentHashMap<String, Object> tableRef = primaryTable;
CacheEntry curEntry = (CacheEntry) primaryTable.get(key);
// Not found in primary
if (curEntry == null) {
tableRef = secondaryTable; // depends on control dependency: [if], data = [none]
curEntry = (CacheEntry) secondaryTable.get(key); // depends on control dependency: [if], data = [none]
// Not found in primary or secondary
if (curEntry == null) {
tableRef = tertiaryTable; // depends on control dependency: [if], data = [none]
curEntry = (CacheEntry) tertiaryTable.get(key); // depends on control dependency: [if], data = [none]
}
// Not found in primary, secondary, or tertiary
if (curEntry == null) {
tableRef = null; // depends on control dependency: [if], data = [none]
}
}
// If not present even in any table, add an empty entry
// that can be found faster for update
if (tableRef == null) {
curEntry = (CacheEntry) primaryTable.get(key); // depends on control dependency: [if], data = [none]
if (curEntry == null) {
curEntry = new CacheEntry(); // depends on control dependency: [if], data = [none]
primaryTable.put(String.valueOf(key), curEntry); // depends on control dependency: [if], data = [none]
}
}
return curEntry.value;
} }
|
public class class_name {
public void setUpdateStatus(java.util.Collection<String> updateStatus) {
if (updateStatus == null) {
this.updateStatus = null;
return;
}
this.updateStatus = new com.amazonaws.internal.SdkInternalList<String>(updateStatus);
} }
|
public class class_name {
public void setUpdateStatus(java.util.Collection<String> updateStatus) {
if (updateStatus == null) {
this.updateStatus = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.updateStatus = new com.amazonaws.internal.SdkInternalList<String>(updateStatus);
} }
|
public class class_name {
private Integer applyWithEntry(K key, Entry<K> entry, boolean tryRehashing)
{
// Used to hold a new entry if one has to be created, or can re-use an entry passed in as a parameter.
Entry<K> uninsertedEntry = entry;
// Holds a flag to indicate that a new sequence number has been taken.
boolean createdNewEntry = false;
// Check if there is already an entry for the key, and return it if so.
Entry<K> existingEntry = entryForKey(key);
Integer result = null;
if (existingEntry != null)
{
result = existingEntry.seq;
}
else
{
// Create a new entry, if one has not already been created and cached.
if (uninsertedEntry == null)
{
uninsertedEntry = new Entry<K>();
uninsertedEntry.key = key;
uninsertedEntry.seq = nextSequenceNumber;
nextSequenceNumber++;
count++;
createdNewEntry = true;
result = uninsertedEntry.seq;
}
// Attempt to insert the new entry. The sequence number is only incremented when this succeeds for a new
// entry. Existing entries that are being re-hashed into a new table will not increment the sequence
// number.
while (true)
{
// Hash the entry for the current hash functions.
int keyHashCode = uninsertedEntry.key.hashCode();
uninsertedEntry.hash1 = hash1(keyHashCode);
uninsertedEntry.hash2 = hash2(uninsertedEntry.hash1, keyHashCode);
// Try and insert the entry, checking that no entry is left uninserted as a result.
uninsertedEntry = cuckoo(uninsertedEntry);
if (uninsertedEntry == null)
{
result = createdNewEntry ? result : -1;
break;
}
// If the cuckoo algorithm fails then change the hash function/table size and try again.
if (tryRehashing)
{
rehash();
}
else
{
result = null;
break;
}
}
}
return result;
} }
|
public class class_name {
private Integer applyWithEntry(K key, Entry<K> entry, boolean tryRehashing)
{
// Used to hold a new entry if one has to be created, or can re-use an entry passed in as a parameter.
Entry<K> uninsertedEntry = entry;
// Holds a flag to indicate that a new sequence number has been taken.
boolean createdNewEntry = false;
// Check if there is already an entry for the key, and return it if so.
Entry<K> existingEntry = entryForKey(key);
Integer result = null;
if (existingEntry != null)
{
result = existingEntry.seq; // depends on control dependency: [if], data = [none]
}
else
{
// Create a new entry, if one has not already been created and cached.
if (uninsertedEntry == null)
{
uninsertedEntry = new Entry<K>(); // depends on control dependency: [if], data = [none]
uninsertedEntry.key = key; // depends on control dependency: [if], data = [none]
uninsertedEntry.seq = nextSequenceNumber; // depends on control dependency: [if], data = [none]
nextSequenceNumber++; // depends on control dependency: [if], data = [none]
count++; // depends on control dependency: [if], data = [none]
createdNewEntry = true; // depends on control dependency: [if], data = [none]
result = uninsertedEntry.seq; // depends on control dependency: [if], data = [none]
}
// Attempt to insert the new entry. The sequence number is only incremented when this succeeds for a new
// entry. Existing entries that are being re-hashed into a new table will not increment the sequence
// number.
while (true)
{
// Hash the entry for the current hash functions.
int keyHashCode = uninsertedEntry.key.hashCode();
uninsertedEntry.hash1 = hash1(keyHashCode); // depends on control dependency: [while], data = [none]
uninsertedEntry.hash2 = hash2(uninsertedEntry.hash1, keyHashCode); // depends on control dependency: [while], data = [none]
// Try and insert the entry, checking that no entry is left uninserted as a result.
uninsertedEntry = cuckoo(uninsertedEntry); // depends on control dependency: [while], data = [none]
if (uninsertedEntry == null)
{
result = createdNewEntry ? result : -1; // depends on control dependency: [if], data = [none]
break;
}
// If the cuckoo algorithm fails then change the hash function/table size and try again.
if (tryRehashing)
{
rehash(); // depends on control dependency: [if], data = [none]
}
else
{
result = null; // depends on control dependency: [if], data = [none]
break;
}
}
}
return result;
} }
|
public class class_name {
public StorageComponent<KeyType, ValueType> getStorageComponent(final KeyType key) {
KeyToStorageComponent<KeyType, ValueType> storage = getkeyToStorage();
StorageComponent<KeyType, ValueType> storageComponent = storage.get(key);
if (storageComponent == null) {
storageComponent = new StorageComponent<KeyType, ValueType>();
storage.put(key, storageComponent);
}
return storageComponent;
} }
|
public class class_name {
public StorageComponent<KeyType, ValueType> getStorageComponent(final KeyType key) {
KeyToStorageComponent<KeyType, ValueType> storage = getkeyToStorage();
StorageComponent<KeyType, ValueType> storageComponent = storage.get(key);
if (storageComponent == null) {
storageComponent = new StorageComponent<KeyType, ValueType>(); // depends on control dependency: [if], data = [none]
storage.put(key, storageComponent); // depends on control dependency: [if], data = [none]
}
return storageComponent;
} }
|
public class class_name {
private void generateBundleModuleArgs(List<String> args, Map<String, JoinableResourceBundle> bundleMap,
Map<String, String> resultBundleMapping, JoinableResourceBundle bundle, List<String> dependencies) {
Set<String> bundleDependencies = getClosureModuleDependencies(bundle, dependencies);
// Generate a module for each bundle variant
Map<String, VariantSet> bundleVariants = bundle.getVariants();
List<Map<String, String>> variants = VariantUtils.getAllVariants(bundleVariants);
// Add default variant
if (variants.isEmpty()) {
variants.add(null);
}
for (Map<String, String> variant : variants) {
String jsFile = VariantUtils.getVariantBundleName(bundle.getId(), variant, false);
String moduleName = VariantUtils.getVariantBundleName(bundle.getName(), variant, false);
resultBundleMapping.put(moduleName, jsFile);
StringBuilder moduleArg = new StringBuilder();
moduleArg.append(moduleName + ":1:");
for (String dep : bundleDependencies) {
// Check module dependencies
checkBundleName(dep, bundleMap);
JoinableResourceBundle dependencyBundle = bundleMap.get(dep);
// Generate a module for each bundle variant
List<String> depVariantKeys = VariantUtils
.getAllVariantKeysFromFixedVariants(dependencyBundle.getVariants(), variant);
for (String depVariantKey : depVariantKeys) {
String depBundleName = VariantUtils.getVariantBundleName(dep, depVariantKey, false);
moduleArg.append(depBundleName);
moduleArg.append(MODULE_DEPENDENCIES_SEPARATOR);
}
}
moduleArg.append(JAWR_ROOT_MODULE_NAME);
addModuleArg(jsFile, moduleName, args, moduleArg);
}
} }
|
public class class_name {
private void generateBundleModuleArgs(List<String> args, Map<String, JoinableResourceBundle> bundleMap,
Map<String, String> resultBundleMapping, JoinableResourceBundle bundle, List<String> dependencies) {
Set<String> bundleDependencies = getClosureModuleDependencies(bundle, dependencies);
// Generate a module for each bundle variant
Map<String, VariantSet> bundleVariants = bundle.getVariants();
List<Map<String, String>> variants = VariantUtils.getAllVariants(bundleVariants);
// Add default variant
if (variants.isEmpty()) {
variants.add(null); // depends on control dependency: [if], data = [none]
}
for (Map<String, String> variant : variants) {
String jsFile = VariantUtils.getVariantBundleName(bundle.getId(), variant, false);
String moduleName = VariantUtils.getVariantBundleName(bundle.getName(), variant, false);
resultBundleMapping.put(moduleName, jsFile); // depends on control dependency: [for], data = [none]
StringBuilder moduleArg = new StringBuilder();
moduleArg.append(moduleName + ":1:"); // depends on control dependency: [for], data = [none]
for (String dep : bundleDependencies) {
// Check module dependencies
checkBundleName(dep, bundleMap); // depends on control dependency: [for], data = [dep]
JoinableResourceBundle dependencyBundle = bundleMap.get(dep);
// Generate a module for each bundle variant
List<String> depVariantKeys = VariantUtils
.getAllVariantKeysFromFixedVariants(dependencyBundle.getVariants(), variant);
for (String depVariantKey : depVariantKeys) {
String depBundleName = VariantUtils.getVariantBundleName(dep, depVariantKey, false);
moduleArg.append(depBundleName); // depends on control dependency: [for], data = [none]
moduleArg.append(MODULE_DEPENDENCIES_SEPARATOR); // depends on control dependency: [for], data = [none]
}
}
moduleArg.append(JAWR_ROOT_MODULE_NAME); // depends on control dependency: [for], data = [none]
addModuleArg(jsFile, moduleName, args, moduleArg); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public void setName(String name) {
if (name == null || (name = name.trim()).length() == 0) {
logger.error("Invalid pool name {}", name);
return;
}
if (!defaultName.equals(this.name) || defaultName.equals(name)) {
logger.error("Pool name is already set or duplicated, existing name = {}, incoming name = {}", this.name, name);
return;
}
this.name = name;
} }
|
public class class_name {
public void setName(String name) {
if (name == null || (name = name.trim()).length() == 0) {
logger.error("Invalid pool name {}", name); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (!defaultName.equals(this.name) || defaultName.equals(name)) {
logger.error("Pool name is already set or duplicated, existing name = {}, incoming name = {}", this.name, name); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.name = name;
} }
|
public class class_name {
public void replaceRight(Pattern aPattern, String aReplacement) {
Object lastChild = this.children.get(this.children.size() - 1);
if (lastChild instanceof SourceNode) {
((SourceNode) lastChild).replaceRight(aPattern, aReplacement);
} else if (lastChild instanceof String) {
this.children.set(this.children.size() - 1, aPattern.matcher(((String) lastChild)).replaceFirst(aReplacement));
} else {
this.children.add(aPattern.matcher("").replaceFirst(aReplacement));
}
} }
|
public class class_name {
public void replaceRight(Pattern aPattern, String aReplacement) {
Object lastChild = this.children.get(this.children.size() - 1);
if (lastChild instanceof SourceNode) {
((SourceNode) lastChild).replaceRight(aPattern, aReplacement); // depends on control dependency: [if], data = [none]
} else if (lastChild instanceof String) {
this.children.set(this.children.size() - 1, aPattern.matcher(((String) lastChild)).replaceFirst(aReplacement)); // depends on control dependency: [if], data = [none]
} else {
this.children.add(aPattern.matcher("").replaceFirst(aReplacement)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Void, JobAddHeaders>> addWithServiceResponseAsync(JobAddParameter job) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (job == null) {
throw new IllegalArgumentException("Parameter job is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(job);
final JobAddOptions jobAddOptions = null;
Integer timeout = null;
UUID clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.add(job, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobAddHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Void, JobAddHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Void, JobAddHeaders> clientResponse = addDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Void, JobAddHeaders>> addWithServiceResponseAsync(JobAddParameter job) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (job == null) {
throw new IllegalArgumentException("Parameter job is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(job);
final JobAddOptions jobAddOptions = null;
Integer timeout = null;
UUID clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return service.add(job, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, JobAddHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Void, JobAddHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Void, JobAddHeaders> clientResponse = addDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public static void styleRpr(CTParaRPr pr, Style fmtStyle) {
if (null == pr || null == fmtStyle) return;
if (StringUtils.isNotBlank(fmtStyle.getColor())) {
CTColor color = pr.isSetColor() ? pr.getColor() : pr.addNewColor();
color.setVal(fmtStyle.getColor());
}
if (null != fmtStyle.isItalic()) {
CTOnOff italic = pr.isSetI() ? pr.getI() : pr.addNewI();
italic.setVal(fmtStyle.isItalic() ? STOnOff.TRUE : STOnOff.FALSE);
}
if (null != fmtStyle.isBold()) {
CTOnOff bold = pr.isSetB() ? pr.getB() : pr.addNewB();
bold.setVal(fmtStyle.isBold() ? STOnOff.TRUE : STOnOff.FALSE);
}
if (0 != fmtStyle.getFontSize()) {
BigInteger bint = new BigInteger("" + fmtStyle.getFontSize());
CTHpsMeasure ctSize = pr.isSetSz() ? pr.getSz() : pr.addNewSz();
ctSize.setVal(bint.multiply(new BigInteger("2")));
}
if (null != fmtStyle.isStrike()) {
CTOnOff strike = pr.isSetStrike() ? pr.getStrike() : pr.addNewStrike();
strike.setVal(fmtStyle.isStrike() ? STOnOff.TRUE : STOnOff.FALSE);
}
if (StringUtils.isNotBlank(fmtStyle.getFontFamily())) {
CTFonts fonts = pr.isSetRFonts() ? pr.getRFonts() : pr.addNewRFonts();
String fontFamily = fmtStyle.getFontFamily();
fonts.setAscii(fontFamily);
if (!fonts.isSetHAnsi()) {
fonts.setHAnsi(fontFamily);
}
if (!fonts.isSetCs()) {
fonts.setCs(fontFamily);
}
if (!fonts.isSetEastAsia()) {
fonts.setEastAsia(fontFamily);
}
}
} }
|
public class class_name {
public static void styleRpr(CTParaRPr pr, Style fmtStyle) {
if (null == pr || null == fmtStyle) return;
if (StringUtils.isNotBlank(fmtStyle.getColor())) {
CTColor color = pr.isSetColor() ? pr.getColor() : pr.addNewColor();
color.setVal(fmtStyle.getColor()); // depends on control dependency: [if], data = [none]
}
if (null != fmtStyle.isItalic()) {
CTOnOff italic = pr.isSetI() ? pr.getI() : pr.addNewI();
italic.setVal(fmtStyle.isItalic() ? STOnOff.TRUE : STOnOff.FALSE); // depends on control dependency: [if], data = [none]
}
if (null != fmtStyle.isBold()) {
CTOnOff bold = pr.isSetB() ? pr.getB() : pr.addNewB();
bold.setVal(fmtStyle.isBold() ? STOnOff.TRUE : STOnOff.FALSE); // depends on control dependency: [if], data = [none]
}
if (0 != fmtStyle.getFontSize()) {
BigInteger bint = new BigInteger("" + fmtStyle.getFontSize());
CTHpsMeasure ctSize = pr.isSetSz() ? pr.getSz() : pr.addNewSz();
ctSize.setVal(bint.multiply(new BigInteger("2"))); // depends on control dependency: [if], data = [none]
}
if (null != fmtStyle.isStrike()) {
CTOnOff strike = pr.isSetStrike() ? pr.getStrike() : pr.addNewStrike();
strike.setVal(fmtStyle.isStrike() ? STOnOff.TRUE : STOnOff.FALSE); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(fmtStyle.getFontFamily())) {
CTFonts fonts = pr.isSetRFonts() ? pr.getRFonts() : pr.addNewRFonts();
String fontFamily = fmtStyle.getFontFamily();
fonts.setAscii(fontFamily); // depends on control dependency: [if], data = [none]
if (!fonts.isSetHAnsi()) {
fonts.setHAnsi(fontFamily); // depends on control dependency: [if], data = [none]
}
if (!fonts.isSetCs()) {
fonts.setCs(fontFamily); // depends on control dependency: [if], data = [none]
}
if (!fonts.isSetEastAsia()) {
fonts.setEastAsia(fontFamily); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public GetSingleConversationOptions filters(List<String> filters) {
if(filters.size() == 1) { //Canvas API doesn't want the [] if it is only one value
addSingleItem("filter", filters.get(0));
} else {
optionsMap.put("filter[]", filters);
}
return this;
} }
|
public class class_name {
public GetSingleConversationOptions filters(List<String> filters) {
if(filters.size() == 1) { //Canvas API doesn't want the [] if it is only one value
addSingleItem("filter", filters.get(0)); // depends on control dependency: [if], data = [none]
} else {
optionsMap.put("filter[]", filters);
}
return this; // depends on control dependency: [if], data = [none]
} }
|
public class class_name {
public static SourceNode fromStringWithSourceMap(String aGeneratedCode, SourceMapConsumer aSourceMapConsumer, final String aRelativePath) {
// The SourceNode we want to fill with the generated code
// and the SourceMap
final SourceNode node = new SourceNode();
// All even indices of this array are one line of the generated code,
// while all odd indices are the newlines between two adjacent lines
// (since `REGEX_NEWLINE` captures its match).
// Processed fragments are removed from this array, by calling `shiftNextLine`.
List<String> remainingLines = new ArrayList<>(Util.split(aGeneratedCode, REGEX_NEWLINE));
// We need to remember the position of "remainingLines"
int[] lastGeneratedLine = new int[] { 1 };
int[] lastGeneratedColumn = new int[] { 0 };
// The generate SourceNodes we need a code range.
// To extract it current and last mapping is used.
// Here we store the last mapping.
Mapping[] lastMapping = new Mapping[1];
aSourceMapConsumer.eachMapping().forEach(mapping -> {
if (lastMapping[0] != null) {
// We add the code from "lastMapping" to "mapping":
// First check if there is a new line in between.
if (lastGeneratedLine[0] < mapping.generated.line) {
// Associate first line with "lastMapping"
addMappingWithCode(node, aRelativePath, lastMapping[0], shiftNextLine(remainingLines));
lastGeneratedLine[0]++;
lastGeneratedColumn[0] = 0;
// The remaining code is added without mapping
} else {
// There is no new line in between.
// Associate the code between "lastGeneratedColumn" and
// "mapping.generatedColumn" with "lastMapping"
String nextLine = remainingLines.get(0);
String code = Util.substr(nextLine, 0, mapping.generated.column - lastGeneratedColumn[0]);
remainingLines.set(0, Util.substr(nextLine, mapping.generated.column - lastGeneratedColumn[0]));
lastGeneratedColumn[0] = mapping.generated.column;
addMappingWithCode(node, aRelativePath, lastMapping[0], code);
// No more remaining code, continue
lastMapping[0] = mapping;
return;
}
}
// We add the generated code until the first mapping
// to the SourceNode without any mapping.
// Each line is added as separate string.
while (lastGeneratedLine[0] < mapping.generated.line) {
node.add(shiftNextLine(remainingLines));
lastGeneratedLine[0]++;
}
if (lastGeneratedColumn[0] < mapping.generated.column && !remainingLines.isEmpty()) {
String nextLine = remainingLines.get(0);
node.add(Util.substr(nextLine, 0, mapping.generated.column));
remainingLines.set(0, Util.substr(nextLine, mapping.generated.column));
lastGeneratedColumn[0] = mapping.generated.column;
}
lastMapping[0] = mapping;
});
// We have processed all mappings.
if (remainingLines.size() > 0) {
if (lastMapping[0] != null) {
// Associate the remaining code in the current line with "lastMapping"
addMappingWithCode(node, aRelativePath, lastMapping[0], shiftNextLine(remainingLines));
}
// and add the remaining lines without any mapping
node.add(Util.join(remainingLines, ""));
}
// Copy sourcesContent into SourceNode
aSourceMapConsumer.sources().forEach(sourceFile -> {
String content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aRelativePath != null) {
sourceFile = Util.join(aRelativePath, sourceFile);
}
node.setSourceContent(sourceFile, content);
}
});
return node;
} }
|
public class class_name {
public static SourceNode fromStringWithSourceMap(String aGeneratedCode, SourceMapConsumer aSourceMapConsumer, final String aRelativePath) {
// The SourceNode we want to fill with the generated code
// and the SourceMap
final SourceNode node = new SourceNode();
// All even indices of this array are one line of the generated code,
// while all odd indices are the newlines between two adjacent lines
// (since `REGEX_NEWLINE` captures its match).
// Processed fragments are removed from this array, by calling `shiftNextLine`.
List<String> remainingLines = new ArrayList<>(Util.split(aGeneratedCode, REGEX_NEWLINE));
// We need to remember the position of "remainingLines"
int[] lastGeneratedLine = new int[] { 1 };
int[] lastGeneratedColumn = new int[] { 0 };
// The generate SourceNodes we need a code range.
// To extract it current and last mapping is used.
// Here we store the last mapping.
Mapping[] lastMapping = new Mapping[1];
aSourceMapConsumer.eachMapping().forEach(mapping -> {
if (lastMapping[0] != null) {
// We add the code from "lastMapping" to "mapping":
// First check if there is a new line in between.
if (lastGeneratedLine[0] < mapping.generated.line) {
// Associate first line with "lastMapping"
addMappingWithCode(node, aRelativePath, lastMapping[0], shiftNextLine(remainingLines)); // depends on control dependency: [if], data = [none]
lastGeneratedLine[0]++; // depends on control dependency: [if], data = [none]
lastGeneratedColumn[0] = 0; // depends on control dependency: [if], data = [none]
// The remaining code is added without mapping
} else {
// There is no new line in between.
// Associate the code between "lastGeneratedColumn" and
// "mapping.generatedColumn" with "lastMapping"
String nextLine = remainingLines.get(0);
String code = Util.substr(nextLine, 0, mapping.generated.column - lastGeneratedColumn[0]);
remainingLines.set(0, Util.substr(nextLine, mapping.generated.column - lastGeneratedColumn[0])); // depends on control dependency: [if], data = [none]
lastGeneratedColumn[0] = mapping.generated.column; // depends on control dependency: [if], data = [none]
addMappingWithCode(node, aRelativePath, lastMapping[0], code); // depends on control dependency: [if], data = [none]
// No more remaining code, continue
lastMapping[0] = mapping; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
// We add the generated code until the first mapping
// to the SourceNode without any mapping.
// Each line is added as separate string.
while (lastGeneratedLine[0] < mapping.generated.line) {
node.add(shiftNextLine(remainingLines));
lastGeneratedLine[0]++;
}
if (lastGeneratedColumn[0] < mapping.generated.column && !remainingLines.isEmpty()) {
String nextLine = remainingLines.get(0);
node.add(Util.substr(nextLine, 0, mapping.generated.column));
remainingLines.set(0, Util.substr(nextLine, mapping.generated.column));
lastGeneratedColumn[0] = mapping.generated.column;
}
lastMapping[0] = mapping;
});
// We have processed all mappings.
if (remainingLines.size() > 0) {
if (lastMapping[0] != null) {
// Associate the remaining code in the current line with "lastMapping"
addMappingWithCode(node, aRelativePath, lastMapping[0], shiftNextLine(remainingLines));
}
// and add the remaining lines without any mapping
node.add(Util.join(remainingLines, ""));
}
// Copy sourcesContent into SourceNode
aSourceMapConsumer.sources().forEach(sourceFile -> {
String content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aRelativePath != null) {
sourceFile = Util.join(aRelativePath, sourceFile);
}
node.setSourceContent(sourceFile, content);
}
});
return node;
} }
|
public class class_name {
protected JtxTransaction propNever(JtxTransaction currentTx, final JtxTransactionMode mode, final Object scope) {
if ((currentTx != null) && (!currentTx.isNoTransaction())) {
throw new JtxException("Existing TX found for TX marked with propagation 'never'");
}
if (currentTx == null) {
currentTx = createNewTransaction(mode, scope, false);
}
return currentTx;
} }
|
public class class_name {
protected JtxTransaction propNever(JtxTransaction currentTx, final JtxTransactionMode mode, final Object scope) {
if ((currentTx != null) && (!currentTx.isNoTransaction())) {
throw new JtxException("Existing TX found for TX marked with propagation 'never'");
}
if (currentTx == null) {
currentTx = createNewTransaction(mode, scope, false); // depends on control dependency: [if], data = [none]
}
return currentTx;
} }
|
public class class_name {
public void setSparseComponent(int component, int index, double value) {
if (component >= pointers.length) {
increaseSizeTo(component + 1);
}
double[] sparseInfo = new double[2];
sparseInfo[0] = index;
sparseInfo[1] = value;
pointers[component] = sparseInfo;
sparse[component] = true;
copyOnWrite[component] = false;
} }
|
public class class_name {
public void setSparseComponent(int component, int index, double value) {
if (component >= pointers.length) {
increaseSizeTo(component + 1); // depends on control dependency: [if], data = [(component]
}
double[] sparseInfo = new double[2];
sparseInfo[0] = index;
sparseInfo[1] = value;
pointers[component] = sparseInfo;
sparse[component] = true;
copyOnWrite[component] = false;
} }
|
public class class_name {
public static void execute(FileSystem hdfs, String baseUrl, String baseName, String tmpSuffix)
{
String baseRealUrl = baseUrl;
if (baseRealUrl.endsWith("/") == false)
{
baseRealUrl = baseRealUrl + "/";
}
String targetPattern = baseRealUrl + baseName + "[0-9]*" + tmpSuffix + "*";
Path targetPathPattern = new Path(targetPattern);
FileStatus[] targetTmpFiles = null;
try
{
targetTmpFiles = hdfs.globStatus(targetPathPattern);
}
catch (IOException ioex)
{
logger.warn("Failed to search preprocess target files. Skip preprocess.", ioex);
return;
}
if (targetTmpFiles.length == 0)
{
String logFormat = "Preprocess target files not exist. Path={0}";
String logMessage = MessageFormat.format(logFormat, targetPattern);
logger.info(logMessage);
return;
}
if (logger.isInfoEnabled() == true)
{
printTargetPathList(targetTmpFiles);
}
for (FileStatus targetTmpFile : targetTmpFiles)
{
renameTmpFile(hdfs, targetTmpFile.getPath().toString(), tmpSuffix);
}
} }
|
public class class_name {
public static void execute(FileSystem hdfs, String baseUrl, String baseName, String tmpSuffix)
{
String baseRealUrl = baseUrl;
if (baseRealUrl.endsWith("/") == false)
{
baseRealUrl = baseRealUrl + "/";
// depends on control dependency: [if], data = [none]
}
String targetPattern = baseRealUrl + baseName + "[0-9]*" + tmpSuffix + "*";
Path targetPathPattern = new Path(targetPattern);
FileStatus[] targetTmpFiles = null;
try
{
targetTmpFiles = hdfs.globStatus(targetPathPattern);
// depends on control dependency: [try], data = [none]
}
catch (IOException ioex)
{
logger.warn("Failed to search preprocess target files. Skip preprocess.", ioex);
return;
}
// depends on control dependency: [catch], data = [none]
if (targetTmpFiles.length == 0)
{
String logFormat = "Preprocess target files not exist. Path={0}";
String logMessage = MessageFormat.format(logFormat, targetPattern);
logger.info(logMessage);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
if (logger.isInfoEnabled() == true)
{
printTargetPathList(targetTmpFiles);
// depends on control dependency: [if], data = [none]
}
for (FileStatus targetTmpFile : targetTmpFiles)
{
renameTmpFile(hdfs, targetTmpFile.getPath().toString(), tmpSuffix);
// depends on control dependency: [for], data = [targetTmpFile]
}
} }
|
public class class_name {
public static base_responses update(nitro_service client, channel resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
channel updateresources[] = new channel[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new channel();
updateresources[i].id = resources[i].id;
updateresources[i].state = resources[i].state;
updateresources[i].mode = resources[i].mode;
updateresources[i].conndistr = resources[i].conndistr;
updateresources[i].macdistr = resources[i].macdistr;
updateresources[i].lamac = resources[i].lamac;
updateresources[i].speed = resources[i].speed;
updateresources[i].flowctl = resources[i].flowctl;
updateresources[i].hamonitor = resources[i].hamonitor;
updateresources[i].tagall = resources[i].tagall;
updateresources[i].trunk = resources[i].trunk;
updateresources[i].ifalias = resources[i].ifalias;
updateresources[i].throughput = resources[i].throughput;
updateresources[i].lrminthroughput = resources[i].lrminthroughput;
updateresources[i].bandwidthhigh = resources[i].bandwidthhigh;
updateresources[i].bandwidthnormal = resources[i].bandwidthnormal;
}
result = update_bulk_request(client, updateresources);
}
return result;
} }
|
public class class_name {
public static base_responses update(nitro_service client, channel resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
channel updateresources[] = new channel[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new channel(); // depends on control dependency: [for], data = [i]
updateresources[i].id = resources[i].id; // depends on control dependency: [for], data = [i]
updateresources[i].state = resources[i].state; // depends on control dependency: [for], data = [i]
updateresources[i].mode = resources[i].mode; // depends on control dependency: [for], data = [i]
updateresources[i].conndistr = resources[i].conndistr; // depends on control dependency: [for], data = [i]
updateresources[i].macdistr = resources[i].macdistr; // depends on control dependency: [for], data = [i]
updateresources[i].lamac = resources[i].lamac; // depends on control dependency: [for], data = [i]
updateresources[i].speed = resources[i].speed; // depends on control dependency: [for], data = [i]
updateresources[i].flowctl = resources[i].flowctl; // depends on control dependency: [for], data = [i]
updateresources[i].hamonitor = resources[i].hamonitor; // depends on control dependency: [for], data = [i]
updateresources[i].tagall = resources[i].tagall; // depends on control dependency: [for], data = [i]
updateresources[i].trunk = resources[i].trunk; // depends on control dependency: [for], data = [i]
updateresources[i].ifalias = resources[i].ifalias; // depends on control dependency: [for], data = [i]
updateresources[i].throughput = resources[i].throughput; // depends on control dependency: [for], data = [i]
updateresources[i].lrminthroughput = resources[i].lrminthroughput; // depends on control dependency: [for], data = [i]
updateresources[i].bandwidthhigh = resources[i].bandwidthhigh; // depends on control dependency: [for], data = [i]
updateresources[i].bandwidthnormal = resources[i].bandwidthnormal; // depends on control dependency: [for], data = [i]
}
result = update_bulk_request(client, updateresources);
}
return result;
} }
|
public class class_name {
@FFDCIgnore({ NoSuchElementException.class })
protected Map<String, String> getMpConfig(MpConfigProxyService service, ClassLoader cl, String propertyName, Map<String, String> map) {
try {
String value = service.getConfigValue(cl, propertyName, String.class).trim();
if (!value.isEmpty()) {
map.put(propertyName, value);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, propertyName + " is empty. Ignore it.");
}
}
} catch (NoSuchElementException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, propertyName + " is not in mpConfig.");
}
}
return map;
} }
|
public class class_name {
@FFDCIgnore({ NoSuchElementException.class })
protected Map<String, String> getMpConfig(MpConfigProxyService service, ClassLoader cl, String propertyName, Map<String, String> map) {
try {
String value = service.getConfigValue(cl, propertyName, String.class).trim();
if (!value.isEmpty()) {
map.put(propertyName, value); // depends on control dependency: [if], data = [none]
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, propertyName + " is empty. Ignore it."); // depends on control dependency: [if], data = [none]
}
}
} catch (NoSuchElementException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, propertyName + " is not in mpConfig."); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
return map;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static RTObject jTokenToRuntimeObject(Object token) throws Exception {
if (token instanceof Integer || token instanceof Float) {
return AbstractValue.create(token);
}
if (token instanceof String) {
String str = (String) token;
// String value
char firstChar = str.charAt(0);
if (firstChar == '^')
return new StringValue(str.substring(1));
else if (firstChar == '\n' && str.length() == 1)
return new StringValue("\n");
// Glue
if ("<>".equals(str))
return new Glue();
for (int i = 0; i < controlCommandNames.length; ++i) {
// Control commands (would looking up in a hash set be faster?)
String cmdName = controlCommandNames[i];
if (str.equals(cmdName)) {
return new ControlCommand(CommandType.values()[i + 1]);
}
}
// Native functions
// "^" conflicts with the way to identify strings, so now
// we know it's not a string, we can convert back to the proper
// symbol for the operator.
if ("L^".equals(str))
str = "^";
if (NativeFunctionCall.callExistsWithName(str))
return NativeFunctionCall.callWithName(str);
// Pop
if ("->->".equals(str))
return ControlCommand.popTunnel();
else if ("~ret".equals(str))
return ControlCommand.popFunction();
// Void
if ("void".equals(str))
return new Void();
}
if (token instanceof HashMap<?, ?>) {
HashMap<String, Object> obj = (HashMap<String, Object>) token;
Object propValue;
// Divert target value to path
propValue = obj.get("^->");
if (propValue != null) {
return new DivertTargetValue(new Path((String) propValue));
}
// VariablePointerValue
propValue = obj.get("^var");
if (propValue != null) {
VariablePointerValue varPtr = new VariablePointerValue((String) propValue);
propValue = obj.get("ci");
if (propValue != null)
varPtr.setContextIndex((Integer) propValue);
return varPtr;
}
// Divert
boolean isDivert = false;
boolean pushesToStack = false;
PushPopType divPushType = PushPopType.Function;
boolean external = false;
propValue = obj.get("->");
if (propValue != null) {
isDivert = true;
} else {
propValue = obj.get("f()");
if (propValue != null) {
isDivert = true;
pushesToStack = true;
divPushType = PushPopType.Function;
} else {
propValue = obj.get("->t->");
if (propValue != null) {
isDivert = true;
pushesToStack = true;
divPushType = PushPopType.Tunnel;
} else {
propValue = obj.get("x()");
if (propValue != null) {
isDivert = true;
external = true;
pushesToStack = false;
divPushType = PushPopType.Function;
}
}
}
}
if (isDivert) {
Divert divert = new Divert();
divert.setPushesToStack(pushesToStack);
divert.setStackPushType(divPushType);
divert.setExternal(external);
String target = propValue.toString();
propValue = obj.get("var");
if (propValue != null) {
divert.setVariableDivertName(target);
} else {
divert.setTargetPathString(target);
}
propValue = obj.get("c");
divert.setConditional(propValue != null);
if (external) {
propValue = obj.get("exArgs");
if (propValue != null) {
divert.setExternalArgs((Integer) propValue);
}
}
return divert;
}
// Choice
propValue = obj.get("*");
if (propValue != null) {
ChoicePoint choice = new ChoicePoint();
choice.setPathStringOnChoice(propValue.toString());
propValue = obj.get("flg");
if (propValue != null) {
choice.setFlags((Integer) propValue);
}
return choice;
}
// Variable reference
propValue = obj.get("VAR?");
if (propValue != null) {
return new VariableReference(propValue.toString());
} else {
propValue = obj.get("CNT?");
if (propValue != null) {
VariableReference readCountVarRef = new VariableReference();
readCountVarRef.setPathStringForCount(propValue.toString());
return readCountVarRef;
}
}
// Variable assignment
boolean isVarAss = false;
boolean isGlobalVar = false;
propValue = obj.get("VAR=");
if (propValue != null) {
isVarAss = true;
isGlobalVar = true;
} else {
propValue = obj.get("temp=");
if (propValue != null) {
isVarAss = true;
isGlobalVar = false;
}
}
if (isVarAss) {
String varName = propValue.toString();
propValue = obj.get("re");
boolean isNewDecl = propValue == null;
VariableAssignment varAss = new VariableAssignment(varName, isNewDecl);
varAss.setIsGlobal(isGlobalVar);
return varAss;
}
// Tag
propValue = obj.get("#");
if (propValue != null) {
return new Tag((String) propValue);
}
// List value
propValue = obj.get("list");
if (propValue != null) {
HashMap<String, Object> listContent = (HashMap<String, Object>) propValue;
InkList rawList = new InkList();
propValue = obj.get("origins");
if (propValue != null) {
List<String> namesAsObjs = (List<String>) propValue;
rawList.setInitialOriginNames(namesAsObjs);
}
for (Entry<String, Object> nameToVal : listContent.entrySet()) {
InkListItem item = new InkListItem(nameToVal.getKey());
int val = (int) nameToVal.getValue();
rawList.put(item, val);
}
return new ListValue(rawList);
}
// Used when serialising save state only
if (obj.get("originalChoicePath") != null)
return jObjectToChoice(obj);
}
// Array is always a Runtime.Container
if (token instanceof List<?>) {
return jArrayToContainer((List<Object>) token);
}
if (token == null)
return null;
throw new Exception("Failed to convert token to runtime RTObject: " + token);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static RTObject jTokenToRuntimeObject(Object token) throws Exception {
if (token instanceof Integer || token instanceof Float) {
return AbstractValue.create(token);
}
if (token instanceof String) {
String str = (String) token;
// String value
char firstChar = str.charAt(0);
if (firstChar == '^')
return new StringValue(str.substring(1));
else if (firstChar == '\n' && str.length() == 1)
return new StringValue("\n");
// Glue
if ("<>".equals(str))
return new Glue();
for (int i = 0; i < controlCommandNames.length; ++i) {
// Control commands (would looking up in a hash set be faster?)
String cmdName = controlCommandNames[i];
if (str.equals(cmdName)) {
return new ControlCommand(CommandType.values()[i + 1]);
// depends on control dependency: [if], data = [none]
}
}
// Native functions
// "^" conflicts with the way to identify strings, so now
// we know it's not a string, we can convert back to the proper
// symbol for the operator.
if ("L^".equals(str))
str = "^";
if (NativeFunctionCall.callExistsWithName(str))
return NativeFunctionCall.callWithName(str);
// Pop
if ("->->".equals(str))
return ControlCommand.popTunnel();
else if ("~ret".equals(str))
return ControlCommand.popFunction();
// Void
if ("void".equals(str))
return new Void();
}
if (token instanceof HashMap<?, ?>) {
HashMap<String, Object> obj = (HashMap<String, Object>) token;
Object propValue;
// Divert target value to path
propValue = obj.get("^->");
if (propValue != null) {
return new DivertTargetValue(new Path((String) propValue));
// depends on control dependency: [if], data = [none]
}
// VariablePointerValue
propValue = obj.get("^var");
if (propValue != null) {
VariablePointerValue varPtr = new VariablePointerValue((String) propValue);
propValue = obj.get("ci");
// depends on control dependency: [if], data = [none]
if (propValue != null)
varPtr.setContextIndex((Integer) propValue);
return varPtr;
// depends on control dependency: [if], data = [none]
}
// Divert
boolean isDivert = false;
boolean pushesToStack = false;
PushPopType divPushType = PushPopType.Function;
boolean external = false;
propValue = obj.get("->");
if (propValue != null) {
isDivert = true;
// depends on control dependency: [if], data = [none]
} else {
propValue = obj.get("f()");
// depends on control dependency: [if], data = [none]
if (propValue != null) {
isDivert = true;
// depends on control dependency: [if], data = [none]
pushesToStack = true;
// depends on control dependency: [if], data = [none]
divPushType = PushPopType.Function;
// depends on control dependency: [if], data = [none]
} else {
propValue = obj.get("->t->");
// depends on control dependency: [if], data = [none]
if (propValue != null) {
isDivert = true;
// depends on control dependency: [if], data = [none]
pushesToStack = true;
// depends on control dependency: [if], data = [none]
divPushType = PushPopType.Tunnel;
// depends on control dependency: [if], data = [none]
} else {
propValue = obj.get("x()");
// depends on control dependency: [if], data = [none]
if (propValue != null) {
isDivert = true;
// depends on control dependency: [if], data = [none]
external = true;
// depends on control dependency: [if], data = [none]
pushesToStack = false;
// depends on control dependency: [if], data = [none]
divPushType = PushPopType.Function;
// depends on control dependency: [if], data = [none]
}
}
}
}
if (isDivert) {
Divert divert = new Divert();
divert.setPushesToStack(pushesToStack);
// depends on control dependency: [if], data = [none]
divert.setStackPushType(divPushType);
// depends on control dependency: [if], data = [none]
divert.setExternal(external);
// depends on control dependency: [if], data = [none]
String target = propValue.toString();
propValue = obj.get("var");
// depends on control dependency: [if], data = [none]
if (propValue != null) {
divert.setVariableDivertName(target);
// depends on control dependency: [if], data = [none]
} else {
divert.setTargetPathString(target);
// depends on control dependency: [if], data = [none]
}
propValue = obj.get("c");
// depends on control dependency: [if], data = [none]
divert.setConditional(propValue != null);
// depends on control dependency: [if], data = [none]
if (external) {
propValue = obj.get("exArgs");
// depends on control dependency: [if], data = [none]
if (propValue != null) {
divert.setExternalArgs((Integer) propValue);
// depends on control dependency: [if], data = [none]
}
}
return divert;
// depends on control dependency: [if], data = [none]
}
// Choice
propValue = obj.get("*");
if (propValue != null) {
ChoicePoint choice = new ChoicePoint();
choice.setPathStringOnChoice(propValue.toString());
// depends on control dependency: [if], data = [(propValue]
propValue = obj.get("flg");
// depends on control dependency: [if], data = [none]
if (propValue != null) {
choice.setFlags((Integer) propValue);
// depends on control dependency: [if], data = [none]
}
return choice;
// depends on control dependency: [if], data = [none]
}
// Variable reference
propValue = obj.get("VAR?");
if (propValue != null) {
return new VariableReference(propValue.toString());
// depends on control dependency: [if], data = [(propValue]
} else {
propValue = obj.get("CNT?");
// depends on control dependency: [if], data = [none]
if (propValue != null) {
VariableReference readCountVarRef = new VariableReference();
readCountVarRef.setPathStringForCount(propValue.toString());
// depends on control dependency: [if], data = [(propValue]
return readCountVarRef;
// depends on control dependency: [if], data = [none]
}
}
// Variable assignment
boolean isVarAss = false;
boolean isGlobalVar = false;
propValue = obj.get("VAR=");
if (propValue != null) {
isVarAss = true;
// depends on control dependency: [if], data = [none]
isGlobalVar = true;
// depends on control dependency: [if], data = [none]
} else {
propValue = obj.get("temp=");
// depends on control dependency: [if], data = [none]
if (propValue != null) {
isVarAss = true;
// depends on control dependency: [if], data = [none]
isGlobalVar = false;
// depends on control dependency: [if], data = [none]
}
}
if (isVarAss) {
String varName = propValue.toString();
propValue = obj.get("re");
// depends on control dependency: [if], data = [none]
boolean isNewDecl = propValue == null;
VariableAssignment varAss = new VariableAssignment(varName, isNewDecl);
varAss.setIsGlobal(isGlobalVar);
// depends on control dependency: [if], data = [none]
return varAss;
// depends on control dependency: [if], data = [none]
}
// Tag
propValue = obj.get("#");
if (propValue != null) {
return new Tag((String) propValue);
// depends on control dependency: [if], data = [none]
}
// List value
propValue = obj.get("list");
if (propValue != null) {
HashMap<String, Object> listContent = (HashMap<String, Object>) propValue;
InkList rawList = new InkList();
propValue = obj.get("origins");
// depends on control dependency: [if], data = [none]
if (propValue != null) {
List<String> namesAsObjs = (List<String>) propValue;
rawList.setInitialOriginNames(namesAsObjs);
// depends on control dependency: [if], data = [none]
}
for (Entry<String, Object> nameToVal : listContent.entrySet()) {
InkListItem item = new InkListItem(nameToVal.getKey());
int val = (int) nameToVal.getValue();
rawList.put(item, val);
// depends on control dependency: [for], data = [none]
}
return new ListValue(rawList);
// depends on control dependency: [if], data = [none]
}
// Used when serialising save state only
if (obj.get("originalChoicePath") != null)
return jObjectToChoice(obj);
}
// Array is always a Runtime.Container
if (token instanceof List<?>) {
return jArrayToContainer((List<Object>) token);
}
if (token == null)
return null;
throw new Exception("Failed to convert token to runtime RTObject: " + token);
} }
|
public class class_name {
public synchronized void timeoutTransaction(boolean initial) {
if (tc.isEntryEnabled())
Tr.entry(tc, "timeoutTransaction", initial);
if (tc.isEventEnabled())
Tr.event(tc, "(SPI) Transaction TIMEOUT occurred for TX: " + getLocalTID());
_timedOut = true; // mark
_rollbackOnly = true; // for the case of server quiesce?
// inactivity timeout may have happened ... check status
if (_status.getState() == TransactionState.STATE_ACTIVE) {
// If there is no txn timeout, or we are into completion phase the timeout setting may be zero
if (_timeout == 0)
_timeout = 10;
TimeoutManager.setTimeout(this, TimeoutManager.REPEAT_TIMEOUT, _timeout);
}
// Story 132693: JDBC4.1 allows connections to be aborted. Only call abort on the initial
// call, not on retries.
if (initial)
abortTransactionParticipants();
if (tc.isEntryEnabled())
Tr.exit(tc, "timeoutTransaction");
} }
|
public class class_name {
public synchronized void timeoutTransaction(boolean initial) {
if (tc.isEntryEnabled())
Tr.entry(tc, "timeoutTransaction", initial);
if (tc.isEventEnabled())
Tr.event(tc, "(SPI) Transaction TIMEOUT occurred for TX: " + getLocalTID());
_timedOut = true; // mark
_rollbackOnly = true; // for the case of server quiesce?
// inactivity timeout may have happened ... check status
if (_status.getState() == TransactionState.STATE_ACTIVE) {
// If there is no txn timeout, or we are into completion phase the timeout setting may be zero
if (_timeout == 0)
_timeout = 10;
TimeoutManager.setTimeout(this, TimeoutManager.REPEAT_TIMEOUT, _timeout); // depends on control dependency: [if], data = [none]
}
// Story 132693: JDBC4.1 allows connections to be aborted. Only call abort on the initial
// call, not on retries.
if (initial)
abortTransactionParticipants();
if (tc.isEntryEnabled())
Tr.exit(tc, "timeoutTransaction");
} }
|
public class class_name {
private static double computeCost(
int[] assignments,
double[][] costMatrix,
double[] sourceTermDeletionCosts,
double[] targetTermDeletionCosts) {
// We need to sum the costs of each assigned pair, each unassigned source term, and each
// unassigned target term.
// Start with the total cost of _not_ using all the target terms, then when we use one we'll
// remove it from this total.
double totalCost = DoubleStream.of(targetTermDeletionCosts).sum();
for (int sourceTermIndex = 0; sourceTermIndex < assignments.length; sourceTermIndex++) {
int targetTermIndex = assignments[sourceTermIndex];
if (targetTermIndex == -1) {
// not using this source term
totalCost += sourceTermDeletionCosts[sourceTermIndex];
} else {
// add the cost of the assignments
totalCost += costMatrix[sourceTermIndex][targetTermIndex];
// we are using this target term and so we should remove the cost of deleting it
totalCost -= targetTermDeletionCosts[targetTermIndex];
}
}
return totalCost;
} }
|
public class class_name {
private static double computeCost(
int[] assignments,
double[][] costMatrix,
double[] sourceTermDeletionCosts,
double[] targetTermDeletionCosts) {
// We need to sum the costs of each assigned pair, each unassigned source term, and each
// unassigned target term.
// Start with the total cost of _not_ using all the target terms, then when we use one we'll
// remove it from this total.
double totalCost = DoubleStream.of(targetTermDeletionCosts).sum();
for (int sourceTermIndex = 0; sourceTermIndex < assignments.length; sourceTermIndex++) {
int targetTermIndex = assignments[sourceTermIndex];
if (targetTermIndex == -1) {
// not using this source term
totalCost += sourceTermDeletionCosts[sourceTermIndex]; // depends on control dependency: [if], data = [none]
} else {
// add the cost of the assignments
totalCost += costMatrix[sourceTermIndex][targetTermIndex]; // depends on control dependency: [if], data = [none]
// we are using this target term and so we should remove the cost of deleting it
totalCost -= targetTermDeletionCosts[targetTermIndex]; // depends on control dependency: [if], data = [none]
}
}
return totalCost;
} }
|
public class class_name {
public static void cancelTaskById(Context context, final long id, final int reason,
final SingleCancelListener cancelListener,
Class<? extends GroundyService> groundyServiceClass) {
if (id <= 0) {
throw new IllegalStateException("id must be greater than zero");
}
new GroundyServiceConnection(context, groundyServiceClass) {
@Override
protected void onGroundyServiceBound(GroundyService.GroundyServiceBinder binder) {
int result = binder.cancelTaskById(id, reason);
if (cancelListener != null) {
cancelListener.onCancelResult(id, result);
}
}
}.start();
} }
|
public class class_name {
public static void cancelTaskById(Context context, final long id, final int reason,
final SingleCancelListener cancelListener,
Class<? extends GroundyService> groundyServiceClass) {
if (id <= 0) {
throw new IllegalStateException("id must be greater than zero");
}
new GroundyServiceConnection(context, groundyServiceClass) {
@Override
protected void onGroundyServiceBound(GroundyService.GroundyServiceBinder binder) {
int result = binder.cancelTaskById(id, reason);
if (cancelListener != null) {
cancelListener.onCancelResult(id, result); // depends on control dependency: [if], data = [none]
}
}
}.start();
} }
|
public class class_name {
public javax.slee.management.DeployableUnitDescriptor getSpecsDeployableUnitDescriptor() {
Set<ComponentID> componentIDs = new HashSet<ComponentID>();
for (SleeComponent component : getDeployableUnitComponents()) {
componentIDs.add(component.getComponentID());
}
return new DeployableUnitDescriptor(getDeployableUnitID(), date,
componentIDs.toArray(new ComponentID[0]));
} }
|
public class class_name {
public javax.slee.management.DeployableUnitDescriptor getSpecsDeployableUnitDescriptor() {
Set<ComponentID> componentIDs = new HashSet<ComponentID>();
for (SleeComponent component : getDeployableUnitComponents()) {
componentIDs.add(component.getComponentID());
// depends on control dependency: [for], data = [component]
}
return new DeployableUnitDescriptor(getDeployableUnitID(), date,
componentIDs.toArray(new ComponentID[0]));
} }
|
public class class_name {
public int bindShader(GVRContext context, IRenderable rdata, GVRScene scene, boolean isMultiview)
{
String signature = getClass().getSimpleName();
GVRShaderManager shaderManager = context.getShaderManager();
GVRMaterial mtl = rdata.getMaterial();
synchronized (shaderManager)
{
int nativeShader = shaderManager.getShader(signature);
if (nativeShader == 0)
{
nativeShader = addShader(shaderManager, signature, mtl);
}
if (nativeShader > 0)
{
rdata.setShader(nativeShader, isMultiview);
}
return nativeShader;
}
} }
|
public class class_name {
public int bindShader(GVRContext context, IRenderable rdata, GVRScene scene, boolean isMultiview)
{
String signature = getClass().getSimpleName();
GVRShaderManager shaderManager = context.getShaderManager();
GVRMaterial mtl = rdata.getMaterial();
synchronized (shaderManager)
{
int nativeShader = shaderManager.getShader(signature);
if (nativeShader == 0)
{
nativeShader = addShader(shaderManager, signature, mtl); // depends on control dependency: [if], data = [none]
}
if (nativeShader > 0)
{
rdata.setShader(nativeShader, isMultiview); // depends on control dependency: [if], data = [(nativeShader]
}
return nativeShader;
}
} }
|
public class class_name {
static List<String> keyValueString(@Nullable Map<?, ?> keyValueMapping) {
List<String> result = Lists.newArrayList();
if (keyValueMapping != null && keyValueMapping.size() > 0) {
for (Map.Entry<?, ?> entry : keyValueMapping.entrySet()) {
result.add(entry.getKey() + "=" + entry.getValue());
}
Joiner joiner = Joiner.on(",");
return Collections.singletonList(joiner.join(result));
}
return Collections.emptyList();
} }
|
public class class_name {
static List<String> keyValueString(@Nullable Map<?, ?> keyValueMapping) {
List<String> result = Lists.newArrayList();
if (keyValueMapping != null && keyValueMapping.size() > 0) {
for (Map.Entry<?, ?> entry : keyValueMapping.entrySet()) {
result.add(entry.getKey() + "=" + entry.getValue()); // depends on control dependency: [for], data = [entry]
}
Joiner joiner = Joiner.on(",");
return Collections.singletonList(joiner.join(result)); // depends on control dependency: [if], data = [none]
}
return Collections.emptyList();
} }
|
public class class_name {
private void bulkloadTableFromResource(String table, Resource resource)
{
log.debug("bulk-loading data from '" + resource.getFilename()
+ "' into table '" + table + "'");
String sql = "COPY \"" + table
+ "\" FROM STDIN WITH DELIMITER E'\t' NULL AS 'NULL'";
try
{
// retrieve the currently open connection if running inside a transaction
Connection originalCon = DataSourceUtils.getConnection(getDataSource());
Connection con = originalCon;
if (con instanceof DelegatingConnection)
{
DelegatingConnection<?> delCon = (DelegatingConnection<?>) con;
con = delCon.getInnermostDelegate();
}
Preconditions.checkState(con instanceof PGConnection,
"bulk-loading only works with a PostgreSQL JDBC connection");
// Postgres JDBC4 8.4 driver now supports the copy API
PGConnection pgCon = (PGConnection) con;
pgCon.getCopyAPI().copyIn(sql, resource.getInputStream());
DataSourceUtils.releaseConnection(originalCon, getDataSource());
}
catch (SQLException e)
{
throw new DatabaseAccessException(e);
}
catch (IOException e)
{
throw new FileAccessException(e);
}
} }
|
public class class_name {
private void bulkloadTableFromResource(String table, Resource resource)
{
log.debug("bulk-loading data from '" + resource.getFilename()
+ "' into table '" + table + "'");
String sql = "COPY \"" + table
+ "\" FROM STDIN WITH DELIMITER E'\t' NULL AS 'NULL'";
try
{
// retrieve the currently open connection if running inside a transaction
Connection originalCon = DataSourceUtils.getConnection(getDataSource());
Connection con = originalCon;
if (con instanceof DelegatingConnection)
{
DelegatingConnection<?> delCon = (DelegatingConnection<?>) con;
con = delCon.getInnermostDelegate(); // depends on control dependency: [if], data = [none]
}
Preconditions.checkState(con instanceof PGConnection,
"bulk-loading only works with a PostgreSQL JDBC connection"); // depends on control dependency: [try], data = [none]
// Postgres JDBC4 8.4 driver now supports the copy API
PGConnection pgCon = (PGConnection) con;
pgCon.getCopyAPI().copyIn(sql, resource.getInputStream()); // depends on control dependency: [try], data = [none]
DataSourceUtils.releaseConnection(originalCon, getDataSource()); // depends on control dependency: [try], data = [none]
}
catch (SQLException e)
{
throw new DatabaseAccessException(e);
} // depends on control dependency: [catch], data = [none]
catch (IOException e)
{
throw new FileAccessException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void onCopiedFrom(Item src) {
super.onCopiedFrom(src);
//noinspection unchecked
TemplateDrivenMultiBranchProject<P, B> projectSrc = (TemplateDrivenMultiBranchProject<P, B>) src;
/*
* onLoad should have been invoked already, so there should be an
* empty template. Just update by XML and that's it.
*/
try {
template.updateByXml((Source) new StreamSource(projectSrc.getTemplate().getConfigFile().readRaw()));
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to copy template from " + src.getName() + " into " + getName(), e);
}
} }
|
public class class_name {
@Override
public void onCopiedFrom(Item src) {
super.onCopiedFrom(src);
//noinspection unchecked
TemplateDrivenMultiBranchProject<P, B> projectSrc = (TemplateDrivenMultiBranchProject<P, B>) src;
/*
* onLoad should have been invoked already, so there should be an
* empty template. Just update by XML and that's it.
*/
try {
template.updateByXml((Source) new StreamSource(projectSrc.getTemplate().getConfigFile().readRaw())); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to copy template from " + src.getName() + " into " + getName(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setThings(java.util.Collection<ThingAttribute> things) {
if (things == null) {
this.things = null;
return;
}
this.things = new java.util.ArrayList<ThingAttribute>(things);
} }
|
public class class_name {
public void setThings(java.util.Collection<ThingAttribute> things) {
if (things == null) {
this.things = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.things = new java.util.ArrayList<ThingAttribute>(things);
} }
|
public class class_name {
private void send(String content) {
if (!StringUtils.isBlank(content)) {
log.info("Sending system queue event to kafka-topic = '{}', data = '{}'", topicName, content);
template.send(topicName, content);
}
} }
|
public class class_name {
private void send(String content) {
if (!StringUtils.isBlank(content)) {
log.info("Sending system queue event to kafka-topic = '{}', data = '{}'", topicName, content); // depends on control dependency: [if], data = [none]
template.send(topicName, content); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void sendRequestAsync(final WireCommand request, final ReplyProcessor replyProcessor,
final CompletableFuture<?> resultFuture,
final PravegaNodeUri uri) {
try {
// get connection for the segment store node from the connectionManager.
// take a new connection from the connection manager
CompletableFuture<ConnectionWrapper> connectionFuture = connectionManager.getConnection(uri, replyProcessor);
connectionFuture.whenComplete((connection, e) -> connectionCompleteCallback(request, resultFuture, connection, e));
resultFuture.whenComplete((result, e) -> requestCompleteCallback(connectionFuture, e));
} catch (Exception e) {
resultFuture.completeExceptionally(e);
}
} }
|
public class class_name {
private void sendRequestAsync(final WireCommand request, final ReplyProcessor replyProcessor,
final CompletableFuture<?> resultFuture,
final PravegaNodeUri uri) {
try {
// get connection for the segment store node from the connectionManager.
// take a new connection from the connection manager
CompletableFuture<ConnectionWrapper> connectionFuture = connectionManager.getConnection(uri, replyProcessor);
connectionFuture.whenComplete((connection, e) -> connectionCompleteCallback(request, resultFuture, connection, e)); // depends on control dependency: [try], data = [none]
resultFuture.whenComplete((result, e) -> requestCompleteCallback(connectionFuture, e)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
resultFuture.completeExceptionally(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void start() {
if(logger.isDebugEnabled()) {
logger.debug("start");
}
if(started) {
throw new IllegalStateException("Proxy branch alredy started!");
}
if(canceled) {
throw new IllegalStateException("Proxy branch was cancelled, you must create a new branch!");
}
if(timedOut) {
throw new IllegalStateException("Proxy brnach has timed out!");
}
if(proxy.getAckReceived()) {
throw new IllegalStateException("An ACK request has been received on this proxy. Can not start new branches.");
}
// Initialize these here for efficiency.
if(logger.isDebugEnabled()) {
logger.debug("start - calling updateTimer");
}
updateTimer(false, originalRequest.getSipApplicationSession(false));
SipURI recordRoute = null;
// If the proxy is not adding record-route header, set it to null and it
// will be ignored in the Proxying
if(proxy.getRecordRoute() || this.getRecordRoute()) {
if(recordRouteURI == null && recordRouteURIString == null) {
recordRouteURIString = DEFAULT_RECORD_ROUTE_URI;
}
if(recordRouteURIString != null) {
try {
recordRouteURI = ((SipURI)proxy.getSipFactoryImpl().createURI(recordRouteURIString));
} catch (ServletParseException e) {
logger.error("A problem occured while setting the target URI while proxying a request " + recordRouteURIString, e);
}
}
recordRoute = recordRouteURI;
}
addTransaction(originalRequest);
URI destination = null;
//app may have modified the branch request, so give it priority
//fixes https://github.com/RestComm/sip-servlets/issues/131
if (outgoingRequest.getRequestURI().equals(this.getProxy().getOriginalRequest().getRequestURI()))
{
if(targetURI != null) {
try {
destination = proxy.getSipFactoryImpl().createURI(targetURI);
} catch (ServletParseException e) {
logger.error("A problem occured while setting the target URI while proxying a request " + targetURI, e);
}
}
} else {
//the app has mofified the requestURI after branch creation..
destination = outgoingRequest.getRequestURI();
}
Request cloned = ProxyUtils.createProxiedRequest(
outgoingRequest,
this,
destination,
this.outboundInterface,
recordRoute,
this.pathURI);
//tells the application dispatcher to stop routing the original request
//since it has been proxied
originalRequest.setRoutingState(RoutingState.PROXIED);
if(logger.isDebugEnabled()) {
logger.debug("Proxy Branch 1xx Timeout set to " + proxyBranch1xxTimeout);
}
if(proxyBranch1xxTimeout > 0) {
proxy1xxTimeoutTask = new ProxyBranchTimerTask(this, ResponseType.INFORMATIONAL, originalRequest.getSipApplicationSession(false));
proxy.getProxyTimerService().schedule(proxy1xxTimeoutTask, proxyBranch1xxTimeout * 1000L);
proxyBranch1xxTimerStarted = true;
}
started = true;
forwardRequest(cloned, false);
} }
|
public class class_name {
public void start() {
if(logger.isDebugEnabled()) {
logger.debug("start"); // depends on control dependency: [if], data = [none]
}
if(started) {
throw new IllegalStateException("Proxy branch alredy started!");
}
if(canceled) {
throw new IllegalStateException("Proxy branch was cancelled, you must create a new branch!");
}
if(timedOut) {
throw new IllegalStateException("Proxy brnach has timed out!");
}
if(proxy.getAckReceived()) {
throw new IllegalStateException("An ACK request has been received on this proxy. Can not start new branches.");
}
// Initialize these here for efficiency.
if(logger.isDebugEnabled()) {
logger.debug("start - calling updateTimer"); // depends on control dependency: [if], data = [none]
}
updateTimer(false, originalRequest.getSipApplicationSession(false));
SipURI recordRoute = null;
// If the proxy is not adding record-route header, set it to null and it
// will be ignored in the Proxying
if(proxy.getRecordRoute() || this.getRecordRoute()) {
if(recordRouteURI == null && recordRouteURIString == null) {
recordRouteURIString = DEFAULT_RECORD_ROUTE_URI; // depends on control dependency: [if], data = [none]
}
if(recordRouteURIString != null) {
try {
recordRouteURI = ((SipURI)proxy.getSipFactoryImpl().createURI(recordRouteURIString)); // depends on control dependency: [try], data = [none]
} catch (ServletParseException e) {
logger.error("A problem occured while setting the target URI while proxying a request " + recordRouteURIString, e);
} // depends on control dependency: [catch], data = [none]
}
recordRoute = recordRouteURI; // depends on control dependency: [if], data = [none]
}
addTransaction(originalRequest);
URI destination = null;
//app may have modified the branch request, so give it priority
//fixes https://github.com/RestComm/sip-servlets/issues/131
if (outgoingRequest.getRequestURI().equals(this.getProxy().getOriginalRequest().getRequestURI()))
{
if(targetURI != null) {
try {
destination = proxy.getSipFactoryImpl().createURI(targetURI); // depends on control dependency: [try], data = [none]
} catch (ServletParseException e) {
logger.error("A problem occured while setting the target URI while proxying a request " + targetURI, e);
} // depends on control dependency: [catch], data = [none]
}
} else {
//the app has mofified the requestURI after branch creation..
destination = outgoingRequest.getRequestURI(); // depends on control dependency: [if], data = [none]
}
Request cloned = ProxyUtils.createProxiedRequest(
outgoingRequest,
this,
destination,
this.outboundInterface,
recordRoute,
this.pathURI);
//tells the application dispatcher to stop routing the original request
//since it has been proxied
originalRequest.setRoutingState(RoutingState.PROXIED);
if(logger.isDebugEnabled()) {
logger.debug("Proxy Branch 1xx Timeout set to " + proxyBranch1xxTimeout); // depends on control dependency: [if], data = [none]
}
if(proxyBranch1xxTimeout > 0) {
proxy1xxTimeoutTask = new ProxyBranchTimerTask(this, ResponseType.INFORMATIONAL, originalRequest.getSipApplicationSession(false)); // depends on control dependency: [if], data = [none]
proxy.getProxyTimerService().schedule(proxy1xxTimeoutTask, proxyBranch1xxTimeout * 1000L); // depends on control dependency: [if], data = [none]
proxyBranch1xxTimerStarted = true; // depends on control dependency: [if], data = [none]
}
started = true;
forwardRequest(cloned, false);
} }
|
public class class_name {
@Override
protected void configure() {
VariableDecls.extend(binder()).declareVar(FILE_ENCODING_NAME);
extend(binder()).addOption(OptionMetadata.builder(
ENCODING_OPTION,
MessageFormat.format(Messages.CompilerConfigModule_0, ENCODING_OPTION))
.configPath(FILE_ENCODING_NAME)
.valueOptional(Messages.CompilerConfigModule_1)
.defaultValue(Charset.defaultCharset().displayName())
.build());
VariableDecls.extend(binder()).declareVar(JAVA_VERSION_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"javasource", //$NON-NLS-1$
Messages.CompilerConfigModule_2)
.configPath(JAVA_VERSION_NAME)
.valueOptional(Messages.CompilerConfigModule_3)
.defaultValue(SARLVersion.MINIMAL_JDK_VERSION)
.build());
VariableDecls.extend(binder()).declareVar(JAVA_COMPILER_NAME);
String jcompilerValues = null;
for (final JavaCompiler jc : JavaCompiler.values()) {
if (jcompilerValues == null) {
jcompilerValues = jc.toJsonString();
} else {
jcompilerValues = MessageFormat.format(Messages.CompilerConfigModule_5,
jcompilerValues, jc.toJsonString());
}
}
extend(binder()).addOption(OptionMetadata.builder(
"javacompiler", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_4, JavaCompiler.getDefault().toJsonString()))
.configPath(JAVA_COMPILER_NAME)
.valueOptional(jcompilerValues)
.defaultValue(JavaCompiler.getDefault().toJsonString())
.build());
final String trueFalseValues = MessageFormat.format(Messages.CompilerConfigModule_5,
Boolean.TRUE.toString(), Boolean.FALSE.toString());
VariableDecls.extend(binder()).declareVar(OUTPUT_TRACES_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"writetraces", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_6, Boolean.TRUE))
.configPath(OUTPUT_TRACES_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.TRUE.toString())
.build());
VariableDecls.extend(binder()).declareVar(OUTPUT_STORAGES_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"writestorages", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_7, Boolean.TRUE))
.configPath(OUTPUT_STORAGES_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.TRUE.toString())
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_INLINES_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generateinlines", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_8,
GeneratorConfig2.DEFAULT_GENERATE_INLINE_ANNOTATION))
.configPath(GENERATE_INLINES_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_INLINE_ANNOTATION))
.build());
VariableDecls.extend(binder()).declareVar(COMPRESS_INLINE_EXPRESSIONS_NAME);
VariableDecls.extend(binder()).declareVar(GENERATE_PURES_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generatepures", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_9, GeneratorConfig2.DEFAULT_GENERATE_PURE_ANNOTATION))
.configPath(GENERATE_PURES_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_PURE_ANNOTATION))
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_EQUALITY_TESTS_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generateequalitytests", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_10, GeneratorConfig2.DEFAULT_GENERATE_EQUALITY_TEST_FUNCTIONS))
.configPath(GENERATE_EQUALITY_TESTS_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_EQUALITY_TEST_FUNCTIONS))
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_TOSTRING_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generatetostring", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_11, GeneratorConfig2.DEFAULT_GENERATE_TOSTRING_FUNCTION))
.configPath(GENERATE_TOSTRING_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_TOSTRING_FUNCTION))
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_CLONE_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generateclones", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_12, GeneratorConfig2.DEFAULT_GENERATE_CLONE_FUNCTION))
.configPath(GENERATE_CLONE_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_CLONE_FUNCTION))
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_SERIAL_IDS_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generateserials", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_13, GeneratorConfig2.DEFAULT_GENERATE_SERIAL_NUMBER_FIELD))
.configPath(GENERATE_SERIAL_IDS_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_SERIAL_NUMBER_FIELD))
.build());
} }
|
public class class_name {
@Override
protected void configure() {
VariableDecls.extend(binder()).declareVar(FILE_ENCODING_NAME);
extend(binder()).addOption(OptionMetadata.builder(
ENCODING_OPTION,
MessageFormat.format(Messages.CompilerConfigModule_0, ENCODING_OPTION))
.configPath(FILE_ENCODING_NAME)
.valueOptional(Messages.CompilerConfigModule_1)
.defaultValue(Charset.defaultCharset().displayName())
.build());
VariableDecls.extend(binder()).declareVar(JAVA_VERSION_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"javasource", //$NON-NLS-1$
Messages.CompilerConfigModule_2)
.configPath(JAVA_VERSION_NAME)
.valueOptional(Messages.CompilerConfigModule_3)
.defaultValue(SARLVersion.MINIMAL_JDK_VERSION)
.build());
VariableDecls.extend(binder()).declareVar(JAVA_COMPILER_NAME);
String jcompilerValues = null;
for (final JavaCompiler jc : JavaCompiler.values()) {
if (jcompilerValues == null) {
jcompilerValues = jc.toJsonString(); // depends on control dependency: [if], data = [none]
} else {
jcompilerValues = MessageFormat.format(Messages.CompilerConfigModule_5,
jcompilerValues, jc.toJsonString()); // depends on control dependency: [if], data = [none]
}
}
extend(binder()).addOption(OptionMetadata.builder(
"javacompiler", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_4, JavaCompiler.getDefault().toJsonString()))
.configPath(JAVA_COMPILER_NAME)
.valueOptional(jcompilerValues)
.defaultValue(JavaCompiler.getDefault().toJsonString())
.build());
final String trueFalseValues = MessageFormat.format(Messages.CompilerConfigModule_5,
Boolean.TRUE.toString(), Boolean.FALSE.toString());
VariableDecls.extend(binder()).declareVar(OUTPUT_TRACES_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"writetraces", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_6, Boolean.TRUE))
.configPath(OUTPUT_TRACES_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.TRUE.toString())
.build());
VariableDecls.extend(binder()).declareVar(OUTPUT_STORAGES_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"writestorages", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_7, Boolean.TRUE))
.configPath(OUTPUT_STORAGES_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.TRUE.toString())
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_INLINES_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generateinlines", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_8,
GeneratorConfig2.DEFAULT_GENERATE_INLINE_ANNOTATION))
.configPath(GENERATE_INLINES_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_INLINE_ANNOTATION))
.build());
VariableDecls.extend(binder()).declareVar(COMPRESS_INLINE_EXPRESSIONS_NAME);
VariableDecls.extend(binder()).declareVar(GENERATE_PURES_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generatepures", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_9, GeneratorConfig2.DEFAULT_GENERATE_PURE_ANNOTATION))
.configPath(GENERATE_PURES_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_PURE_ANNOTATION))
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_EQUALITY_TESTS_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generateequalitytests", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_10, GeneratorConfig2.DEFAULT_GENERATE_EQUALITY_TEST_FUNCTIONS))
.configPath(GENERATE_EQUALITY_TESTS_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_EQUALITY_TEST_FUNCTIONS))
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_TOSTRING_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generatetostring", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_11, GeneratorConfig2.DEFAULT_GENERATE_TOSTRING_FUNCTION))
.configPath(GENERATE_TOSTRING_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_TOSTRING_FUNCTION))
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_CLONE_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generateclones", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_12, GeneratorConfig2.DEFAULT_GENERATE_CLONE_FUNCTION))
.configPath(GENERATE_CLONE_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_CLONE_FUNCTION))
.build());
VariableDecls.extend(binder()).declareVar(GENERATE_SERIAL_IDS_NAME);
extend(binder()).addOption(OptionMetadata.builder(
"generateserials", //$NON-NLS-1$
MessageFormat.format(Messages.CompilerConfigModule_13, GeneratorConfig2.DEFAULT_GENERATE_SERIAL_NUMBER_FIELD))
.configPath(GENERATE_SERIAL_IDS_NAME)
.valueOptional(trueFalseValues)
.defaultValue(Boolean.toString(GeneratorConfig2.DEFAULT_GENERATE_SERIAL_NUMBER_FIELD))
.build());
} }
|
public class class_name {
private boolean validParameter(final String s) {
final String[] tokens = PARAMS_REGEX.split(s);
if (tokens.length != 2) {
return false;
}
final char first = s.charAt(0);
String second = tokens[1];
if (second.endsWith(VARARGS_SUFFIX)) {
// value encoding / return type var args, mangle argument
second = varargsRoot(second);
}
if (first == 'E') {
if (isWildcard(second)) {
return true;
}
// Verify value encoding exists as an enum
if (getValueEncoding(second) != null) {
return true;
}
// Fallback to verification based on all character discriminators
for (final Character c : second.toCharArray()) {
if (getValueEncoding(c) == null) {
return false;
}
}
return true;
} else if (first == 'F') {
// Verify return type exists as an enum
if (ReturnType.getReturnType(second) != null) {
return true;
}
}
return false;
} }
|
public class class_name {
private boolean validParameter(final String s) {
final String[] tokens = PARAMS_REGEX.split(s);
if (tokens.length != 2) {
return false; // depends on control dependency: [if], data = [none]
}
final char first = s.charAt(0);
String second = tokens[1];
if (second.endsWith(VARARGS_SUFFIX)) {
// value encoding / return type var args, mangle argument
second = varargsRoot(second); // depends on control dependency: [if], data = [none]
}
if (first == 'E') {
if (isWildcard(second)) {
return true; // depends on control dependency: [if], data = [none]
}
// Verify value encoding exists as an enum
if (getValueEncoding(second) != null) {
return true; // depends on control dependency: [if], data = [none]
}
// Fallback to verification based on all character discriminators
for (final Character c : second.toCharArray()) {
if (getValueEncoding(c) == null) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true; // depends on control dependency: [if], data = [none]
} else if (first == 'F') {
// Verify return type exists as an enum
if (ReturnType.getReturnType(second) != null) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public final String makeBslResDescr(final EBankEntryResultAction pResAct,
final DateFormat pDateFormat, final APersistableBase pRecord,
final Date pDate, final String pLangDef) {
StringBuffer sb = new StringBuffer();
if (EBankEntryResultAction.MATCH.equals(pResAct)) {
sb.append(getSrvI18n().getMsg("Found", pLangDef));
} else {
sb.append(getSrvI18n().getMsg("Created", pLangDef));
}
sb.append(" " + getSrvI18n()
.getMsg(pRecord.getClass().getSimpleName() + "short", pLangDef));
sb.append("#" + pRecord.getIdDatabaseBirth() + "-" + pRecord.getItsId()
+ ", " + pDateFormat.format(pDate));
return sb.toString();
} }
|
public class class_name {
public final String makeBslResDescr(final EBankEntryResultAction pResAct,
final DateFormat pDateFormat, final APersistableBase pRecord,
final Date pDate, final String pLangDef) {
StringBuffer sb = new StringBuffer();
if (EBankEntryResultAction.MATCH.equals(pResAct)) {
sb.append(getSrvI18n().getMsg("Found", pLangDef)); // depends on control dependency: [if], data = [none]
} else {
sb.append(getSrvI18n().getMsg("Created", pLangDef)); // depends on control dependency: [if], data = [none]
}
sb.append(" " + getSrvI18n()
.getMsg(pRecord.getClass().getSimpleName() + "short", pLangDef));
sb.append("#" + pRecord.getIdDatabaseBirth() + "-" + pRecord.getItsId()
+ ", " + pDateFormat.format(pDate));
return sb.toString();
} }
|
public class class_name {
public void setDbStoragePaths(String... paths) {
if (paths == null) {
localRocksDbDirectories = null;
}
else if (paths.length == 0) {
throw new IllegalArgumentException("empty paths");
}
else {
File[] pp = new File[paths.length];
for (int i = 0; i < paths.length; i++) {
final String rawPath = paths[i];
final String path;
if (rawPath == null) {
throw new IllegalArgumentException("null path");
}
else {
// we need this for backwards compatibility, to allow URIs like 'file:///'...
URI uri = null;
try {
uri = new Path(rawPath).toUri();
}
catch (Exception e) {
// cannot parse as a path
}
if (uri != null && uri.getScheme() != null) {
if ("file".equalsIgnoreCase(uri.getScheme())) {
path = uri.getPath();
}
else {
throw new IllegalArgumentException("Path " + rawPath + " has a non-local scheme");
}
}
else {
path = rawPath;
}
}
pp[i] = new File(path);
if (!pp[i].isAbsolute()) {
throw new IllegalArgumentException("Relative paths are not supported");
}
}
localRocksDbDirectories = pp;
}
} }
|
public class class_name {
public void setDbStoragePaths(String... paths) {
if (paths == null) {
localRocksDbDirectories = null; // depends on control dependency: [if], data = [none]
}
else if (paths.length == 0) {
throw new IllegalArgumentException("empty paths");
}
else {
File[] pp = new File[paths.length];
for (int i = 0; i < paths.length; i++) {
final String rawPath = paths[i];
final String path;
if (rawPath == null) {
throw new IllegalArgumentException("null path");
}
else {
// we need this for backwards compatibility, to allow URIs like 'file:///'...
URI uri = null;
try {
uri = new Path(rawPath).toUri(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
// cannot parse as a path
} // depends on control dependency: [catch], data = [none]
if (uri != null && uri.getScheme() != null) {
if ("file".equalsIgnoreCase(uri.getScheme())) {
path = uri.getPath(); // depends on control dependency: [if], data = [none]
}
else {
throw new IllegalArgumentException("Path " + rawPath + " has a non-local scheme");
}
}
else {
path = rawPath; // depends on control dependency: [if], data = [none]
}
}
pp[i] = new File(path); // depends on control dependency: [for], data = [i]
if (!pp[i].isAbsolute()) {
throw new IllegalArgumentException("Relative paths are not supported");
}
}
localRocksDbDirectories = pp; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean verify(JComponent input) {
JTextField tf = (JTextField) input;
try {
int inputInt = Integer.parseInt(tf.getText());
return (inputInt >= min && inputInt <= max);
} catch (NumberFormatException e) {
return false;
}
} }
|
public class class_name {
public boolean verify(JComponent input) {
JTextField tf = (JTextField) input;
try {
int inputInt = Integer.parseInt(tf.getText());
return (inputInt >= min && inputInt <= max); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void setSlot(MValue newSlot, MValue oldSlot) {
if (slot.equals(oldSlot)) {
slot = newSlot;
if (newSlot == null) { parent = null; }
}
} }
|
public class class_name {
protected void setSlot(MValue newSlot, MValue oldSlot) {
if (slot.equals(oldSlot)) {
slot = newSlot; // depends on control dependency: [if], data = [none]
if (newSlot == null) { parent = null; } // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public T create(CreationalContext<T> creationalContext) {
InjectionPoint injectionPoint = getInjectionPoint(beanManager, creationalContext);
// Note the config is cached per thread context class loader
// This shouldn't matter though as the config object is updated with values dynamically
// Also means that injecting config does things the same way as calling `getConfig().getValue()`
Config config = ConfigProvider.getConfig();
T instance = null;
Type ipType = injectionPoint.getType();
boolean optional = false;
if (ipType instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType) ipType;
Type rType = pType.getRawType();
optional = (rType == Optional.class);
}
instance = (T) ConfigProducer.newValue(config, injectionPoint, ipType, optional);
return instance;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public T create(CreationalContext<T> creationalContext) {
InjectionPoint injectionPoint = getInjectionPoint(beanManager, creationalContext);
// Note the config is cached per thread context class loader
// This shouldn't matter though as the config object is updated with values dynamically
// Also means that injecting config does things the same way as calling `getConfig().getValue()`
Config config = ConfigProvider.getConfig();
T instance = null;
Type ipType = injectionPoint.getType();
boolean optional = false;
if (ipType instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType) ipType;
Type rType = pType.getRawType();
optional = (rType == Optional.class); // depends on control dependency: [if], data = [none]
}
instance = (T) ConfigProducer.newValue(config, injectionPoint, ipType, optional);
return instance;
} }
|
public class class_name {
@Override
public boolean hasExpired(SlotInfo<? extends T> info) {
long expirationAge = info.getStamp();
if (expirationAge == 0) {
long maxDelta = upperBoundMillis - lowerBoundMillis;
ThreadLocalRandom prng = ThreadLocalRandom.current();
expirationAge = lowerBoundMillis + Math.abs(prng.nextInt() % maxDelta);
info.setStamp(expirationAge);
}
long age = info.getAgeMillis();
return age >= expirationAge;
} }
|
public class class_name {
@Override
public boolean hasExpired(SlotInfo<? extends T> info) {
long expirationAge = info.getStamp();
if (expirationAge == 0) {
long maxDelta = upperBoundMillis - lowerBoundMillis;
ThreadLocalRandom prng = ThreadLocalRandom.current();
expirationAge = lowerBoundMillis + Math.abs(prng.nextInt() % maxDelta); // depends on control dependency: [if], data = [none]
info.setStamp(expirationAge); // depends on control dependency: [if], data = [(expirationAge]
}
long age = info.getAgeMillis();
return age >= expirationAge;
} }
|
public class class_name {
public String getPropertyValue() {
if (OptionHelper.isEmpty(path)) {
addError("The \"path\" property must be set.");
return null;
}
File file = new File(path);
return booleanAsStr(file.exists());
} }
|
public class class_name {
public String getPropertyValue() {
if (OptionHelper.isEmpty(path)) {
addError("The \"path\" property must be set."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
File file = new File(path);
return booleanAsStr(file.exists());
} }
|
public class class_name {
protected void setDesignContextMenu(BaseUIComponent component, Menupopup contextMenu) {
component.setAttribute(CONTEXT_MENU, contextMenu);
if (contextMenu == null) {
SavedState.restore(component);
applyHint();
} else {
new SavedState(component);
component.setContext(contextMenu);
component.setHint(getDefinition().getName());
}
} }
|
public class class_name {
protected void setDesignContextMenu(BaseUIComponent component, Menupopup contextMenu) {
component.setAttribute(CONTEXT_MENU, contextMenu);
if (contextMenu == null) {
SavedState.restore(component); // depends on control dependency: [if], data = [none]
applyHint(); // depends on control dependency: [if], data = [none]
} else {
new SavedState(component); // depends on control dependency: [if], data = [none]
component.setContext(contextMenu); // depends on control dependency: [if], data = [(contextMenu]
component.setHint(getDefinition().getName()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Map<String, ClassNode> getAssocationMap(ClassNode classNode, String associationType) {
PropertyNode property = classNode.getProperty(associationType);
Map<String, ClassNode> associationMap = new HashMap<String, ClassNode>();
if (property != null && property.isStatic()) {
Expression e = property.getInitialExpression();
if (e instanceof MapExpression) {
MapExpression me = (MapExpression) e;
for (MapEntryExpression mee : me.getMapEntryExpressions()) {
String key = mee.getKeyExpression().getText();
Expression valueExpression = mee.getValueExpression();
if (valueExpression instanceof ClassExpression) {
associationMap.put(key, valueExpression.getType());
}
}
}
}
return associationMap;
} }
|
public class class_name {
public static Map<String, ClassNode> getAssocationMap(ClassNode classNode, String associationType) {
PropertyNode property = classNode.getProperty(associationType);
Map<String, ClassNode> associationMap = new HashMap<String, ClassNode>();
if (property != null && property.isStatic()) {
Expression e = property.getInitialExpression();
if (e instanceof MapExpression) {
MapExpression me = (MapExpression) e;
for (MapEntryExpression mee : me.getMapEntryExpressions()) {
String key = mee.getKeyExpression().getText();
Expression valueExpression = mee.getValueExpression();
if (valueExpression instanceof ClassExpression) {
associationMap.put(key, valueExpression.getType()); // depends on control dependency: [if], data = [none]
}
}
}
}
return associationMap;
} }
|
public class class_name {
private static CompletionProvider optionCompletion(CompletionProvider provider) {
return (code, cursor, anchor) -> {
Matcher ovm = OPTION_VALUE_PATTERN.matcher(code);
if (ovm.matches()) {
String flag = ovm.group("flag");
List<CompletionProvider> ps = ARG_OPTIONS.entrySet().stream()
.filter(es -> es.getKey().startsWith(flag))
.map(es -> es.getValue())
.collect(toList());
if (ps.size() == 1) {
int pastSpace = ovm.start("val");
List<Suggestion> result = ps.get(0).completionSuggestions(
ovm.group("val"), cursor - pastSpace, anchor);
anchor[0] += pastSpace;
return result;
}
}
Matcher om = OPTION_PATTERN.matcher(code);
if (om.matches()) {
int pastSpace = om.start("flag");
List<Suggestion> result = provider.completionSuggestions(
om.group("flag"), cursor - pastSpace, anchor);
if (!om.group("dd").isEmpty()) {
result = result.stream()
.map(sug -> new Suggestion() {
@Override
public String continuation() {
return "-" + sug.continuation();
}
@Override
public boolean matchesType() {
return false;
}
})
.collect(toList());
--pastSpace;
}
anchor[0] += pastSpace;
return result;
}
Matcher opp = OPTION_PRE_PATTERN.matcher(code);
if (opp.matches()) {
int pastSpace = opp.end();
List<Suggestion> result = provider.completionSuggestions(
"", cursor - pastSpace, anchor);
anchor[0] += pastSpace;
return result;
}
return Collections.emptyList();
};
} }
|
public class class_name {
private static CompletionProvider optionCompletion(CompletionProvider provider) {
return (code, cursor, anchor) -> {
Matcher ovm = OPTION_VALUE_PATTERN.matcher(code);
if (ovm.matches()) {
String flag = ovm.group("flag");
List<CompletionProvider> ps = ARG_OPTIONS.entrySet().stream()
.filter(es -> es.getKey().startsWith(flag))
.map(es -> es.getValue())
.collect(toList());
if (ps.size() == 1) {
int pastSpace = ovm.start("val");
List<Suggestion> result = ps.get(0).completionSuggestions(
ovm.group("val"), cursor - pastSpace, anchor);
anchor[0] += pastSpace; // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
}
Matcher om = OPTION_PATTERN.matcher(code);
if (om.matches()) {
int pastSpace = om.start("flag");
List<Suggestion> result = provider.completionSuggestions(
om.group("flag"), cursor - pastSpace, anchor);
if (!om.group("dd").isEmpty()) {
result = result.stream()
.map(sug -> new Suggestion() {
@Override
public String continuation() {
return "-" + sug.continuation();
}
@Override
public boolean matchesType() {
return false;
}
})
.collect(toList()); // depends on control dependency: [if], data = [none]
--pastSpace; // depends on control dependency: [if], data = [none]
}
anchor[0] += pastSpace; // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
Matcher opp = OPTION_PRE_PATTERN.matcher(code);
if (opp.matches()) {
int pastSpace = opp.end();
List<Suggestion> result = provider.completionSuggestions(
"", cursor - pastSpace, anchor);
anchor[0] += pastSpace; // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
return Collections.emptyList();
};
} }
|
public class class_name {
public TransactGetItemsResult withResponses(ItemResponse... responses) {
if (this.responses == null) {
setResponses(new java.util.ArrayList<ItemResponse>(responses.length));
}
for (ItemResponse ele : responses) {
this.responses.add(ele);
}
return this;
} }
|
public class class_name {
public TransactGetItemsResult withResponses(ItemResponse... responses) {
if (this.responses == null) {
setResponses(new java.util.ArrayList<ItemResponse>(responses.length)); // depends on control dependency: [if], data = [none]
}
for (ItemResponse ele : responses) {
this.responses.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static LinkedBuffer encode(final byte[] input, int inOffset, int inLen,
final WriteSession session, final OutputStream out,
final LinkedBuffer lb) throws IOException
{
int outputSize = ((inLen+2)/3)*4;
session.size += outputSize;
final int available = lb.buffer.length - lb.offset;
if(outputSize > available)
{
final int bufSize = lb.buffer.length - lb.start;
if(outputSize > bufSize)
{
// still larger than buffer size.
int chunks = available/4;
if(chunks == 0)
{
// available size is less than 4
// flush and reset
out.write(lb.buffer, lb.start, lb.offset-lb.start);
lb.offset = lb.start;
final int loops = bufSize/4, inProcessLen = loops*3, outProcessLen = loops*4;
do
{
inOffset = encodeExplicit(input, inOffset, 0, lb.buffer,
lb.offset, loops);
out.write(lb.buffer, lb.offset, outProcessLen);
inLen -= inProcessLen;
outputSize -= outProcessLen;
}
while(inLen > inProcessLen);
// write remaining
encode(input, inOffset, inLen, lb.buffer, lb.offset);
lb.offset += outputSize;
return lb;
}
int inBefore = inOffset;
byte[] buffer = lb.buffer;
int offset = lb.offset;
byte b0, b1, b2;
// process available
while(chunks-->0)
{
b0=input[inOffset++];
b1=input[inOffset++];
b2=input[inOffset++];
buffer[offset++]=nibble2code[(b0>>>2)&0x3f];
buffer[offset++]=nibble2code[(b0<<4)&0x3f|(b1>>>4)&0x0f];
buffer[offset++]=nibble2code[(b1<<2)&0x3f|(b2>>>6)&0x03];
buffer[offset++]=nibble2code[b2&077];
}
inLen -= (inOffset - inBefore);
outputSize -= (offset - lb.offset);
// flush available
out.write(buffer, lb.start, offset-lb.start);
// reset
lb.offset = lb.start;
if(outputSize > bufSize)
{
// still larger than buffer size.
final int loops = bufSize/4, inProcessLen = loops*3, outProcessLen = loops*4;
do
{
inOffset = encodeExplicit(input, inOffset, 0, lb.buffer,
lb.offset, loops);
out.write(lb.buffer, lb.offset, outProcessLen);
inLen -= inProcessLen;
outputSize -= outProcessLen;
}
while(inLen > inProcessLen);
// write remaining
encode(input, inOffset, inLen, lb.buffer, lb.offset);
lb.offset += outputSize;
return lb;
}
encode(input, inOffset, inLen, lb.buffer, lb.offset);
lb.offset += outputSize;
return lb;
}
// flush and reset
out.write(lb.buffer, lb.start, lb.offset-lb.start);
lb.offset = lb.start;
}
encode(input, inOffset, inLen, lb.buffer, lb.offset);
lb.offset += outputSize;
return lb;
} }
|
public class class_name {
public static LinkedBuffer encode(final byte[] input, int inOffset, int inLen,
final WriteSession session, final OutputStream out,
final LinkedBuffer lb) throws IOException
{
int outputSize = ((inLen+2)/3)*4;
session.size += outputSize;
final int available = lb.buffer.length - lb.offset;
if(outputSize > available)
{
final int bufSize = lb.buffer.length - lb.start;
if(outputSize > bufSize)
{
// still larger than buffer size.
int chunks = available/4;
if(chunks == 0)
{
// available size is less than 4
// flush and reset
out.write(lb.buffer, lb.start, lb.offset-lb.start);
// depends on control dependency: [if], data = [none]
lb.offset = lb.start;
// depends on control dependency: [if], data = [none]
final int loops = bufSize/4, inProcessLen = loops*3, outProcessLen = loops*4;
do
{
inOffset = encodeExplicit(input, inOffset, 0, lb.buffer,
lb.offset, loops);
out.write(lb.buffer, lb.offset, outProcessLen);
inLen -= inProcessLen;
outputSize -= outProcessLen;
}
while(inLen > inProcessLen);
// write remaining
encode(input, inOffset, inLen, lb.buffer, lb.offset);
// depends on control dependency: [if], data = [none]
lb.offset += outputSize;
// depends on control dependency: [if], data = [none]
return lb;
// depends on control dependency: [if], data = [none]
}
int inBefore = inOffset;
byte[] buffer = lb.buffer;
int offset = lb.offset;
byte b0, b1, b2;
// process available
while(chunks-->0)
{
b0=input[inOffset++];
// depends on control dependency: [while], data = [none]
b1=input[inOffset++];
// depends on control dependency: [while], data = [none]
b2=input[inOffset++];
// depends on control dependency: [while], data = [none]
buffer[offset++]=nibble2code[(b0>>>2)&0x3f];
// depends on control dependency: [while], data = [none]
buffer[offset++]=nibble2code[(b0<<4)&0x3f|(b1>>>4)&0x0f];
// depends on control dependency: [while], data = [none]
buffer[offset++]=nibble2code[(b1<<2)&0x3f|(b2>>>6)&0x03];
// depends on control dependency: [while], data = [none]
buffer[offset++]=nibble2code[b2&077];
// depends on control dependency: [while], data = [none]
}
inLen -= (inOffset - inBefore);
// depends on control dependency: [if], data = [none]
outputSize -= (offset - lb.offset);
// depends on control dependency: [if], data = [none]
// flush available
out.write(buffer, lb.start, offset-lb.start);
// depends on control dependency: [if], data = [none]
// reset
lb.offset = lb.start;
// depends on control dependency: [if], data = [none]
if(outputSize > bufSize)
{
// still larger than buffer size.
final int loops = bufSize/4, inProcessLen = loops*3, outProcessLen = loops*4;
do
{
inOffset = encodeExplicit(input, inOffset, 0, lb.buffer,
lb.offset, loops);
out.write(lb.buffer, lb.offset, outProcessLen);
inLen -= inProcessLen;
outputSize -= outProcessLen;
}
while(inLen > inProcessLen);
// write remaining
encode(input, inOffset, inLen, lb.buffer, lb.offset);
// depends on control dependency: [if], data = [none]
lb.offset += outputSize;
// depends on control dependency: [if], data = [none]
return lb;
// depends on control dependency: [if], data = [none]
}
encode(input, inOffset, inLen, lb.buffer, lb.offset);
// depends on control dependency: [if], data = [none]
lb.offset += outputSize;
// depends on control dependency: [if], data = [none]
return lb;
// depends on control dependency: [if], data = [none]
}
// flush and reset
out.write(lb.buffer, lb.start, lb.offset-lb.start);
lb.offset = lb.start;
}
encode(input, inOffset, inLen, lb.buffer, lb.offset);
lb.offset += outputSize;
return lb;
} }
|
public class class_name {
@Override
public String getErrorMessage() {
String errorMessage = super.getErrorMessage();
if (!Util.empty(errorMessage)) {
return errorMessage;
}
if (variablePivot == null && fixedPivot == null) {
switch (operator) {
case BEFORE:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE_TODAY;
case BEFORE_OR_EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE_OR_EQUAL_TODAY;
case EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_EQUAL_TODAY;
case AFTER_OR_EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER_OR_EQUAL_TODAY;
case AFTER:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER_TODAY;
default:
throw new SystemException("Unknown operator. [" + operator + "]");
}
} else {
switch (operator) {
case BEFORE:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE;
case BEFORE_OR_EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE_OR_EQUAL;
case EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_EQUAL;
case AFTER_OR_EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER_OR_EQUAL;
case AFTER:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER;
default:
throw new SystemException("Unknown operator. [" + operator + "]");
}
}
} }
|
public class class_name {
@Override
public String getErrorMessage() {
String errorMessage = super.getErrorMessage();
if (!Util.empty(errorMessage)) {
return errorMessage; // depends on control dependency: [if], data = [none]
}
if (variablePivot == null && fixedPivot == null) {
switch (operator) {
case BEFORE:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE_TODAY;
case BEFORE_OR_EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE_OR_EQUAL_TODAY;
case EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_EQUAL_TODAY;
case AFTER_OR_EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER_OR_EQUAL_TODAY;
case AFTER:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER_TODAY;
default:
throw new SystemException("Unknown operator. [" + operator + "]");
}
} else {
switch (operator) {
case BEFORE:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE;
case BEFORE_OR_EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE_OR_EQUAL;
case EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_EQUAL;
case AFTER_OR_EQUAL:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER_OR_EQUAL;
case AFTER:
return InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER;
default:
throw new SystemException("Unknown operator. [" + operator + "]");
}
}
} }
|
public class class_name {
public GetDocumentDownloadResponse getDocumentDownload(String documentId) {
checkNotNull(documentId, "documentId should not be null.");
GetDocumentDownloadRequest request = new GetDocumentDownloadRequest();
request.setDocumentId(documentId);
InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC, request.getDocumentId());
internalRequest.addParameter("download", null);
GetDocumentDownloadResponse response;
try {
response = this.invokeHttpClient(internalRequest, GetDocumentDownloadResponse.class);
} finally {
try {
internalRequest.getContent().close();
} catch (Exception e) {
// ignore exception
}
}
return response;
} }
|
public class class_name {
public GetDocumentDownloadResponse getDocumentDownload(String documentId) {
checkNotNull(documentId, "documentId should not be null.");
GetDocumentDownloadRequest request = new GetDocumentDownloadRequest();
request.setDocumentId(documentId);
InternalRequest internalRequest = this.createRequest(HttpMethodName.GET, request, DOC, request.getDocumentId());
internalRequest.addParameter("download", null);
GetDocumentDownloadResponse response;
try {
response = this.invokeHttpClient(internalRequest, GetDocumentDownloadResponse.class); // depends on control dependency: [try], data = [none]
} finally {
try {
internalRequest.getContent().close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// ignore exception
} // depends on control dependency: [catch], data = [none]
}
return response;
} }
|
public class class_name {
private PerMessageCompressionExtension findAgreedPerMessageCompressionExtension()
{
if (mAgreedExtensions == null)
{
return null;
}
for (WebSocketExtension extension : mAgreedExtensions)
{
if (extension instanceof PerMessageCompressionExtension)
{
return (PerMessageCompressionExtension)extension;
}
}
return null;
} }
|
public class class_name {
private PerMessageCompressionExtension findAgreedPerMessageCompressionExtension()
{
if (mAgreedExtensions == null)
{
return null; // depends on control dependency: [if], data = [none]
}
for (WebSocketExtension extension : mAgreedExtensions)
{
if (extension instanceof PerMessageCompressionExtension)
{
return (PerMessageCompressionExtension)extension; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public Observable<ServiceResponse<ManagementLockObjectInner>> createOrUpdateAtResourceLevelWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, ManagementLockObjectInner parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceProviderNamespace == null) {
throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.");
}
if (parentResourcePath == null) {
throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.");
}
if (resourceType == null) {
throw new IllegalArgumentException("Parameter resourceType is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (lockName == null) {
throw new IllegalArgumentException("Parameter lockName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(parameters);
return service.createOrUpdateAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagementLockObjectInner>>>() {
@Override
public Observable<ServiceResponse<ManagementLockObjectInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ManagementLockObjectInner> clientResponse = createOrUpdateAtResourceLevelDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<ManagementLockObjectInner>> createOrUpdateAtResourceLevelWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, ManagementLockObjectInner parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceProviderNamespace == null) {
throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.");
}
if (parentResourcePath == null) {
throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.");
}
if (resourceType == null) {
throw new IllegalArgumentException("Parameter resourceType is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (lockName == null) {
throw new IllegalArgumentException("Parameter lockName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(parameters);
return service.createOrUpdateAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagementLockObjectInner>>>() {
@Override
public Observable<ServiceResponse<ManagementLockObjectInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ManagementLockObjectInner> clientResponse = createOrUpdateAtResourceLevelDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public static final Double getPercentage(byte[] data, int offset)
{
int value = MPPUtility.getShort(data, offset);
Double result = null;
if (value >= 0 && value <= 100)
{
result = NumberHelper.getDouble(value);
}
return result;
} }
|
public class class_name {
public static final Double getPercentage(byte[] data, int offset)
{
int value = MPPUtility.getShort(data, offset);
Double result = null;
if (value >= 0 && value <= 100)
{
result = NumberHelper.getDouble(value); // depends on control dependency: [if], data = [(value]
}
return result;
} }
|
public class class_name {
protected
void parseCategoryFactory(Element factoryElement) {
String className = subst(factoryElement.getAttribute(CLASS_ATTR));
if(EMPTY_STR.equals(className)) {
LogLog.error("Category Factory tag " + CLASS_ATTR + " attribute not found.");
LogLog.debug("No Category Factory configured.");
}
else {
LogLog.debug("Desired category factory: ["+className+']');
Object factory = OptionConverter.instantiateByClassName(className,
LoggerFactory.class,
null);
if (factory instanceof LoggerFactory) {
catFactory = (LoggerFactory) factory;
} else {
LogLog.error("Category Factory class " + className + " does not implement org.apache.log4j.LoggerFactory");
}
PropertySetter propSetter = new PropertySetter(factory);
Element currentElement = null;
Node currentNode = null;
NodeList children = factoryElement.getChildNodes();
final int length = children.getLength();
for (int loop=0; loop < length; loop++) {
currentNode = children.item(loop);
if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
currentElement = (Element)currentNode;
if (currentElement.getTagName().equals(PARAM_TAG)) {
setParameter(currentElement, propSetter);
} else {
quietParseUnrecognizedElement(factory, currentElement, props);
}
}
}
}
} }
|
public class class_name {
protected
void parseCategoryFactory(Element factoryElement) {
String className = subst(factoryElement.getAttribute(CLASS_ATTR));
if(EMPTY_STR.equals(className)) {
LogLog.error("Category Factory tag " + CLASS_ATTR + " attribute not found."); // depends on control dependency: [if], data = [none]
LogLog.debug("No Category Factory configured."); // depends on control dependency: [if], data = [none]
}
else {
LogLog.debug("Desired category factory: ["+className+']'); // depends on control dependency: [if], data = [none]
Object factory = OptionConverter.instantiateByClassName(className,
LoggerFactory.class,
null);
if (factory instanceof LoggerFactory) {
catFactory = (LoggerFactory) factory; // depends on control dependency: [if], data = [none]
} else {
LogLog.error("Category Factory class " + className + " does not implement org.apache.log4j.LoggerFactory"); // depends on control dependency: [if], data = [none]
}
PropertySetter propSetter = new PropertySetter(factory);
Element currentElement = null;
Node currentNode = null;
NodeList children = factoryElement.getChildNodes();
final int length = children.getLength();
for (int loop=0; loop < length; loop++) {
currentNode = children.item(loop); // depends on control dependency: [for], data = [loop]
if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
currentElement = (Element)currentNode; // depends on control dependency: [if], data = [none]
if (currentElement.getTagName().equals(PARAM_TAG)) {
setParameter(currentElement, propSetter); // depends on control dependency: [if], data = [none]
} else {
quietParseUnrecognizedElement(factory, currentElement, props); // depends on control dependency: [if], data = [none]
}
}
}
}
} }
|
public class class_name {
public void marshall(Authorizer authorizer, ProtocolMarshaller protocolMarshaller) {
if (authorizer == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(authorizer.getAuthorizerCredentialsArn(), AUTHORIZERCREDENTIALSARN_BINDING);
protocolMarshaller.marshall(authorizer.getAuthorizerId(), AUTHORIZERID_BINDING);
protocolMarshaller.marshall(authorizer.getAuthorizerResultTtlInSeconds(), AUTHORIZERRESULTTTLINSECONDS_BINDING);
protocolMarshaller.marshall(authorizer.getAuthorizerType(), AUTHORIZERTYPE_BINDING);
protocolMarshaller.marshall(authorizer.getAuthorizerUri(), AUTHORIZERURI_BINDING);
protocolMarshaller.marshall(authorizer.getIdentitySource(), IDENTITYSOURCE_BINDING);
protocolMarshaller.marshall(authorizer.getIdentityValidationExpression(), IDENTITYVALIDATIONEXPRESSION_BINDING);
protocolMarshaller.marshall(authorizer.getName(), NAME_BINDING);
protocolMarshaller.marshall(authorizer.getProviderArns(), PROVIDERARNS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Authorizer authorizer, ProtocolMarshaller protocolMarshaller) {
if (authorizer == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(authorizer.getAuthorizerCredentialsArn(), AUTHORIZERCREDENTIALSARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authorizer.getAuthorizerId(), AUTHORIZERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authorizer.getAuthorizerResultTtlInSeconds(), AUTHORIZERRESULTTTLINSECONDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authorizer.getAuthorizerType(), AUTHORIZERTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authorizer.getAuthorizerUri(), AUTHORIZERURI_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authorizer.getIdentitySource(), IDENTITYSOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authorizer.getIdentityValidationExpression(), IDENTITYVALIDATIONEXPRESSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authorizer.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authorizer.getProviderArns(), PROVIDERARNS_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 ServiceCall<InputStream> synthesize(SynthesizeOptions synthesizeOptions) {
Validator.notNull(synthesizeOptions, "synthesizeOptions cannot be null");
String[] pathSegments = { "v1/synthesize" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "synthesize");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
if (synthesizeOptions.accept() != null) {
builder.header("Accept", synthesizeOptions.accept());
}
if (synthesizeOptions.voice() != null) {
builder.query("voice", synthesizeOptions.voice());
}
if (synthesizeOptions.customizationId() != null) {
builder.query("customization_id", synthesizeOptions.customizationId());
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("text", synthesizeOptions.text());
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getInputStream());
} }
|
public class class_name {
public ServiceCall<InputStream> synthesize(SynthesizeOptions synthesizeOptions) {
Validator.notNull(synthesizeOptions, "synthesizeOptions cannot be null");
String[] pathSegments = { "v1/synthesize" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "synthesize");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
if (synthesizeOptions.accept() != null) {
builder.header("Accept", synthesizeOptions.accept()); // depends on control dependency: [if], data = [none]
}
if (synthesizeOptions.voice() != null) {
builder.query("voice", synthesizeOptions.voice()); // depends on control dependency: [if], data = [none]
}
if (synthesizeOptions.customizationId() != null) {
builder.query("customization_id", synthesizeOptions.customizationId()); // depends on control dependency: [if], data = [none]
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("text", synthesizeOptions.text());
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getInputStream());
} }
|
public class class_name {
public static void setThreadPool(ThreadPoolExecutor pool) {
if (ConcurrencyTools.pool != pool) {
shutdown();
ConcurrencyTools.pool = pool;
}
} }
|
public class class_name {
public static void setThreadPool(ThreadPoolExecutor pool) {
if (ConcurrencyTools.pool != pool) {
shutdown(); // depends on control dependency: [if], data = [none]
ConcurrencyTools.pool = pool; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public CompoundCurve toCompoundCurve(List<Polyline> polylineList,
boolean hasZ, boolean hasM) {
CompoundCurve compoundCurve = new CompoundCurve(hasZ, hasM);
for (Polyline polyline : polylineList) {
LineString lineString = toLineString(polyline);
compoundCurve.addLineString(lineString);
}
return compoundCurve;
} }
|
public class class_name {
public CompoundCurve toCompoundCurve(List<Polyline> polylineList,
boolean hasZ, boolean hasM) {
CompoundCurve compoundCurve = new CompoundCurve(hasZ, hasM);
for (Polyline polyline : polylineList) {
LineString lineString = toLineString(polyline);
compoundCurve.addLineString(lineString); // depends on control dependency: [for], data = [none]
}
return compoundCurve;
} }
|
public class class_name {
public static OIndexCursor wrap(OIndex<?> source, OIndexCursor cursor, long indexRebuildVersion) {
if (cursor instanceof OIndexChangesWrapper)
return cursor;
if (cursor instanceof OSizeable) {
return new OIndexChangesSizeable(source, cursor, indexRebuildVersion);
}
return new OIndexChangesWrapper(source, cursor, indexRebuildVersion);
} }
|
public class class_name {
public static OIndexCursor wrap(OIndex<?> source, OIndexCursor cursor, long indexRebuildVersion) {
if (cursor instanceof OIndexChangesWrapper)
return cursor;
if (cursor instanceof OSizeable) {
return new OIndexChangesSizeable(source, cursor, indexRebuildVersion); // depends on control dependency: [if], data = [none]
}
return new OIndexChangesWrapper(source, cursor, indexRebuildVersion);
} }
|
public class class_name {
@Override
public EClass getIfcContext() {
if (ifcContextEClass == null) {
ifcContextEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(136);
}
return ifcContextEClass;
} }
|
public class class_name {
@Override
public EClass getIfcContext() {
if (ifcContextEClass == null) {
ifcContextEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(136);
// depends on control dependency: [if], data = [none]
}
return ifcContextEClass;
} }
|
public class class_name {
private void fixConnectiveConstraints(IPattern p) {
if (p instanceof FactPattern) {
fixConnectiveConstraints((FactPattern) p);
} else if (p instanceof CompositeFactPattern) {
fixConnectiveConstraints((CompositeFactPattern) p);
}
} }
|
public class class_name {
private void fixConnectiveConstraints(IPattern p) {
if (p instanceof FactPattern) {
fixConnectiveConstraints((FactPattern) p); // depends on control dependency: [if], data = [none]
} else if (p instanceof CompositeFactPattern) {
fixConnectiveConstraints((CompositeFactPattern) p); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String[] parse(@NonNull String[] args) {
List<String> filtered = new ArrayList<>();
List<String> cleanedArgs = new ArrayList<>();
//Pass through the args once to do a clean up will make the next round easier to parser.
for (String c : args) {
if (c.endsWith(KEY_VALUE_SEPARATOR) && isOptionName(c)) {
//If it is ends with a key/value separator and is an option
//lets separate them into two tokens.
cleanedArgs.add(c.substring(0, c.length() - 1));
cleanedArgs.add(KEY_VALUE_SEPARATOR);
} else if (c.contains(KEY_VALUE_SEPARATOR) && isOptionName(c)) {
//If it contains a key/value separator, but doesn't end in one and is an option
//then we have a key value pair that will split into three tokens [key, =, value]
int index = c.lastIndexOf(KEY_VALUE_SEPARATOR);
cleanedArgs.add(c.substring(0, index));
cleanedArgs.add(KEY_VALUE_SEPARATOR);
cleanedArgs.add(c.substring(index + KEY_VALUE_SEPARATOR.length()));
} else if (StringUtils.isNotNullOrBlank(c)) {
//Anything else that isn't null or blank we keep as is
cleanedArgs.add(c);
}
}
for (int i = 0; i < cleanedArgs.size(); i++) {
String current = cleanedArgs.get(i);
//Check that the token isn't just a long or short argument marker.
if (LONG.equals(current) || SHORT.equals(current)) {
throw new CommandLineParserException(current, null);
}
if (current.startsWith(LONG)) {
//We have a long form argument.
String value = "true";
String next = peek(cleanedArgs, i + 1);
if (next.equalsIgnoreCase(KEY_VALUE_SEPARATOR)) {
//If are peeked at value is our key value separator then lets set the value to what comes after.
value = peek(cleanedArgs, i + 2);
if (isOptionName(value)) {
//If the value is an option name, we have an error
throw new CommandLineParserException(current, null);
}
i += 2;
} else if (!isOptionName(next)) {
//If are peeked at value isn't our key value separator and isn't another option name, lets set the value to what comes after.
i++;
value = next;
}
setValue(current, value, filtered);
} else if (current.startsWith(SHORT)) {
//We have a short form argument.
//Are we setting multiple "boolean" values?
if (current.length() > 2) {
//All of these will be set to true
char[] opts = current.substring(1).toCharArray();
for (char c : opts) {
setValue("-" + c, "true", filtered);
}
} else {
String value = "true";
String next = peek(cleanedArgs, i + 1);
if (next.equalsIgnoreCase(KEY_VALUE_SEPARATOR)) {
//If are peeked at value is our key value separator then lets set the value to what comes after.
value = peek(cleanedArgs, i + 2);
if (isOptionName(value)) {
//If the value is an option name, we have an error
throw new CommandLineParserException(current, null);
}
i += 2;
} else if (!isOptionName(next)) {
//If are peeked at value isn't our key value separator and isn't another option name, lets set the value to what comes after.
i++;
value = next;
}
setValue(current, value, filtered);
}
} else {
filtered.add(current);
}
}
//Check if the help was set, if a required argument was not set, and try to set the associated field on the owner object if one is set.
optionSet.forEach(Unchecked.consumer(option -> {
if (option.getName().equals("h") && Cast.<Boolean>as(option.getValue())) {
showHelp();
System.exit(0);
} else if (option.isRequired() && !isSet(option.getName())) {
System.err.println("ERROR: " + option.getName() + " is required, but was not set.");
showHelp();
System.exit(-1);
}
if (owner != null && option.getField() != null) {
Reflect.onObject(owner).allowPrivilegedAccess().set(option.getField().getName(), option.getValue());
}
}));
return filtered.toArray(new String[filtered.size()]);
} }
|
public class class_name {
public String[] parse(@NonNull String[] args) {
List<String> filtered = new ArrayList<>();
List<String> cleanedArgs = new ArrayList<>();
//Pass through the args once to do a clean up will make the next round easier to parser.
for (String c : args) {
if (c.endsWith(KEY_VALUE_SEPARATOR) && isOptionName(c)) {
//If it is ends with a key/value separator and is an option
//lets separate them into two tokens.
cleanedArgs.add(c.substring(0, c.length() - 1)); // depends on control dependency: [if], data = [none]
cleanedArgs.add(KEY_VALUE_SEPARATOR); // depends on control dependency: [if], data = [none]
} else if (c.contains(KEY_VALUE_SEPARATOR) && isOptionName(c)) {
//If it contains a key/value separator, but doesn't end in one and is an option
//then we have a key value pair that will split into three tokens [key, =, value]
int index = c.lastIndexOf(KEY_VALUE_SEPARATOR);
cleanedArgs.add(c.substring(0, index)); // depends on control dependency: [if], data = [none]
cleanedArgs.add(KEY_VALUE_SEPARATOR); // depends on control dependency: [if], data = [none]
cleanedArgs.add(c.substring(index + KEY_VALUE_SEPARATOR.length())); // depends on control dependency: [if], data = [none]
} else if (StringUtils.isNotNullOrBlank(c)) {
//Anything else that isn't null or blank we keep as is
cleanedArgs.add(c); // depends on control dependency: [if], data = [none]
}
}
for (int i = 0; i < cleanedArgs.size(); i++) {
String current = cleanedArgs.get(i);
//Check that the token isn't just a long or short argument marker.
if (LONG.equals(current) || SHORT.equals(current)) {
throw new CommandLineParserException(current, null);
}
if (current.startsWith(LONG)) {
//We have a long form argument.
String value = "true";
String next = peek(cleanedArgs, i + 1);
if (next.equalsIgnoreCase(KEY_VALUE_SEPARATOR)) {
//If are peeked at value is our key value separator then lets set the value to what comes after.
value = peek(cleanedArgs, i + 2); // depends on control dependency: [if], data = [none]
if (isOptionName(value)) {
//If the value is an option name, we have an error
throw new CommandLineParserException(current, null);
}
i += 2; // depends on control dependency: [if], data = [none]
} else if (!isOptionName(next)) {
//If are peeked at value isn't our key value separator and isn't another option name, lets set the value to what comes after.
i++; // depends on control dependency: [if], data = [none]
value = next; // depends on control dependency: [if], data = [none]
}
setValue(current, value, filtered); // depends on control dependency: [if], data = [none]
} else if (current.startsWith(SHORT)) {
//We have a short form argument.
//Are we setting multiple "boolean" values?
if (current.length() > 2) {
//All of these will be set to true
char[] opts = current.substring(1).toCharArray();
for (char c : opts) {
setValue("-" + c, "true", filtered); // depends on control dependency: [for], data = [c]
}
} else {
String value = "true";
String next = peek(cleanedArgs, i + 1);
if (next.equalsIgnoreCase(KEY_VALUE_SEPARATOR)) {
//If are peeked at value is our key value separator then lets set the value to what comes after.
value = peek(cleanedArgs, i + 2); // depends on control dependency: [if], data = [none]
if (isOptionName(value)) {
//If the value is an option name, we have an error
throw new CommandLineParserException(current, null);
}
i += 2; // depends on control dependency: [if], data = [none]
} else if (!isOptionName(next)) {
//If are peeked at value isn't our key value separator and isn't another option name, lets set the value to what comes after.
i++; // depends on control dependency: [if], data = [none]
value = next; // depends on control dependency: [if], data = [none]
}
setValue(current, value, filtered); // depends on control dependency: [if], data = [none]
}
} else {
filtered.add(current); // depends on control dependency: [if], data = [none]
}
}
//Check if the help was set, if a required argument was not set, and try to set the associated field on the owner object if one is set.
optionSet.forEach(Unchecked.consumer(option -> {
if (option.getName().equals("h") && Cast.<Boolean>as(option.getValue())) {
showHelp();
System.exit(0);
} else if (option.isRequired() && !isSet(option.getName())) {
System.err.println("ERROR: " + option.getName() + " is required, but was not set.");
showHelp();
System.exit(-1);
}
if (owner != null && option.getField() != null) {
Reflect.onObject(owner).allowPrivilegedAccess().set(option.getField().getName(), option.getValue());
}
}));
return filtered.toArray(new String[filtered.size()]);
} }
|
public class class_name {
public static void deleteRole(DbConn cnx, int id, boolean force)
{
if (force)
{
cnx.runUpdate("user_remove_role", id);
}
else
{
int userUsingRole = cnx.runSelectSingle("user_select_count_using_role", Integer.class, id);
if (userUsingRole > 0)
{
cnx.setRollbackOnly();
throw new JqmAdminApiUserException(
"cannot delete a role currently attributed to a user. Remove role attribution of use force parameter.");
}
}
QueryResult qr = cnx.runUpdate("role_delete_by_id", id);
if (qr.nbUpdated != 1)
{
cnx.setRollbackOnly();
throw new JqmAdminApiUserException("no item with ID " + id);
}
} }
|
public class class_name {
public static void deleteRole(DbConn cnx, int id, boolean force)
{
if (force)
{
cnx.runUpdate("user_remove_role", id); // depends on control dependency: [if], data = [none]
}
else
{
int userUsingRole = cnx.runSelectSingle("user_select_count_using_role", Integer.class, id);
if (userUsingRole > 0)
{
cnx.setRollbackOnly(); // depends on control dependency: [if], data = [none]
throw new JqmAdminApiUserException(
"cannot delete a role currently attributed to a user. Remove role attribution of use force parameter.");
}
}
QueryResult qr = cnx.runUpdate("role_delete_by_id", id);
if (qr.nbUpdated != 1)
{
cnx.setRollbackOnly(); // depends on control dependency: [if], data = [none]
throw new JqmAdminApiUserException("no item with ID " + id);
}
} }
|
public class class_name {
public int read(byte[] b, int off, int len) throws IOException {
ensureOpen();
if (off < 0 || len < 0 || off > b.length - len) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
if (entry == null) {
return -1;
}
switch (entry.method) {
case DEFLATED:
len = super.read(b, off, len);
if (len == -1) {
readEnd(entry);
entryEOF = true;
entry = null;
} else {
crc.update(b, off, len);
// ----- BEGIN android -----
remaining -= len;
// ----- END android -----
}
return len;
case STORED:
if (remaining <= 0) {
entryEOF = true;
entry = null;
return -1;
}
if (len > remaining) {
len = (int)remaining;
}
len = in.read(b, off, len);
if (len == -1) {
throw new ZipException("unexpected EOF");
}
crc.update(b, off, len);
remaining -= len;
if (remaining == 0 && entry.crc != crc.getValue()) {
throw new ZipException(
"invalid entry CRC (expected 0x" + Long.toHexString(entry.crc) +
" but got 0x" + Long.toHexString(crc.getValue()) + ")");
}
return len;
default:
throw new ZipException("invalid compression method");
}
} }
|
public class class_name {
public int read(byte[] b, int off, int len) throws IOException {
ensureOpen();
if (off < 0 || len < 0 || off > b.length - len) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
if (entry == null) {
return -1;
}
switch (entry.method) {
case DEFLATED:
len = super.read(b, off, len);
if (len == -1) {
readEnd(entry); // depends on control dependency: [if], data = [none]
entryEOF = true; // depends on control dependency: [if], data = [none]
entry = null; // depends on control dependency: [if], data = [none]
} else {
crc.update(b, off, len); // depends on control dependency: [if], data = [none]
// ----- BEGIN android -----
remaining -= len; // depends on control dependency: [if], data = [none]
// ----- END android -----
}
return len;
case STORED:
if (remaining <= 0) {
entryEOF = true; // depends on control dependency: [if], data = [none]
entry = null; // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
if (len > remaining) {
len = (int)remaining; // depends on control dependency: [if], data = [none]
}
len = in.read(b, off, len);
if (len == -1) {
throw new ZipException("unexpected EOF");
}
crc.update(b, off, len);
remaining -= len;
if (remaining == 0 && entry.crc != crc.getValue()) {
throw new ZipException(
"invalid entry CRC (expected 0x" + Long.toHexString(entry.crc) +
" but got 0x" + Long.toHexString(crc.getValue()) + ")");
}
return len;
default:
throw new ZipException("invalid compression method");
}
} }
|
public class class_name {
protected void initEditorChangeHandlers(Element element) {
Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(element, APPINFO_EDITOR_CHANGE_HANDLER);
while (i.hasNext()) {
// iterate all "default" elements in the "defaults" node
Element handlerElement = i.next();
String handlerClass = handlerElement.attributeValue(APPINFO_ATTR_CLASS);
String configuration = handlerElement.attributeValue(APPINFO_ATTR_CONFIGURATION);
String scope = handlerElement.attributeValue(APPINFO_ATTR_SCOPE);
try {
I_CmsXmlContentEditorChangeHandler handler = (I_CmsXmlContentEditorChangeHandler)Class.forName(
handlerClass).newInstance();
handler.setConfiguration(configuration);
handler.setScope(scope);
m_editorChangeHandlers.add(handler);
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
} }
|
public class class_name {
protected void initEditorChangeHandlers(Element element) {
Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(element, APPINFO_EDITOR_CHANGE_HANDLER);
while (i.hasNext()) {
// iterate all "default" elements in the "defaults" node
Element handlerElement = i.next();
String handlerClass = handlerElement.attributeValue(APPINFO_ATTR_CLASS);
String configuration = handlerElement.attributeValue(APPINFO_ATTR_CONFIGURATION);
String scope = handlerElement.attributeValue(APPINFO_ATTR_SCOPE);
try {
I_CmsXmlContentEditorChangeHandler handler = (I_CmsXmlContentEditorChangeHandler)Class.forName(
handlerClass).newInstance();
handler.setConfiguration(configuration); // depends on control dependency: [try], data = [none]
handler.setScope(scope); // depends on control dependency: [try], data = [none]
m_editorChangeHandlers.add(handler); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static String getCustomID(String id) {
int[] fields = new int[4];
if (parseCustomID(id, fields)) {
return formatCustomID(fields[1], fields[2], fields[3], fields[0] < 0);
}
return null;
} }
|
public class class_name {
public static String getCustomID(String id) {
int[] fields = new int[4];
if (parseCustomID(id, fields)) {
return formatCustomID(fields[1], fields[2], fields[3], fields[0] < 0); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
protected boolean findFosterNodes(final Node node) {
boolean isTable = false;
if (!lastTables.isEmpty()) {
// if inside table
if (node.getNodeType() == Node.NodeType.TEXT) {
String value = node.getNodeValue();
if (!StringUtil.isBlank(value)) {
if (isParentNodeOneOfFosterTableElements(node.getParentNode())) {
fosterTexts.add((Text) node);
}
}
}
}
if (node.getNodeType() == Node.NodeType.ELEMENT) {
Element element = (Element) node;
isTable = isTableElement(node);
if (isTable) {
// if node is a table, add it to the stack-of-last-tables
lastTables.add(element);
} else {
// otherwise...
// ...if inside the table
if (!lastTables.isEmpty()) {
// check this and parent
Node parentNode = node.getParentNode();
if (
isParentNodeOneOfFosterTableElements(parentNode) &&
!isOneOfTableElements(element)
) {
String elementNodeName = element.getNodeName().toLowerCase();
if (elementNodeName.equals("form")) {
if (element.getChildNodesCount() > 0) {
// if form element, take all its child nodes
// and add after the from element
Node[] formChildNodes = element.getChildNodes();
parentNode.insertAfter(formChildNodes, element);
return false;
} else {
// empty form element, leave it where it is
return true;
}
}
if (elementNodeName.equals("input")) {
String inputType = element.getAttribute("type");
if (inputType.equals("hidden")) {
// input hidden elements remains as they are
return true;
}
}
// foster element found, remember it to process it later
fosterElements.add(element);
}
} else {
// ...if not inside the table, just keep going
}
}
}
allchilds:
while (true) {
int childs = node.getChildNodesCount();
for (int i = 0; i < childs; i++) {
Node childNode = node.getChild(i);
boolean done = findFosterNodes(childNode);
if (!done) {
continue allchilds;
}
}
break;
}
if (isTable) {
// remove last element
int size = lastTables.size();
if (size > 0) {
lastTables.remove(size - 1); // no array copy occurs when the last element is removed
}
}
return true;
} }
|
public class class_name {
protected boolean findFosterNodes(final Node node) {
boolean isTable = false;
if (!lastTables.isEmpty()) {
// if inside table
if (node.getNodeType() == Node.NodeType.TEXT) {
String value = node.getNodeValue();
if (!StringUtil.isBlank(value)) {
if (isParentNodeOneOfFosterTableElements(node.getParentNode())) {
fosterTexts.add((Text) node); // depends on control dependency: [if], data = [none]
}
}
}
}
if (node.getNodeType() == Node.NodeType.ELEMENT) {
Element element = (Element) node;
isTable = isTableElement(node); // depends on control dependency: [if], data = [none]
if (isTable) {
// if node is a table, add it to the stack-of-last-tables
lastTables.add(element); // depends on control dependency: [if], data = [none]
} else {
// otherwise...
// ...if inside the table
if (!lastTables.isEmpty()) {
// check this and parent
Node parentNode = node.getParentNode();
if (
isParentNodeOneOfFosterTableElements(parentNode) &&
!isOneOfTableElements(element)
) {
String elementNodeName = element.getNodeName().toLowerCase();
if (elementNodeName.equals("form")) {
if (element.getChildNodesCount() > 0) {
// if form element, take all its child nodes
// and add after the from element
Node[] formChildNodes = element.getChildNodes();
parentNode.insertAfter(formChildNodes, element); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else {
// empty form element, leave it where it is
return true; // depends on control dependency: [if], data = [none]
}
}
if (elementNodeName.equals("input")) {
String inputType = element.getAttribute("type");
if (inputType.equals("hidden")) {
// input hidden elements remains as they are
return true; // depends on control dependency: [if], data = [none]
}
}
// foster element found, remember it to process it later
fosterElements.add(element); // depends on control dependency: [if], data = []
}
} else {
// ...if not inside the table, just keep going
}
}
}
allchilds:
while (true) {
int childs = node.getChildNodesCount();
for (int i = 0; i < childs; i++) {
Node childNode = node.getChild(i);
boolean done = findFosterNodes(childNode);
if (!done) {
continue allchilds;
}
}
break;
}
if (isTable) {
// remove last element
int size = lastTables.size();
if (size > 0) {
lastTables.remove(size - 1); // no array copy occurs when the last element is removed // depends on control dependency: [if], data = [(size]
}
}
return true;
} }
|
public class class_name {
public void attachNettyPromise(Promise<T> promise) {
promise.addListener(promiseHandler);
Promise<T> oldPromise = this.promise;
this.promise = promise;
if (oldPromise != null) {
oldPromise.removeListener(promiseHandler);
oldPromise.cancel(true);
}
} }
|
public class class_name {
public void attachNettyPromise(Promise<T> promise) {
promise.addListener(promiseHandler);
Promise<T> oldPromise = this.promise;
this.promise = promise;
if (oldPromise != null) {
oldPromise.removeListener(promiseHandler); // depends on control dependency: [if], data = [none]
oldPromise.cancel(true); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings("deprecation")
public VoltTable[] run(SystemProcedureExecutionContext ctx,
String username,
String remoteHost,
String xmlConfig)
{
long oldLevels = 0;
if (ctx.isLowestSiteId()) {
// Logger level is a global property, pick the site with lowest id to do it.
hostLog.info(String.format("%s from %s changed the log4j settings", username, remoteHost));
hostLog.info(xmlConfig);
oldLevels = hostLog.getLogLevels(loggers);
}
try {
// Mimic the multi-fragment semantics as scatter-gather pattern is an overkill for this simple task.
// There are chances that some sites being interrupted and update the logging before old logger level
// being read, but the reasons we don't care because 1) it is rare and 2) it only effects when HOST
// logger being changed from higher than INFO level to INFO or lower level.
barrier.await();
} catch (InterruptedException | BrokenBarrierException dontcare) { }
VoltDB.instance().logUpdate(xmlConfig, DeprecatedProcedureAPIAccess.getVoltPrivateRealTransactionId(this),
ctx.getPaths().getVoltDBRoot());
ctx.updateBackendLogLevels();
if (ctx.isLowestSiteId()) {
long newLevels = hostLog.getLogLevels(loggers);
if (newLevels != oldLevels) {
// If HOST logger wasn't able to log before and now it can, logs the setting change event.
int index = (int)((oldLevels >> 3) & 7);
Level before = Level.values()[index];
index = (int)((newLevels >> 3) & 7);
Level after = Level.values()[index];
if (before.ordinal() > Level.INFO.ordinal() && after.ordinal() <= Level.INFO.ordinal()) {
hostLog.info(String.format("%s from %s changed the log4j settings", username, remoteHost));
hostLog.info(xmlConfig);
}
}
barrier.reset();
}
VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA);
t.addRow(VoltSystemProcedure.STATUS_OK);
return (new VoltTable[] {t});
} }
|
public class class_name {
@SuppressWarnings("deprecation")
public VoltTable[] run(SystemProcedureExecutionContext ctx,
String username,
String remoteHost,
String xmlConfig)
{
long oldLevels = 0;
if (ctx.isLowestSiteId()) {
// Logger level is a global property, pick the site with lowest id to do it.
hostLog.info(String.format("%s from %s changed the log4j settings", username, remoteHost)); // depends on control dependency: [if], data = [none]
hostLog.info(xmlConfig); // depends on control dependency: [if], data = [none]
oldLevels = hostLog.getLogLevels(loggers); // depends on control dependency: [if], data = [none]
}
try {
// Mimic the multi-fragment semantics as scatter-gather pattern is an overkill for this simple task.
// There are chances that some sites being interrupted and update the logging before old logger level
// being read, but the reasons we don't care because 1) it is rare and 2) it only effects when HOST
// logger being changed from higher than INFO level to INFO or lower level.
barrier.await(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException | BrokenBarrierException dontcare) { } // depends on control dependency: [catch], data = [none]
VoltDB.instance().logUpdate(xmlConfig, DeprecatedProcedureAPIAccess.getVoltPrivateRealTransactionId(this),
ctx.getPaths().getVoltDBRoot());
ctx.updateBackendLogLevels();
if (ctx.isLowestSiteId()) {
long newLevels = hostLog.getLogLevels(loggers);
if (newLevels != oldLevels) {
// If HOST logger wasn't able to log before and now it can, logs the setting change event.
int index = (int)((oldLevels >> 3) & 7);
Level before = Level.values()[index];
index = (int)((newLevels >> 3) & 7); // depends on control dependency: [if], data = [(newLevels]
Level after = Level.values()[index];
if (before.ordinal() > Level.INFO.ordinal() && after.ordinal() <= Level.INFO.ordinal()) {
hostLog.info(String.format("%s from %s changed the log4j settings", username, remoteHost)); // depends on control dependency: [if], data = [none]
hostLog.info(xmlConfig); // depends on control dependency: [if], data = [none]
}
}
barrier.reset(); // depends on control dependency: [if], data = [none]
}
VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA);
t.addRow(VoltSystemProcedure.STATUS_OK);
return (new VoltTable[] {t});
} }
|
public class class_name {
public static void extract(final JarFile aJarFile, final String aFilePath, final File aDestDir)
throws IOException {
final Enumeration<JarEntry> entries = aJarFile.entries();
try {
while (entries.hasMoreElements()) {
final JarEntry entry = entries.nextElement();
final String entryName = entry.getName();
final File file = new File(aDestDir + File.separator + entryName);
if (entryName.equals(aFilePath)) {
final File parent = file.getParentFile();
if (!parent.exists() && !parent.mkdirs()) {
throw new IOException(LOGGER.getI18n(MessageCodes.UTIL_038, file));
}
final InputStream inputStream = aJarFile.getInputStream(entry);
final FileOutputStream outputStream = new FileOutputStream(file);
IOUtils.copyStream(inputStream, outputStream);
IOUtils.closeQuietly(inputStream);
IOUtils.closeQuietly(outputStream);
}
}
} finally {
aJarFile.close();
}
} }
|
public class class_name {
public static void extract(final JarFile aJarFile, final String aFilePath, final File aDestDir)
throws IOException {
final Enumeration<JarEntry> entries = aJarFile.entries();
try {
while (entries.hasMoreElements()) {
final JarEntry entry = entries.nextElement();
final String entryName = entry.getName();
final File file = new File(aDestDir + File.separator + entryName);
if (entryName.equals(aFilePath)) {
final File parent = file.getParentFile();
if (!parent.exists() && !parent.mkdirs()) {
throw new IOException(LOGGER.getI18n(MessageCodes.UTIL_038, file));
}
final InputStream inputStream = aJarFile.getInputStream(entry);
final FileOutputStream outputStream = new FileOutputStream(file);
IOUtils.copyStream(inputStream, outputStream); // depends on control dependency: [if], data = [none]
IOUtils.closeQuietly(inputStream); // depends on control dependency: [if], data = [none]
IOUtils.closeQuietly(outputStream); // depends on control dependency: [if], data = [none]
}
}
} finally {
aJarFile.close();
}
} }
|
public class class_name {
protected MutableCachedNode initializeVersionStorage( NodeKey versionableNodeKey,
NodeKey versionHistoryKey,
NodeKey versionKey,
Name primaryTypeName,
Set<Name> mixinTypeNames,
Path versionHistoryPath,
NodeKey originalVersionKey,
DateTime now ) {
assert versionHistoryPath != null;
assert versionHistoryPath.size() == 6;
CachedNode node = versionStorageNode();
MutableCachedNode mutable = null;
// Find the parent of the version history node by walking the path and creating any missing intermediate folders ...
Path parentPathInStorage = versionHistoryPath.getParent().subpath(2);
Property primaryType = null;
for (Segment segment : parentPathInStorage) {
ChildReferences childRefs = node.getChildReferences(system);
ChildReference ref = childRefs.getChild(segment);
if (ref != null) {
// Look up the child node ...
node = system.getNode(ref);
} else {
// Create the intermediate node ...
MutableCachedNode mutableNode = system.mutable(node.getKey());
NodeKey key = systemKey().withRandomId();
if (primaryType == null) {
primaryType = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, ModeShapeLexicon.VERSION_HISTORY_FOLDER);
}
mutable = mutableNode.createChild(system, key, segment.getName(), primaryType);
node = mutable;
}
}
// See if the version history exists ...
MutableCachedNode historyParent = mutable != null ? mutable : system.mutable(node.getKey());
// Now create the version history node itself ...
List<Property> historyProps = new ArrayList<Property>();
historyProps.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSION_HISTORY));
historyProps.add(propertyFactory.create(JcrLexicon.VERSIONABLE_UUID, versionableNodeKey.getIdentifier()));
historyProps.add(propertyFactory.create(JcrLexicon.UUID, versionHistoryKey.getIdentifier()));
if (originalVersionKey != null) {
// the tck expects this to be a reference, so that getNode works on it
Reference copiedFrom = weakReferenceFactory.create(originalVersionKey, true);
historyProps.add(propertyFactory.create(JcrLexicon.COPIED_FROM, copiedFrom));
}
Name historyName = versionHistoryPath.getLastSegment().getName();
MutableCachedNode history = historyParent.createChild(system, versionHistoryKey, historyName, historyProps);
// Now create the 'nt:versionLabels' child node ...
Property labelProp = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSION_LABELS);
MutableCachedNode labels = history.createChild(system, null, JcrLexicon.VERSION_LABELS, labelProp);
assert labels != null;
// And create the 'nt:rootVersion' child node ...
NodeKey rootVersionKey = versionKey != null ? versionKey : systemKey().withRandomId();
List<Property> rootProps = new ArrayList<Property>();
rootProps.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSION));
rootProps.add(propertyFactory.create(JcrLexicon.CREATED, now));
rootProps.add(propertyFactory.create(JcrLexicon.UUID, rootVersionKey.getIdentifier()));
MutableCachedNode rootVersion = history.createChild(system, rootVersionKey, JcrLexicon.ROOT_VERSION, rootProps);
// And create the 'nt:rootVersion/nt:frozenNode' child node ...
NodeKey frozenNodeKey = rootVersion.getKey().withRandomId();
List<Property> frozenProps = new ArrayList<Property>();
frozenProps.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FROZEN_NODE));
frozenProps.add(propertyFactory.create(JcrLexicon.FROZEN_UUID, versionableNodeKey.getIdentifier()));
frozenProps.add(propertyFactory.create(JcrLexicon.FROZEN_PRIMARY_TYPE, primaryTypeName));
frozenProps.add(propertyFactory.create(JcrLexicon.UUID, frozenNodeKey));
if (mixinTypeNames != null && !mixinTypeNames.isEmpty()) {
frozenProps.add(propertyFactory.create(JcrLexicon.FROZEN_MIXIN_TYPES, mixinTypeNames));
}
MutableCachedNode frozenNode = rootVersion.createChild(system, frozenNodeKey, JcrLexicon.FROZEN_NODE, frozenProps);
assert frozenNode != null;
return history;
} }
|
public class class_name {
protected MutableCachedNode initializeVersionStorage( NodeKey versionableNodeKey,
NodeKey versionHistoryKey,
NodeKey versionKey,
Name primaryTypeName,
Set<Name> mixinTypeNames,
Path versionHistoryPath,
NodeKey originalVersionKey,
DateTime now ) {
assert versionHistoryPath != null;
assert versionHistoryPath.size() == 6;
CachedNode node = versionStorageNode();
MutableCachedNode mutable = null;
// Find the parent of the version history node by walking the path and creating any missing intermediate folders ...
Path parentPathInStorage = versionHistoryPath.getParent().subpath(2);
Property primaryType = null;
for (Segment segment : parentPathInStorage) {
ChildReferences childRefs = node.getChildReferences(system);
ChildReference ref = childRefs.getChild(segment);
if (ref != null) {
// Look up the child node ...
node = system.getNode(ref); // depends on control dependency: [if], data = [(ref]
} else {
// Create the intermediate node ...
MutableCachedNode mutableNode = system.mutable(node.getKey());
NodeKey key = systemKey().withRandomId();
if (primaryType == null) {
primaryType = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, ModeShapeLexicon.VERSION_HISTORY_FOLDER); // depends on control dependency: [if], data = [none]
}
mutable = mutableNode.createChild(system, key, segment.getName(), primaryType); // depends on control dependency: [if], data = [none]
node = mutable; // depends on control dependency: [if], data = [none]
}
}
// See if the version history exists ...
MutableCachedNode historyParent = mutable != null ? mutable : system.mutable(node.getKey());
// Now create the version history node itself ...
List<Property> historyProps = new ArrayList<Property>();
historyProps.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSION_HISTORY));
historyProps.add(propertyFactory.create(JcrLexicon.VERSIONABLE_UUID, versionableNodeKey.getIdentifier()));
historyProps.add(propertyFactory.create(JcrLexicon.UUID, versionHistoryKey.getIdentifier()));
if (originalVersionKey != null) {
// the tck expects this to be a reference, so that getNode works on it
Reference copiedFrom = weakReferenceFactory.create(originalVersionKey, true);
historyProps.add(propertyFactory.create(JcrLexicon.COPIED_FROM, copiedFrom)); // depends on control dependency: [if], data = [none]
}
Name historyName = versionHistoryPath.getLastSegment().getName();
MutableCachedNode history = historyParent.createChild(system, versionHistoryKey, historyName, historyProps);
// Now create the 'nt:versionLabels' child node ...
Property labelProp = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSION_LABELS);
MutableCachedNode labels = history.createChild(system, null, JcrLexicon.VERSION_LABELS, labelProp);
assert labels != null;
// And create the 'nt:rootVersion' child node ...
NodeKey rootVersionKey = versionKey != null ? versionKey : systemKey().withRandomId();
List<Property> rootProps = new ArrayList<Property>();
rootProps.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSION));
rootProps.add(propertyFactory.create(JcrLexicon.CREATED, now));
rootProps.add(propertyFactory.create(JcrLexicon.UUID, rootVersionKey.getIdentifier()));
MutableCachedNode rootVersion = history.createChild(system, rootVersionKey, JcrLexicon.ROOT_VERSION, rootProps);
// And create the 'nt:rootVersion/nt:frozenNode' child node ...
NodeKey frozenNodeKey = rootVersion.getKey().withRandomId();
List<Property> frozenProps = new ArrayList<Property>();
frozenProps.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FROZEN_NODE));
frozenProps.add(propertyFactory.create(JcrLexicon.FROZEN_UUID, versionableNodeKey.getIdentifier()));
frozenProps.add(propertyFactory.create(JcrLexicon.FROZEN_PRIMARY_TYPE, primaryTypeName));
frozenProps.add(propertyFactory.create(JcrLexicon.UUID, frozenNodeKey));
if (mixinTypeNames != null && !mixinTypeNames.isEmpty()) {
frozenProps.add(propertyFactory.create(JcrLexicon.FROZEN_MIXIN_TYPES, mixinTypeNames)); // depends on control dependency: [if], data = [none]
}
MutableCachedNode frozenNode = rootVersion.createChild(system, frozenNodeKey, JcrLexicon.FROZEN_NODE, frozenProps);
assert frozenNode != null;
return history;
} }
|
public class class_name {
public static boolean objectExtends(Object object, String superClassName) {
AssertUtils.assertNotNull(object);
boolean result = false;
Class superClass = object.getClass().getSuperclass();
if (superClass.getName().equals(superClassName) == true) {
result = true;
}
return result;
} }
|
public class class_name {
public static boolean objectExtends(Object object, String superClassName) {
AssertUtils.assertNotNull(object);
boolean result = false;
Class superClass = object.getClass().getSuperclass();
if (superClass.getName().equals(superClassName) == true) {
result = true;
// depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
@Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException
{
checkClosed();
this.sysCatalog.setString(1, "TABLES");
JDBC4ResultSet res = (JDBC4ResultSet) this.sysCatalog.executeQuery();
VoltTable vtable = res.getVoltTable().clone(0);
List<String> typeStrings = null;
if (types != null) {
typeStrings = Arrays.asList(types);
}
// If no pattern is specified, default to matching any/all.
if (tableNamePattern == null || tableNamePattern.length() == 0)
{
tableNamePattern = "%";
}
Pattern table_pattern = computeJavaPattern(tableNamePattern);
// Filter tables based on type and pattern
while (res.next()) {
if (typeStrings == null || typeStrings.contains(res.getString("TABLE_TYPE"))) {
Matcher table_matcher = table_pattern.matcher(res.getString("TABLE_NAME"));
if (table_matcher.matches())
{
vtable.addRow(res.getRowData());
}
}
}
return new JDBC4ResultSet(this.sysCatalog, vtable);
} }
|
public class class_name {
@Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException
{
checkClosed();
this.sysCatalog.setString(1, "TABLES");
JDBC4ResultSet res = (JDBC4ResultSet) this.sysCatalog.executeQuery();
VoltTable vtable = res.getVoltTable().clone(0);
List<String> typeStrings = null;
if (types != null) {
typeStrings = Arrays.asList(types);
}
// If no pattern is specified, default to matching any/all.
if (tableNamePattern == null || tableNamePattern.length() == 0)
{
tableNamePattern = "%";
}
Pattern table_pattern = computeJavaPattern(tableNamePattern);
// Filter tables based on type and pattern
while (res.next()) {
if (typeStrings == null || typeStrings.contains(res.getString("TABLE_TYPE"))) {
Matcher table_matcher = table_pattern.matcher(res.getString("TABLE_NAME"));
if (table_matcher.matches())
{
vtable.addRow(res.getRowData()); // depends on control dependency: [if], data = [none]
}
}
}
return new JDBC4ResultSet(this.sysCatalog, vtable);
} }
|
public class class_name {
static void applyAndUpdateParmEditSet(Document plf, Document ilf, IntegrationResult result) {
Element pSet = null;
try {
pSet = getParmEditSet(plf, null, false);
} catch (Exception e) {
LOG.error("Exception occurred while getting user's DLM " + "paramter-edit-set.", e);
}
if (pSet == null) return;
NodeList edits = pSet.getChildNodes();
for (int i = edits.getLength() - 1; i >= 0; i--) {
if (applyEdit((Element) edits.item(i), ilf) == false) {
pSet.removeChild(edits.item(i));
result.setChangedPLF(true);
} else {
result.setChangedILF(true);
}
}
if (pSet.getChildNodes().getLength() == 0) {
plf.getDocumentElement().removeChild(pSet);
result.setChangedPLF(true);
}
} }
|
public class class_name {
static void applyAndUpdateParmEditSet(Document plf, Document ilf, IntegrationResult result) {
Element pSet = null;
try {
pSet = getParmEditSet(plf, null, false); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Exception occurred while getting user's DLM " + "paramter-edit-set.", e);
} // depends on control dependency: [catch], data = [none]
if (pSet == null) return;
NodeList edits = pSet.getChildNodes();
for (int i = edits.getLength() - 1; i >= 0; i--) {
if (applyEdit((Element) edits.item(i), ilf) == false) {
pSet.removeChild(edits.item(i)); // depends on control dependency: [if], data = [none]
result.setChangedPLF(true); // depends on control dependency: [if], data = [none]
} else {
result.setChangedILF(true); // depends on control dependency: [if], data = [none]
}
}
if (pSet.getChildNodes().getLength() == 0) {
plf.getDocumentElement().removeChild(pSet); // depends on control dependency: [if], data = [none]
result.setChangedPLF(true); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void passivate(StatefulBeanO beanO, BeanMetaData bmd) // d648122
throws RemoteException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) //130050
Tr.entry(tc, "passivate: " + beanO);
if (beanO.isRemoved() || isTerminating())
{
if (isTraceOn && tc.isEventEnabled()) //130050
Tr.event(tc, "Bean removed!");
return;
}
BeanId bid = beanO.getId();
Object sb = beanO.ivEjbInstance; // d367572.7
boolean exceptionCaught = false; //155114
ObjectOutputStream beanStream = null; //155114
// LI2775-107.2 Begins WS18354.02a,MD19305C
Object credToken = ivContainer.getEJBRuntime().pushServerIdentity();
// LI2775-107.2 Ends
ObjectOutputStream beanStream2 = null; // d430549.11
// Get the JPAExPcBindingContext for this SFSB.
Object exPC = beanO.getJPAExPcBindingContext(); //d468174
try
{
// LIDB2018-1 begins
// Check whether SFSB failover is enabled. Note, we could
// factor out this code so it is the same regardless of
// whether SFSB failover is enabled or not. However, to
// ensure no impact to existing performance when not enabled,
// we chose to not factor into a common implementation.
ByteArrayOutputStream baos = null;
long lastAccessTime = beanO.getLastAccessTime();
//PK69093 - Only allow one stream to be open for writing at one time.
synchronized (ivPassivateLock)
{
if (beanO.sfsbFailoverEnabled())
{
// For failover, initially write to a ByteArrayOutputStream. This will later be converted to
// bytes and then persisted
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "failover is enabled");
// If the EJB module is 3.0 or greater, use the new format, which is later
if (getEJBModuleVersion(beanO) >= BeanMetaData.J2EE_EJB_VERSION_3_0)
{
// Set up the bean stream to initially write to a ByteArrayOutputStream
baos = new ByteArrayOutputStream(1024);
beanStream = createPassivationOutputStream(new GZIPOutputStream(baos));
}
else
{
// pre-3.0 module - Use old format since we may be in a mixed cluster environment
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "processing EJB 2.1 module or prior");
// Serialize and compress the data in SFSB.
byte[] bytes = getCompressedBytes(sb, lastAccessTime, exPC);
// Get a file outstream that does not compress the data
// since we already have the data compressed.
OutputStream ostream = ivBeanStore.getOutputStream(bid);
beanStream = createPassivationOutputStream(ostream);
// Write length of compressed data.
beanStream.writeInt(bytes.length);
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "length of compressed bytes is: " + bytes.length);
// Write compressed data to file.
beanStream.write(bytes);
beanStream.close();
// Replicate compressed data to failover servers by calling
// the method that updates the failover cache entry for this SFSB.
beanO.updateFailoverEntry(bytes, lastAccessTime);
return;
}
}
else // failover not enabled - setup the beanStream
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "failover is NOT enabled");
beanStream = createPassivationOutputStream(ivBeanStore.getGZIPOutputStream(bid));
}
// Passivate sb in the 3.0 format
EJBObjectInfo objectInfo = null;
Map<String, Map<String, Field>> passivatorFields = getPassivatorFields(bmd); // d648122
if (sb instanceof Serializable)
{
objectInfo = createSerializableObjectInfo(sb);
}
else
{
objectInfo = createNonSerializableObjectInfo(sb, passivatorFields); // d648122
}
// Write last access time.
beanStream.writeLong(lastAccessTime);
// Write the persistence context
beanStream.writeObject(exPC);
// Write the SFSB state.
beanStream.writeObject(objectInfo);
// Write the managed object state of the EJB instance
writeManagedObjectContext(beanStream, beanO.ivEjbManagedObjectContext);
Object[] interceptors = beanO.ivInterceptors;
if (interceptors == null)
{
beanStream.writeInt(-1);
}
else
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Processing " + interceptors.length + " interceptors");
beanStream.writeInt(interceptors.length);
for (int i = 0; i < interceptors.length; i++)
{
Object interceptor = interceptors[i];
EJBObjectInfo interceptorObjectInfo = null;
if (interceptor instanceof Serializable)
{
interceptorObjectInfo = createSerializableObjectInfo(interceptor);
}
else
{
interceptorObjectInfo = createNonSerializableObjectInfo(interceptor, passivatorFields); // d648122
}
beanStream.writeObject(interceptorObjectInfo);
}
}
beanStream.close();
// If failover is enabled, now convert to a byte array and persist it
if (beanO.sfsbFailoverEnabled() && baos != null) //d468174
{
byte[] bytes = baos.toByteArray();
beanStream2 = createPassivationOutputStream(ivBeanStore.getOutputStream(bid));
beanStream2.writeInt(bytes.length);
beanStream2.write(bytes);
beanStream2.close();
// Replicate compressed data to failover cache servers by calling
// the method that updates the failover cache entry for this SFSB.
beanO.updateFailoverEntry(bytes, lastAccessTime);
}
// LIDB2018-1 ends
}
} catch (CSIException ex)
{
exceptionCaught = true; //155114
FFDCFilter.processException(ex, CLASS_NAME + ".passivate", "113", this);
throw new RemoteException("passivation failed", ex);
} catch (Throwable e) //155114
{
// d584932 - Catch Throwable, not Exception, to ensure that we
// set exceptionCaught when Errors are thrown.
exceptionCaught = true; //155114
FFDCFilter.processException(e, CLASS_NAME + ".passivate", "107", this);
Tr.warning(tc, "CANNOT_PASSIVATE_STATEFUL_BEAN_CNTR0001W",
new Object[] { beanO.toString(), this, e }); //p111002.3
throw new RemoteException("passivation failed", e);
} finally //155114
{
// LI2775-107.2 Begins WS18354.02a,MD19305C
if (credToken != null) // d646413.2
{
ivContainer.getEJBRuntime().popServerIdentity(credToken);
}
// LI2775-107.2 Ends
if (exceptionCaught) // 155114
{
// attempt to close and remove the beanStore
try
{
if (beanStream != null)
{
beanStream.close();
// PK69093 - beanStore.remove will access a file, as such lets synch this call
// such that only one file can be open for remove at a time.
synchronized (ivRemoveLock)
{
ivBeanStore.remove(bid);
}
}
if (beanStream2 != null) // d430549.11
{
beanStream2.close();
}
} catch (Exception ex)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "exception closing stream", ex);
}
}
}
if (isTraceOn && tc.isEntryEnabled()) //130050
Tr.exit(tc, "passivate");
} }
|
public class class_name {
public void passivate(StatefulBeanO beanO, BeanMetaData bmd) // d648122
throws RemoteException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) //130050
Tr.entry(tc, "passivate: " + beanO);
if (beanO.isRemoved() || isTerminating())
{
if (isTraceOn && tc.isEventEnabled()) //130050
Tr.event(tc, "Bean removed!");
return;
}
BeanId bid = beanO.getId();
Object sb = beanO.ivEjbInstance; // d367572.7
boolean exceptionCaught = false; //155114
ObjectOutputStream beanStream = null; //155114
// LI2775-107.2 Begins WS18354.02a,MD19305C
Object credToken = ivContainer.getEJBRuntime().pushServerIdentity();
// LI2775-107.2 Ends
ObjectOutputStream beanStream2 = null; // d430549.11
// Get the JPAExPcBindingContext for this SFSB.
Object exPC = beanO.getJPAExPcBindingContext(); //d468174
try
{
// LIDB2018-1 begins
// Check whether SFSB failover is enabled. Note, we could
// factor out this code so it is the same regardless of
// whether SFSB failover is enabled or not. However, to
// ensure no impact to existing performance when not enabled,
// we chose to not factor into a common implementation.
ByteArrayOutputStream baos = null;
long lastAccessTime = beanO.getLastAccessTime();
//PK69093 - Only allow one stream to be open for writing at one time.
synchronized (ivPassivateLock)
{
if (beanO.sfsbFailoverEnabled())
{
// For failover, initially write to a ByteArrayOutputStream. This will later be converted to
// bytes and then persisted
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "failover is enabled");
// If the EJB module is 3.0 or greater, use the new format, which is later
if (getEJBModuleVersion(beanO) >= BeanMetaData.J2EE_EJB_VERSION_3_0)
{
// Set up the bean stream to initially write to a ByteArrayOutputStream
baos = new ByteArrayOutputStream(1024); // depends on control dependency: [if], data = [none]
beanStream = createPassivationOutputStream(new GZIPOutputStream(baos)); // depends on control dependency: [if], data = [none]
}
else
{
// pre-3.0 module - Use old format since we may be in a mixed cluster environment
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "processing EJB 2.1 module or prior");
// Serialize and compress the data in SFSB.
byte[] bytes = getCompressedBytes(sb, lastAccessTime, exPC);
// Get a file outstream that does not compress the data
// since we already have the data compressed.
OutputStream ostream = ivBeanStore.getOutputStream(bid);
beanStream = createPassivationOutputStream(ostream); // depends on control dependency: [if], data = [none]
// Write length of compressed data.
beanStream.writeInt(bytes.length); // depends on control dependency: [if], data = [none]
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "length of compressed bytes is: " + bytes.length);
// Write compressed data to file.
beanStream.write(bytes); // depends on control dependency: [if], data = [none]
beanStream.close(); // depends on control dependency: [if], data = [none]
// Replicate compressed data to failover servers by calling
// the method that updates the failover cache entry for this SFSB.
beanO.updateFailoverEntry(bytes, lastAccessTime); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
else // failover not enabled - setup the beanStream
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "failover is NOT enabled");
beanStream = createPassivationOutputStream(ivBeanStore.getGZIPOutputStream(bid)); // depends on control dependency: [if], data = [none]
}
// Passivate sb in the 3.0 format
EJBObjectInfo objectInfo = null;
Map<String, Map<String, Field>> passivatorFields = getPassivatorFields(bmd); // d648122
if (sb instanceof Serializable)
{
objectInfo = createSerializableObjectInfo(sb); // depends on control dependency: [if], data = [none]
}
else
{
objectInfo = createNonSerializableObjectInfo(sb, passivatorFields); // d648122 // depends on control dependency: [if], data = [none]
}
// Write last access time.
beanStream.writeLong(lastAccessTime);
// Write the persistence context
beanStream.writeObject(exPC);
// Write the SFSB state.
beanStream.writeObject(objectInfo);
// Write the managed object state of the EJB instance
writeManagedObjectContext(beanStream, beanO.ivEjbManagedObjectContext);
Object[] interceptors = beanO.ivInterceptors;
if (interceptors == null)
{
beanStream.writeInt(-1); // depends on control dependency: [if], data = [none]
}
else
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Processing " + interceptors.length + " interceptors");
beanStream.writeInt(interceptors.length); // depends on control dependency: [if], data = [(interceptors]
for (int i = 0; i < interceptors.length; i++)
{
Object interceptor = interceptors[i];
EJBObjectInfo interceptorObjectInfo = null;
if (interceptor instanceof Serializable)
{
interceptorObjectInfo = createSerializableObjectInfo(interceptor); // depends on control dependency: [if], data = [none]
}
else
{
interceptorObjectInfo = createNonSerializableObjectInfo(interceptor, passivatorFields); // d648122 // depends on control dependency: [if], data = [none]
}
beanStream.writeObject(interceptorObjectInfo); // depends on control dependency: [for], data = [none]
}
}
beanStream.close();
// If failover is enabled, now convert to a byte array and persist it
if (beanO.sfsbFailoverEnabled() && baos != null) //d468174
{
byte[] bytes = baos.toByteArray();
beanStream2 = createPassivationOutputStream(ivBeanStore.getOutputStream(bid)); // depends on control dependency: [if], data = [none]
beanStream2.writeInt(bytes.length); // depends on control dependency: [if], data = [none]
beanStream2.write(bytes); // depends on control dependency: [if], data = [none]
beanStream2.close(); // depends on control dependency: [if], data = [none]
// Replicate compressed data to failover cache servers by calling
// the method that updates the failover cache entry for this SFSB.
beanO.updateFailoverEntry(bytes, lastAccessTime); // depends on control dependency: [if], data = [none]
}
// LIDB2018-1 ends
}
} catch (CSIException ex)
{
exceptionCaught = true; //155114
FFDCFilter.processException(ex, CLASS_NAME + ".passivate", "113", this);
throw new RemoteException("passivation failed", ex);
} catch (Throwable e) //155114
{
// d584932 - Catch Throwable, not Exception, to ensure that we
// set exceptionCaught when Errors are thrown.
exceptionCaught = true; //155114
FFDCFilter.processException(e, CLASS_NAME + ".passivate", "107", this);
Tr.warning(tc, "CANNOT_PASSIVATE_STATEFUL_BEAN_CNTR0001W",
new Object[] { beanO.toString(), this, e }); //p111002.3
throw new RemoteException("passivation failed", e);
} finally //155114
{
// LI2775-107.2 Begins WS18354.02a,MD19305C
if (credToken != null) // d646413.2
{
ivContainer.getEJBRuntime().popServerIdentity(credToken); // depends on control dependency: [if], data = [(credToken]
}
// LI2775-107.2 Ends
if (exceptionCaught) // 155114
{
// attempt to close and remove the beanStore
try
{
if (beanStream != null)
{
beanStream.close(); // depends on control dependency: [if], data = [none]
// PK69093 - beanStore.remove will access a file, as such lets synch this call
// such that only one file can be open for remove at a time.
synchronized (ivRemoveLock) // depends on control dependency: [if], data = [none]
{
ivBeanStore.remove(bid);
}
}
if (beanStream2 != null) // d430549.11
{
beanStream2.close(); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "exception closing stream", ex);
} // depends on control dependency: [catch], data = [none]
}
}
if (isTraceOn && tc.isEntryEnabled()) //130050
Tr.exit(tc, "passivate");
} }
|
public class class_name {
void preProcessOperation(StreamSegmentAppendOperation operation) throws StreamSegmentSealedException, StreamSegmentMergedException,
BadOffsetException, BadAttributeUpdateException {
ensureSegmentId(operation);
if (this.merged) {
// We do not allow any operation after merging (since after merging the Segment disappears).
throw new StreamSegmentMergedException(this.name);
}
if (this.sealed) {
throw new StreamSegmentSealedException(this.name);
}
if (!this.recoveryMode) {
// Offset check (if append-with-offset).
long operationOffset = operation.getStreamSegmentOffset();
if (operationOffset >= 0) {
// If the Operation already has an offset assigned, verify that it matches the current end offset of the Segment.
if (operationOffset != this.length) {
throw new BadOffsetException(this.name, this.length, operationOffset);
}
} else {
// No pre-assigned offset. Put the Append at the end of the Segment.
operation.setStreamSegmentOffset(this.length);
}
// Attribute validation.
preProcessAttributes(operation.getAttributeUpdates());
}
} }
|
public class class_name {
void preProcessOperation(StreamSegmentAppendOperation operation) throws StreamSegmentSealedException, StreamSegmentMergedException,
BadOffsetException, BadAttributeUpdateException {
ensureSegmentId(operation);
if (this.merged) {
// We do not allow any operation after merging (since after merging the Segment disappears).
throw new StreamSegmentMergedException(this.name);
}
if (this.sealed) {
throw new StreamSegmentSealedException(this.name);
}
if (!this.recoveryMode) {
// Offset check (if append-with-offset).
long operationOffset = operation.getStreamSegmentOffset();
if (operationOffset >= 0) {
// If the Operation already has an offset assigned, verify that it matches the current end offset of the Segment.
if (operationOffset != this.length) {
throw new BadOffsetException(this.name, this.length, operationOffset);
}
} else {
// No pre-assigned offset. Put the Append at the end of the Segment.
operation.setStreamSegmentOffset(this.length); // depends on control dependency: [if], data = [none]
}
// Attribute validation.
preProcessAttributes(operation.getAttributeUpdates());
}
} }
|
public class class_name {
private void strengthen(final CLClause c, final int remove) {
if (c.dumped() || satisfied(c)) { return; }
assert this.addedlits.empty();
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit != remove && val(lit) == 0) { this.addedlits.push(lit); }
}
newPushConnectClause();
this.addedlits.clear();
dumpClause(c);
} }
|
public class class_name {
private void strengthen(final CLClause c, final int remove) {
if (c.dumped() || satisfied(c)) { return; } // depends on control dependency: [if], data = [none]
assert this.addedlits.empty();
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit != remove && val(lit) == 0) { this.addedlits.push(lit); } // depends on control dependency: [if], data = [none]
}
newPushConnectClause();
this.addedlits.clear();
dumpClause(c);
} }
|
public class class_name {
public void requestDone() {
currentRequest = null;
if (anyAreSet(state, CLOSE_REQ)) {
safeClose(connection);
} else if (anyAreSet(state, UPGRADE_REQUESTED)) {
safeClose(connection); //we don't support upgrade, just close the connection to be safe
return;
}
AjpClientExchange next = pendingQueue.poll();
if (next != null) {
initiateRequest(next);
}
} }
|
public class class_name {
public void requestDone() {
currentRequest = null;
if (anyAreSet(state, CLOSE_REQ)) {
safeClose(connection); // depends on control dependency: [if], data = [none]
} else if (anyAreSet(state, UPGRADE_REQUESTED)) {
safeClose(connection); //we don't support upgrade, just close the connection to be safe // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
AjpClientExchange next = pendingQueue.poll();
if (next != null) {
initiateRequest(next); // depends on control dependency: [if], data = [(next]
}
} }
|
public class class_name {
private OptionHandler findOptionByName(String name) {
for (OptionHandler h : options) {
NamedOptionDef option = (NamedOptionDef)h.option;
if (name.equals(option.name())) {
return h;
}
for (String alias : option.aliases()) {
if (name.equals(alias)) {
return h;
}
}
}
return null;
} }
|
public class class_name {
private OptionHandler findOptionByName(String name) {
for (OptionHandler h : options) {
NamedOptionDef option = (NamedOptionDef)h.option;
if (name.equals(option.name())) {
return h; // depends on control dependency: [if], data = [none]
}
for (String alias : option.aliases()) {
if (name.equals(alias)) {
return h; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
public List<InterceptorFactory> getComponentInterceptors(Method method) {
Map<Method, OrderedItemContainer<List<InterceptorFactory>>> map = componentInterceptors;
OrderedItemContainer<List<InterceptorFactory>> interceptors = map.get(method);
if (interceptors == null) {
return Collections.emptyList();
}
List<List<InterceptorFactory>> sortedItems = interceptors.getSortedItems();
List<InterceptorFactory> ret = new ArrayList<>();
for(List<InterceptorFactory> item : sortedItems) {
ret.addAll(item);
}
return ret;
} }
|
public class class_name {
public List<InterceptorFactory> getComponentInterceptors(Method method) {
Map<Method, OrderedItemContainer<List<InterceptorFactory>>> map = componentInterceptors;
OrderedItemContainer<List<InterceptorFactory>> interceptors = map.get(method);
if (interceptors == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
List<List<InterceptorFactory>> sortedItems = interceptors.getSortedItems();
List<InterceptorFactory> ret = new ArrayList<>();
for(List<InterceptorFactory> item : sortedItems) {
ret.addAll(item); // depends on control dependency: [for], data = [item]
}
return ret;
} }
|
public class class_name {
public Map<String, Object> queryObjJoinByBizId(String tableName,Object bizId,String condition) {
//String tableName=changeTableNameCase(otableName);
String where="where "+condition+"=?";
String limitStr="";
String tempType=calcuDbType();
if(tempType!=null && tempType.equals("mysql")){
//if(dbType!=null && dbType.equals("mysql")){
limitStr="limit 1";
}else{
limitStr="and rownum=1";
}
String select="select * from "+tableName+" "+where+" "+limitStr;
String sql=select+" ";
logger.debug(sql);
Object[] paramArray=new Object[1];
paramArray[0]=bizId;
List infoList=queryObjJoinByCondition(sql,paramArray);
//init by null
Map retMap0=null;
if(infoList!=null && infoList.size()>0){
retMap0=(Map) infoList.get(0);
}
//add 201807 ning
//Map retMap=changeOutKeyCase(retMap0);
//add 201902 ning
Map retMap=ignoreKeyCase(retMap0);
return retMap;
} }
|
public class class_name {
public Map<String, Object> queryObjJoinByBizId(String tableName,Object bizId,String condition) {
//String tableName=changeTableNameCase(otableName);
String where="where "+condition+"=?";
String limitStr="";
String tempType=calcuDbType();
if(tempType!=null && tempType.equals("mysql")){
//if(dbType!=null && dbType.equals("mysql")){
limitStr="limit 1";
// depends on control dependency: [if], data = [none]
}else{
limitStr="and rownum=1";
// depends on control dependency: [if], data = [none]
}
String select="select * from "+tableName+" "+where+" "+limitStr;
String sql=select+" ";
logger.debug(sql);
Object[] paramArray=new Object[1];
paramArray[0]=bizId;
List infoList=queryObjJoinByCondition(sql,paramArray);
//init by null
Map retMap0=null;
if(infoList!=null && infoList.size()>0){
retMap0=(Map) infoList.get(0);
// depends on control dependency: [if], data = [none]
}
//add 201807 ning
//Map retMap=changeOutKeyCase(retMap0);
//add 201902 ning
Map retMap=ignoreKeyCase(retMap0);
return retMap;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.