code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private static String newStringMethodHandle(char[] buf) {
if (STRING_CONSTRUCTOR_HANDLE != null) {
try {
return (String) STRING_CONSTRUCTOR_HANDLE.invokeExact(buf, true);
} catch (Throwable t) {
return new String(buf);
}
} else {
return new String(buf);
}
} }
|
public class class_name {
private static String newStringMethodHandle(char[] buf) {
if (STRING_CONSTRUCTOR_HANDLE != null) {
try {
return (String) STRING_CONSTRUCTOR_HANDLE.invokeExact(buf, true); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return new String(buf);
} // depends on control dependency: [catch], data = [none]
} else {
return new String(buf); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void dispose(final WebDriver source) {
if (configurationProvider.get().getBoolean(WebConstants.WEBDRIVER_DONT_QUIT)) {
return;
}
logger.info("Quitting WebDriver...");
source.quit();
} }
|
public class class_name {
@Override
public void dispose(final WebDriver source) {
if (configurationProvider.get().getBoolean(WebConstants.WEBDRIVER_DONT_QUIT)) {
return; // depends on control dependency: [if], data = [none]
}
logger.info("Quitting WebDriver...");
source.quit();
} }
|
public class class_name {
private boolean addSingle(T element, Class<?> accessibleClass) {
List<T> elements = this.elementsForClass.get(accessibleClass);
if (elements == null) {
elements = new ArrayList<T>();
this.elementsForClass.put(accessibleClass, elements);
}
if (!elements.contains(element)) {
elements.add(element);
return true;
}
return false;
} }
|
public class class_name {
private boolean addSingle(T element, Class<?> accessibleClass) {
List<T> elements = this.elementsForClass.get(accessibleClass);
if (elements == null) {
elements = new ArrayList<T>(); // depends on control dependency: [if], data = [none]
this.elementsForClass.put(accessibleClass, elements); // depends on control dependency: [if], data = [none]
}
if (!elements.contains(element)) {
elements.add(element); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
@Override
public ZkDisconfData getDisconfData(String app, String env, String version, DisConfigTypeEnum disConfigTypeEnum,
String keyName) {
String baseUrl = ZooPathMgr.getZooBaseUrl(zooConfig.getZookeeperUrlPrefix(), app, env, version);
try {
ZookeeperMgr zooKeeperMgr = ZookeeperMgr.getInstance();
ZooKeeper zooKeeper = zooKeeperMgr.getZk();
if (disConfigTypeEnum.equals(DisConfigTypeEnum.FILE)) {
return getDisconfData(ZooPathMgr.getFileZooPath(baseUrl), keyName, zooKeeper);
} else if (disConfigTypeEnum.equals(DisConfigTypeEnum.ITEM)) {
return getDisconfData(ZooPathMgr.getItemZooPath(baseUrl), keyName, zooKeeper);
}
} catch (KeeperException e) {
LOG.error(e.getMessage(), e);
} catch (InterruptedException e) {
LOG.error(e.getMessage(), e);
}
return null;
} }
|
public class class_name {
@Override
public ZkDisconfData getDisconfData(String app, String env, String version, DisConfigTypeEnum disConfigTypeEnum,
String keyName) {
String baseUrl = ZooPathMgr.getZooBaseUrl(zooConfig.getZookeeperUrlPrefix(), app, env, version);
try {
ZookeeperMgr zooKeeperMgr = ZookeeperMgr.getInstance();
ZooKeeper zooKeeper = zooKeeperMgr.getZk();
if (disConfigTypeEnum.equals(DisConfigTypeEnum.FILE)) {
return getDisconfData(ZooPathMgr.getFileZooPath(baseUrl), keyName, zooKeeper); // depends on control dependency: [if], data = [none]
} else if (disConfigTypeEnum.equals(DisConfigTypeEnum.ITEM)) {
return getDisconfData(ZooPathMgr.getItemZooPath(baseUrl), keyName, zooKeeper); // depends on control dependency: [if], data = [none]
}
} catch (KeeperException e) {
LOG.error(e.getMessage(), e);
} catch (InterruptedException e) { // depends on control dependency: [catch], data = [none]
LOG.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
private static Boolean ancestorOrIHasParam(final Resource resource, String uriParamName) {
Resource ancestor = resource;
while (ancestor != null) {
if (ancestor.getUriParameters().containsKey(uriParamName)) {
return true;
}
ancestor = ancestor.getParentResource();
}
return false;
} }
|
public class class_name {
private static Boolean ancestorOrIHasParam(final Resource resource, String uriParamName) {
Resource ancestor = resource;
while (ancestor != null) {
if (ancestor.getUriParameters().containsKey(uriParamName)) {
return true; // depends on control dependency: [if], data = [none]
}
ancestor = ancestor.getParentResource(); // depends on control dependency: [while], data = [none]
}
return false;
} }
|
public class class_name {
public void marshall(GetRelationalDatabaseBlueprintsRequest getRelationalDatabaseBlueprintsRequest, ProtocolMarshaller protocolMarshaller) {
if (getRelationalDatabaseBlueprintsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getRelationalDatabaseBlueprintsRequest.getPageToken(), PAGETOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GetRelationalDatabaseBlueprintsRequest getRelationalDatabaseBlueprintsRequest, ProtocolMarshaller protocolMarshaller) {
if (getRelationalDatabaseBlueprintsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getRelationalDatabaseBlueprintsRequest.getPageToken(), PAGETOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private boolean checkModulo11TaxNumber(final String ptaxNumber) {
final int checkSum = ptaxNumber.charAt(ptaxNumber.length() - 1) - '0';
int sum = 10;
for (int i = 0; i < ptaxNumber.length() - 1; i++) {
int summe = (ptaxNumber.charAt(i) - '0' + sum) % 10;
if (summe == 0) {
summe = 10;
}
sum = 2 * summe % MODULO_11;
}
int calculatedCheckSum = MODULO_11 - sum;
if (calculatedCheckSum == 10) {
calculatedCheckSum = 0;
}
return checkSum == calculatedCheckSum;
} }
|
public class class_name {
private boolean checkModulo11TaxNumber(final String ptaxNumber) {
final int checkSum = ptaxNumber.charAt(ptaxNumber.length() - 1) - '0';
int sum = 10;
for (int i = 0; i < ptaxNumber.length() - 1; i++) {
int summe = (ptaxNumber.charAt(i) - '0' + sum) % 10;
if (summe == 0) {
summe = 10;
// depends on control dependency: [if], data = [none]
}
sum = 2 * summe % MODULO_11;
// depends on control dependency: [for], data = [none]
}
int calculatedCheckSum = MODULO_11 - sum;
if (calculatedCheckSum == 10) {
calculatedCheckSum = 0;
// depends on control dependency: [if], data = [none]
}
return checkSum == calculatedCheckSum;
} }
|
public class class_name {
public QueryType<EntityBeanType<T>> getOrCreateQuery()
{
List<Node> nodeList = childNode.get("query");
if (nodeList != null && nodeList.size() > 0)
{
return new QueryTypeImpl<EntityBeanType<T>>(this, "query", childNode, nodeList.get(0));
}
return createQuery();
} }
|
public class class_name {
public QueryType<EntityBeanType<T>> getOrCreateQuery()
{
List<Node> nodeList = childNode.get("query");
if (nodeList != null && nodeList.size() > 0)
{
return new QueryTypeImpl<EntityBeanType<T>>(this, "query", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createQuery();
} }
|
public class class_name {
private boolean gatherEvidence(Dependency dependency, EvidenceType type, Pattern pattern, String contents,
String source, String name, Confidence confidence) {
final Matcher matcher = pattern.matcher(contents);
final boolean found = matcher.find();
if (found) {
dependency.addEvidence(type, source, name, matcher.group(4), confidence);
if (type == EvidenceType.VERSION) {
//TODO - this seems broken as we are cycling over py files and could be grabbing versions from multiple?
dependency.setVersion(matcher.group(4));
final String dispName = String.format("%s:%s", dependency.getName(), dependency.getVersion());
dependency.setDisplayFileName(dispName);
}
}
return found;
} }
|
public class class_name {
private boolean gatherEvidence(Dependency dependency, EvidenceType type, Pattern pattern, String contents,
String source, String name, Confidence confidence) {
final Matcher matcher = pattern.matcher(contents);
final boolean found = matcher.find();
if (found) {
dependency.addEvidence(type, source, name, matcher.group(4), confidence); // depends on control dependency: [if], data = [none]
if (type == EvidenceType.VERSION) {
//TODO - this seems broken as we are cycling over py files and could be grabbing versions from multiple?
dependency.setVersion(matcher.group(4)); // depends on control dependency: [if], data = [none]
final String dispName = String.format("%s:%s", dependency.getName(), dependency.getVersion());
dependency.setDisplayFileName(dispName); // depends on control dependency: [if], data = [none]
}
}
return found;
} }
|
public class class_name {
private ExtendElement readExtend(Location location, String documentation) {
String name = reader.readName();
reader.require('{');
ImmutableList.Builder<FieldElement> fields = ImmutableList.builder();
while (true) {
String nestedDocumentation = reader.readDocumentation();
if (reader.peekChar('}')) break;
Object declared = readDeclaration(nestedDocumentation, Context.EXTEND);
if (declared instanceof FieldElement) {
fields.add((FieldElement) declared);
}
}
return new ExtendElement(location, name, documentation, fields.build());
} }
|
public class class_name {
private ExtendElement readExtend(Location location, String documentation) {
String name = reader.readName();
reader.require('{');
ImmutableList.Builder<FieldElement> fields = ImmutableList.builder();
while (true) {
String nestedDocumentation = reader.readDocumentation();
if (reader.peekChar('}')) break;
Object declared = readDeclaration(nestedDocumentation, Context.EXTEND);
if (declared instanceof FieldElement) {
fields.add((FieldElement) declared); // depends on control dependency: [if], data = [none]
}
}
return new ExtendElement(location, name, documentation, fields.build());
} }
|
public class class_name {
void revokeUnauthToken(HeaderToken oldToken) {
synchronized (lock) {
if (headerCache.getToken() == oldToken) {
LOG.warn("Got unauthenticated response from server, revoking the current token");
headerCache = EMPTY_HEADER;
} else {
LOG.info("Skipping revoke, since the revoked token has already changed");
}
}
} }
|
public class class_name {
void revokeUnauthToken(HeaderToken oldToken) {
synchronized (lock) {
if (headerCache.getToken() == oldToken) {
LOG.warn("Got unauthenticated response from server, revoking the current token"); // depends on control dependency: [if], data = [none]
headerCache = EMPTY_HEADER; // depends on control dependency: [if], data = [none]
} else {
LOG.info("Skipping revoke, since the revoked token has already changed"); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static List<Object> toGroupKey(long timeStamp, InputRow inputRow)
{
final Map<String, Set<String>> dims = new TreeMap<>();
for (final String dim : inputRow.getDimensions()) {
final Set<String> dimValues = ImmutableSortedSet.copyOf(inputRow.getDimension(dim));
if (dimValues.size() > 0) {
dims.put(dim, dimValues);
}
}
return ImmutableList.of(timeStamp, dims);
} }
|
public class class_name {
public static List<Object> toGroupKey(long timeStamp, InputRow inputRow)
{
final Map<String, Set<String>> dims = new TreeMap<>();
for (final String dim : inputRow.getDimensions()) {
final Set<String> dimValues = ImmutableSortedSet.copyOf(inputRow.getDimension(dim));
if (dimValues.size() > 0) {
dims.put(dim, dimValues); // depends on control dependency: [if], data = [none]
}
}
return ImmutableList.of(timeStamp, dims);
} }
|
public class class_name {
@SuppressWarnings("rawtypes")
public final void buildSeriesList(final List bsers,
final ThemesTable themeTable, final ChartObject ctObj) {
List<ChartSeries> lseriesList = new ArrayList<>();
try {
for (int index = 0; index < bsers.size(); index++) {
Object ctObjSer = bsers.get(index);
ChartSeries ctSer = buildChartSeriesInList(themeTable,
ctObj, ctObjSer, index);
lseriesList.add(ctSer);
}
} catch (Exception ex) {
LOG.log(Level.FINE, "failed in buildSerialList", ex);
}
this.setSeriesList(lseriesList);
} }
|
public class class_name {
@SuppressWarnings("rawtypes")
public final void buildSeriesList(final List bsers,
final ThemesTable themeTable, final ChartObject ctObj) {
List<ChartSeries> lseriesList = new ArrayList<>();
try {
for (int index = 0; index < bsers.size(); index++) {
Object ctObjSer = bsers.get(index);
ChartSeries ctSer = buildChartSeriesInList(themeTable,
ctObj, ctObjSer, index);
lseriesList.add(ctSer);
// depends on control dependency: [for], data = [none]
}
} catch (Exception ex) {
LOG.log(Level.FINE, "failed in buildSerialList", ex);
}
// depends on control dependency: [catch], data = [none]
this.setSeriesList(lseriesList);
} }
|
public class class_name {
private <T> T parseQuery(final String response, final Class<T> responseClass) {
T queryResponse;
try {
/*
* Possible exceptions:
*
* IOException - if the underlying input source has problems during parsing
*
* JsonParseException - if parser has problems parsing content
*
* JsonMappingException - if the parser does not have any more content to map (note: Json "null" value is considered content; enf-of-stream not)
*/
queryResponse = MAPPER.readValue(response, responseClass);
} catch (JsonParseException | JsonMappingException e) {
try {
final ErrorResponse error = MAPPER.readValue(response, ErrorResponse.class);
LOGGER.error("Query returned an error: {}", error);
return null;
} catch (final IOException e1) {
LOGGER.error("Failed to read error response.", e1);
}
LOGGER.error("Error reading response.", e);
return null;
} catch (final IOException e) {
LOGGER.error("Error reading response.", e);
return null;
}
return queryResponse;
} }
|
public class class_name {
private <T> T parseQuery(final String response, final Class<T> responseClass) {
T queryResponse;
try {
/*
* Possible exceptions:
*
* IOException - if the underlying input source has problems during parsing
*
* JsonParseException - if parser has problems parsing content
*
* JsonMappingException - if the parser does not have any more content to map (note: Json "null" value is considered content; enf-of-stream not)
*/
queryResponse = MAPPER.readValue(response, responseClass);
// depends on control dependency: [try], data = [none]
} catch (JsonParseException | JsonMappingException e) {
try {
final ErrorResponse error = MAPPER.readValue(response, ErrorResponse.class);
LOGGER.error("Query returned an error: {}", error);
// depends on control dependency: [try], data = [none]
return null;
// depends on control dependency: [try], data = [none]
} catch (final IOException e1) {
LOGGER.error("Failed to read error response.", e1);
}
// depends on control dependency: [catch], data = [none]
LOGGER.error("Error reading response.", e);
return null;
} catch (final IOException e) {
// depends on control dependency: [catch], data = [none]
LOGGER.error("Error reading response.", e);
return null;
}
// depends on control dependency: [catch], data = [none]
return queryResponse;
} }
|
public class class_name {
Response getResponseFor(Request request) {
ProcessingRule rule;
String methodName = request.getMethodName();
if (rules.containsKey(methodName)) {
rule = rules.get(methodName);
} else {
String message = String.format("method '%s' did not match any processing rule", methodName);
return new FatalErrorResponse(message);
}
Response response;
try {
Object result = rule.getUserImplementation().process(request.getParams());
response = new ValidResponse(request.getId(), result);
} catch (Exception e) {
String message = "user implementation raised exception";
LoggerFactory.getLogger(ProcessingRules.class).warn(message, e);
return new FatalErrorResponse(message);
}
return response;
} }
|
public class class_name {
Response getResponseFor(Request request) {
ProcessingRule rule;
String methodName = request.getMethodName();
if (rules.containsKey(methodName)) {
rule = rules.get(methodName); // depends on control dependency: [if], data = [none]
} else {
String message = String.format("method '%s' did not match any processing rule", methodName);
return new FatalErrorResponse(message); // depends on control dependency: [if], data = [none]
}
Response response;
try {
Object result = rule.getUserImplementation().process(request.getParams());
response = new ValidResponse(request.getId(), result); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
String message = "user implementation raised exception";
LoggerFactory.getLogger(ProcessingRules.class).warn(message, e);
return new FatalErrorResponse(message);
} // depends on control dependency: [catch], data = [none]
return response;
} }
|
public class class_name {
public static void showSelectedColor( String name , BufferedImage image , float hue , float saturation ) {
Planar<GrayF32> input = ConvertBufferedImage.convertFromPlanar(image,null,true,GrayF32.class);
Planar<GrayF32> hsv = input.createSameShape();
// Convert into HSV
ColorHsv.rgbToHsv(input,hsv);
// Euclidean distance squared threshold for deciding which pixels are members of the selected set
float maxDist2 = 0.4f*0.4f;
// Extract hue and saturation bands which are independent of intensity
GrayF32 H = hsv.getBand(0);
GrayF32 S = hsv.getBand(1);
// Adjust the relative importance of Hue and Saturation.
// Hue has a range of 0 to 2*PI and Saturation from 0 to 1.
float adjustUnits = (float)(Math.PI/2.0);
// step through each pixel and mark how close it is to the selected color
BufferedImage output = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
for( int y = 0; y < hsv.height; y++ ) {
for( int x = 0; x < hsv.width; x++ ) {
// Hue is an angle in radians, so simple subtraction doesn't work
float dh = UtilAngle.dist(H.unsafe_get(x,y),hue);
float ds = (S.unsafe_get(x,y)-saturation)*adjustUnits;
// this distance measure is a bit naive, but good enough for to demonstrate the concept
float dist2 = dh*dh + ds*ds;
if( dist2 <= maxDist2 ) {
output.setRGB(x,y,image.getRGB(x,y));
}
}
}
ShowImages.showWindow(output,"Showing "+name);
} }
|
public class class_name {
public static void showSelectedColor( String name , BufferedImage image , float hue , float saturation ) {
Planar<GrayF32> input = ConvertBufferedImage.convertFromPlanar(image,null,true,GrayF32.class);
Planar<GrayF32> hsv = input.createSameShape();
// Convert into HSV
ColorHsv.rgbToHsv(input,hsv);
// Euclidean distance squared threshold for deciding which pixels are members of the selected set
float maxDist2 = 0.4f*0.4f;
// Extract hue and saturation bands which are independent of intensity
GrayF32 H = hsv.getBand(0);
GrayF32 S = hsv.getBand(1);
// Adjust the relative importance of Hue and Saturation.
// Hue has a range of 0 to 2*PI and Saturation from 0 to 1.
float adjustUnits = (float)(Math.PI/2.0);
// step through each pixel and mark how close it is to the selected color
BufferedImage output = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
for( int y = 0; y < hsv.height; y++ ) {
for( int x = 0; x < hsv.width; x++ ) {
// Hue is an angle in radians, so simple subtraction doesn't work
float dh = UtilAngle.dist(H.unsafe_get(x,y),hue);
float ds = (S.unsafe_get(x,y)-saturation)*adjustUnits;
// this distance measure is a bit naive, but good enough for to demonstrate the concept
float dist2 = dh*dh + ds*ds;
if( dist2 <= maxDist2 ) {
output.setRGB(x,y,image.getRGB(x,y)); // depends on control dependency: [if], data = [none]
}
}
}
ShowImages.showWindow(output,"Showing "+name);
} }
|
public class class_name {
private String getCodeWordB(int nAddressCode, int nChannelCode,
boolean bStatus) {
int nReturnPos = 0;
char[] sReturn = new char[13];
String[] code = new String[]{"FFFF", "0FFF", "F0FF", "FF0F", "FFF0"};
if (nAddressCode < 1 || nAddressCode > 4 || nChannelCode < 1
|| nChannelCode > 4) {
return "";
}
for (int i = 0; i < 4; i++) {
sReturn[nReturnPos++] = code[nAddressCode].charAt(i);
}
for (int i = 0; i < 4; i++) {
sReturn[nReturnPos++] = code[nChannelCode].charAt(i);
}
sReturn[nReturnPos++] = 'F';
sReturn[nReturnPos++] = 'F';
sReturn[nReturnPos++] = 'F';
if (bStatus) {
sReturn[nReturnPos++] = 'F';
} else {
sReturn[nReturnPos++] = '0';
}
return new String(sReturn);
} }
|
public class class_name {
private String getCodeWordB(int nAddressCode, int nChannelCode,
boolean bStatus) {
int nReturnPos = 0;
char[] sReturn = new char[13];
String[] code = new String[]{"FFFF", "0FFF", "F0FF", "FF0F", "FFF0"};
if (nAddressCode < 1 || nAddressCode > 4 || nChannelCode < 1
|| nChannelCode > 4) {
return ""; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < 4; i++) {
sReturn[nReturnPos++] = code[nAddressCode].charAt(i); // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < 4; i++) {
sReturn[nReturnPos++] = code[nChannelCode].charAt(i); // depends on control dependency: [for], data = [i]
}
sReturn[nReturnPos++] = 'F';
sReturn[nReturnPos++] = 'F';
sReturn[nReturnPos++] = 'F';
if (bStatus) {
sReturn[nReturnPos++] = 'F'; // depends on control dependency: [if], data = [none]
} else {
sReturn[nReturnPos++] = '0'; // depends on control dependency: [if], data = [none]
}
return new String(sReturn);
} }
|
public class class_name {
@Validate
public Validator initialize() {
// configure and build an instance of ValidatorFactory
ProviderSpecificBootstrap<HibernateValidatorConfiguration> validationBootStrap = javax.validation.Validation
.byProvider(HibernateValidator.class);
// bootstrap to properly resolve in an OSGi environment
validationBootStrap.providerResolver(new HibernateValidationProviderResolver());
HibernateValidatorConfiguration configure = validationBootStrap.configure().messageInterpolator(interpolator);
interpolator.setDefaultInterpolator(configure.getDefaultMessageInterpolator());
// now that we've done configuring the ValidatorFactory, let's build it
ValidatorFactory validatorFactory = configure.buildValidatorFactory();
// retrieve a unique validator.
Validator validator = validatorFactory.getValidator();
// Register the validator.
if (context != null) {
registration = context.registerService(Validator.class, new WrappedValidator(validator), null);
factoryRegistration = context.registerService(ValidatorFactory.class, validatorFactory, null);
}
return validator;
} }
|
public class class_name {
@Validate
public Validator initialize() {
// configure and build an instance of ValidatorFactory
ProviderSpecificBootstrap<HibernateValidatorConfiguration> validationBootStrap = javax.validation.Validation
.byProvider(HibernateValidator.class);
// bootstrap to properly resolve in an OSGi environment
validationBootStrap.providerResolver(new HibernateValidationProviderResolver());
HibernateValidatorConfiguration configure = validationBootStrap.configure().messageInterpolator(interpolator);
interpolator.setDefaultInterpolator(configure.getDefaultMessageInterpolator());
// now that we've done configuring the ValidatorFactory, let's build it
ValidatorFactory validatorFactory = configure.buildValidatorFactory();
// retrieve a unique validator.
Validator validator = validatorFactory.getValidator();
// Register the validator.
if (context != null) {
registration = context.registerService(Validator.class, new WrappedValidator(validator), null); // depends on control dependency: [if], data = [null)]
factoryRegistration = context.registerService(ValidatorFactory.class, validatorFactory, null); // depends on control dependency: [if], data = [null)]
}
return validator;
} }
|
public class class_name {
public void marshall(BundleDetails bundleDetails, ProtocolMarshaller protocolMarshaller) {
if (bundleDetails == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(bundleDetails.getBundleId(), BUNDLEID_BINDING);
protocolMarshaller.marshall(bundleDetails.getTitle(), TITLE_BINDING);
protocolMarshaller.marshall(bundleDetails.getVersion(), VERSION_BINDING);
protocolMarshaller.marshall(bundleDetails.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(bundleDetails.getIconUrl(), ICONURL_BINDING);
protocolMarshaller.marshall(bundleDetails.getAvailablePlatforms(), AVAILABLEPLATFORMS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(BundleDetails bundleDetails, ProtocolMarshaller protocolMarshaller) {
if (bundleDetails == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(bundleDetails.getBundleId(), BUNDLEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(bundleDetails.getTitle(), TITLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(bundleDetails.getVersion(), VERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(bundleDetails.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(bundleDetails.getIconUrl(), ICONURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(bundleDetails.getAvailablePlatforms(), AVAILABLEPLATFORMS_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 {
protected boolean doPrincipalAttributesAllowSurrogateServiceAccess(final Map<String, Object> principalAttributes) {
if (!enoughRequiredAttributesAvailableToProcess(principalAttributes, this.surrogateRequiredAttributes)) {
LOGGER.debug("Surrogate access is denied. There are not enough attributes available to satisfy the requirements [{}]",
this.surrogateRequiredAttributes);
return false;
}
if (!doRequiredAttributesAllowPrincipalAccess(principalAttributes, this.surrogateRequiredAttributes)) {
LOGGER.debug("Surrogate access is denied. The principal does not have the required attributes [{}] specified by this strategy",
this.surrogateRequiredAttributes);
return false;
}
return true;
} }
|
public class class_name {
protected boolean doPrincipalAttributesAllowSurrogateServiceAccess(final Map<String, Object> principalAttributes) {
if (!enoughRequiredAttributesAvailableToProcess(principalAttributes, this.surrogateRequiredAttributes)) {
LOGGER.debug("Surrogate access is denied. There are not enough attributes available to satisfy the requirements [{}]",
this.surrogateRequiredAttributes); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (!doRequiredAttributesAllowPrincipalAccess(principalAttributes, this.surrogateRequiredAttributes)) {
LOGGER.debug("Surrogate access is denied. The principal does not have the required attributes [{}] specified by this strategy",
this.surrogateRequiredAttributes); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
@ViewChanged
public synchronized void onViewChangeEvent(ViewChangedEvent event) {
if (logger.isDebugEnabled()) {
logger.debug("onViewChangeEvent : pre[" + event.isPre() + "] : event local address[" + event.getCache().getLocalAddress() + "]");
}
final List<Address> oldView = currentView;
currentView = new ArrayList<Address>(event.getNewView().getMembers());
final Address localAddress = getLocalAddress();
//just a precaution, it can be null!
if (oldView != null) {
final Cache jbossCache = mobicentsCache.getJBossCache();
final Configuration config = jbossCache.getConfiguration();
final boolean isBuddyReplicationEnabled = config.getBuddyReplicationConfig() != null && config.getBuddyReplicationConfig().isEnabled();
// recover stuff from lost members
Runnable runnable = new Runnable() {
public void run() {
for (Address oldMember : oldView) {
if (!currentView.contains(oldMember)) {
if (logger.isDebugEnabled()) {
logger.debug("onViewChangeEvent : processing lost member " + oldMember);
}
for (FailOverListener localListener : failOverListeners) {
ClientLocalListenerElector localListenerElector = localListener.getElector();
if (localListenerElector != null && !isBuddyReplicationEnabled) {
// going to use the local listener elector instead, which gives results based on data
performTakeOver(localListener,oldMember,localAddress, true, isBuddyReplicationEnabled);
}
else {
List<Address> electionView = getElectionView(oldMember);
if(electionView!=null && elector.elect(electionView).equals(localAddress))
{
performTakeOver(localListener, oldMember, localAddress, false, isBuddyReplicationEnabled);
}
cleanAfterTakeOver(localListener, oldMember);
}
}
}
}
}
};
Thread t = new Thread(runnable);
t.start();
}
} }
|
public class class_name {
@ViewChanged
public synchronized void onViewChangeEvent(ViewChangedEvent event) {
if (logger.isDebugEnabled()) {
logger.debug("onViewChangeEvent : pre[" + event.isPre() + "] : event local address[" + event.getCache().getLocalAddress() + "]"); // depends on control dependency: [if], data = [none]
}
final List<Address> oldView = currentView;
currentView = new ArrayList<Address>(event.getNewView().getMembers());
final Address localAddress = getLocalAddress();
//just a precaution, it can be null!
if (oldView != null) {
final Cache jbossCache = mobicentsCache.getJBossCache();
final Configuration config = jbossCache.getConfiguration();
final boolean isBuddyReplicationEnabled = config.getBuddyReplicationConfig() != null && config.getBuddyReplicationConfig().isEnabled();
// recover stuff from lost members
Runnable runnable = new Runnable() {
public void run() {
for (Address oldMember : oldView) {
if (!currentView.contains(oldMember)) {
if (logger.isDebugEnabled()) {
logger.debug("onViewChangeEvent : processing lost member " + oldMember); // depends on control dependency: [if], data = [none]
}
for (FailOverListener localListener : failOverListeners) {
ClientLocalListenerElector localListenerElector = localListener.getElector();
if (localListenerElector != null && !isBuddyReplicationEnabled) {
// going to use the local listener elector instead, which gives results based on data
performTakeOver(localListener,oldMember,localAddress, true, isBuddyReplicationEnabled); // depends on control dependency: [if], data = [none]
}
else {
List<Address> electionView = getElectionView(oldMember);
if(electionView!=null && elector.elect(electionView).equals(localAddress))
{
performTakeOver(localListener, oldMember, localAddress, false, isBuddyReplicationEnabled); // depends on control dependency: [if], data = [none]
}
cleanAfterTakeOver(localListener, oldMember); // depends on control dependency: [if], data = [none]
}
}
}
}
}
};
Thread t = new Thread(runnable);
t.start(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private OutlierResult getOutlierResult(ResultHierarchy hier, Result result) {
List<OutlierResult> ors = ResultUtil.filterResults(hier, result, OutlierResult.class);
if(!ors.isEmpty()) {
return ors.get(0);
}
throw new IllegalStateException("Comparison algorithm expected at least one outlier result.");
} }
|
public class class_name {
private OutlierResult getOutlierResult(ResultHierarchy hier, Result result) {
List<OutlierResult> ors = ResultUtil.filterResults(hier, result, OutlierResult.class);
if(!ors.isEmpty()) {
return ors.get(0); // depends on control dependency: [if], data = [none]
}
throw new IllegalStateException("Comparison algorithm expected at least one outlier result.");
} }
|
public class class_name {
protected void addComponentsFromPath(String fileName) throws CmsConfigurationException {
CmsParameterConfiguration configuration;
try {
configuration = getComponentsProperties(fileName);
} catch (FileNotFoundException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(e.getLocalizedMessage(), e);
}
return;
}
for (String componentId : configuration.getList(PROPKEY_COMPONENTS)) {
CmsSetupComponent componentBean = new CmsSetupComponent();
componentBean.setId(componentId);
componentBean.setName(configuration.get(PROPKEY_COMPONENT + componentId + PROPKEY_NAME));
componentBean.setDescription(configuration.get(PROPKEY_COMPONENT + componentId + PROPKEY_DESCRIPTION));
componentBean.setModulesRegex(configuration.get(PROPKEY_COMPONENT + componentId + PROPKEY_MODULES));
componentBean.setDependencies(
configuration.getList(PROPKEY_COMPONENT + componentId + PROPKEY_DEPENDENCIES));
componentBean.setPosition(
configuration.getInteger(PROPKEY_COMPONENT + componentId + PROPKEY_POSITION, DEFAULT_POSITION));
componentBean.setChecked(
configuration.getBoolean(PROPKEY_COMPONENT + componentId + PROPKEY_CHECKED, false));
m_components.addIdentifiableObject(componentBean.getId(), componentBean, componentBean.getPosition());
}
} }
|
public class class_name {
protected void addComponentsFromPath(String fileName) throws CmsConfigurationException {
CmsParameterConfiguration configuration;
try {
configuration = getComponentsProperties(fileName);
} catch (FileNotFoundException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none]
}
return;
}
for (String componentId : configuration.getList(PROPKEY_COMPONENTS)) {
CmsSetupComponent componentBean = new CmsSetupComponent();
componentBean.setId(componentId);
componentBean.setName(configuration.get(PROPKEY_COMPONENT + componentId + PROPKEY_NAME));
componentBean.setDescription(configuration.get(PROPKEY_COMPONENT + componentId + PROPKEY_DESCRIPTION));
componentBean.setModulesRegex(configuration.get(PROPKEY_COMPONENT + componentId + PROPKEY_MODULES));
componentBean.setDependencies(
configuration.getList(PROPKEY_COMPONENT + componentId + PROPKEY_DEPENDENCIES));
componentBean.setPosition(
configuration.getInteger(PROPKEY_COMPONENT + componentId + PROPKEY_POSITION, DEFAULT_POSITION));
componentBean.setChecked(
configuration.getBoolean(PROPKEY_COMPONENT + componentId + PROPKEY_CHECKED, false));
m_components.addIdentifiableObject(componentBean.getId(), componentBean, componentBean.getPosition());
}
} }
|
public class class_name {
@Deprecated
public static Subscription unsubscribeInEventDispatchThread(final Action0 unsubscribe) {
return Subscriptions.create(new Action0() {
@Override
public void call() {
if (SwingUtilities.isEventDispatchThread()) {
unsubscribe.call();
} else {
final Worker inner = SwingScheduler.getInstance().createWorker();
inner.schedule(new Action0() {
@Override
public void call() {
unsubscribe.call();
inner.unsubscribe();
}
});
}
}
});
} }
|
public class class_name {
@Deprecated
public static Subscription unsubscribeInEventDispatchThread(final Action0 unsubscribe) {
return Subscriptions.create(new Action0() {
@Override
public void call() {
if (SwingUtilities.isEventDispatchThread()) {
unsubscribe.call(); // depends on control dependency: [if], data = [none]
} else {
final Worker inner = SwingScheduler.getInstance().createWorker();
inner.schedule(new Action0() {
@Override
public void call() {
unsubscribe.call();
inner.unsubscribe();
}
}); // depends on control dependency: [if], data = [none]
}
}
});
} }
|
public class class_name {
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
jContentPane.add(getMainPanel(), BorderLayout.CENTER);
jContentPane.add(getButtonPanel(), BorderLayout.SOUTH);
}
return jContentPane;
} }
|
public class class_name {
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel(); // depends on control dependency: [if], data = [none]
jContentPane.setLayout(new BorderLayout()); // depends on control dependency: [if], data = [none]
jContentPane.add(getMainPanel(), BorderLayout.CENTER); // depends on control dependency: [if], data = [none]
jContentPane.add(getButtonPanel(), BorderLayout.SOUTH); // depends on control dependency: [if], data = [none]
}
return jContentPane;
} }
|
public class class_name {
protected List<Term> decorateResultForIndexMode(List<Vertex> vertexList, WordNet wordNetAll)
{
List<Term> termList = new LinkedList<Term>();
int line = 1;
ListIterator<Vertex> listIterator = vertexList.listIterator();
listIterator.next();
int length = vertexList.size() - 2;
for (int i = 0; i < length; ++i)
{
Vertex vertex = listIterator.next();
Term termMain = convert(vertex);
termList.add(termMain);
termMain.offset = line - 1;
if (vertex.realWord.length() > 2)
{
// 过长词所在的行
int currentLine = line;
while (currentLine < line + vertex.realWord.length())
{
Iterator<Vertex> iterator = wordNetAll.descendingIterator(currentLine);// 这一行的词,逆序遍历保证字典序稳定地由大到小
while (iterator.hasNext())// 这一行的短词
{
Vertex smallVertex = iterator.next();
if (
((termMain.nature == Nature.mq && smallVertex.hasNature(Nature.q)) ||
smallVertex.realWord.length() >= config.indexMode)
&& smallVertex != vertex // 防止重复添加
&& currentLine + smallVertex.realWord.length() <= line + vertex.realWord.length() // 防止超出边界
)
{
listIterator.add(smallVertex);
Term termSub = convert(smallVertex);
termSub.offset = currentLine - 1;
termList.add(termSub);
}
}
++currentLine;
}
}
line += vertex.realWord.length();
}
return termList;
} }
|
public class class_name {
protected List<Term> decorateResultForIndexMode(List<Vertex> vertexList, WordNet wordNetAll)
{
List<Term> termList = new LinkedList<Term>();
int line = 1;
ListIterator<Vertex> listIterator = vertexList.listIterator();
listIterator.next();
int length = vertexList.size() - 2;
for (int i = 0; i < length; ++i)
{
Vertex vertex = listIterator.next();
Term termMain = convert(vertex);
termList.add(termMain); // depends on control dependency: [for], data = [none]
termMain.offset = line - 1; // depends on control dependency: [for], data = [none]
if (vertex.realWord.length() > 2)
{
// 过长词所在的行
int currentLine = line;
while (currentLine < line + vertex.realWord.length())
{
Iterator<Vertex> iterator = wordNetAll.descendingIterator(currentLine);// 这一行的词,逆序遍历保证字典序稳定地由大到小
while (iterator.hasNext())// 这一行的短词
{
Vertex smallVertex = iterator.next();
if (
((termMain.nature == Nature.mq && smallVertex.hasNature(Nature.q)) ||
smallVertex.realWord.length() >= config.indexMode)
&& smallVertex != vertex // 防止重复添加
&& currentLine + smallVertex.realWord.length() <= line + vertex.realWord.length() // 防止超出边界
)
{
listIterator.add(smallVertex); // depends on control dependency: [if], data = [(]
Term termSub = convert(smallVertex);
termSub.offset = currentLine - 1; // depends on control dependency: [if], data = [none]
termList.add(termSub); // depends on control dependency: [if], data = [(]
}
}
++currentLine; // depends on control dependency: [while], data = [none]
}
}
line += vertex.realWord.length(); // depends on control dependency: [for], data = [none]
}
return termList;
} }
|
public class class_name {
public static Props loadPluginProps(final File pluginDir) {
if (!pluginDir.exists()) {
logger.error("Error! Plugin path " + pluginDir.getPath() + " doesn't exist.");
return null;
}
if (!pluginDir.isDirectory()) {
logger.error("The plugin path " + pluginDir + " is not a directory.");
return null;
}
final File propertiesDir = new File(pluginDir, "conf");
if (propertiesDir.exists() && propertiesDir.isDirectory()) {
final File propertiesFile = new File(propertiesDir, "plugin.properties");
final File propertiesOverrideFile =
new File(propertiesDir, "override.properties");
if (propertiesFile.exists()) {
if (propertiesOverrideFile.exists()) {
return loadProps(null, propertiesFile, propertiesOverrideFile);
} else {
return loadProps(null, propertiesFile);
}
} else {
logger.error("Plugin conf file " + propertiesFile + " not found.");
return null;
}
} else {
logger.error("Plugin conf path " + propertiesDir + " not found.");
return null;
}
} }
|
public class class_name {
public static Props loadPluginProps(final File pluginDir) {
if (!pluginDir.exists()) {
logger.error("Error! Plugin path " + pluginDir.getPath() + " doesn't exist."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
if (!pluginDir.isDirectory()) {
logger.error("The plugin path " + pluginDir + " is not a directory."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
final File propertiesDir = new File(pluginDir, "conf");
if (propertiesDir.exists() && propertiesDir.isDirectory()) {
final File propertiesFile = new File(propertiesDir, "plugin.properties");
final File propertiesOverrideFile =
new File(propertiesDir, "override.properties");
if (propertiesFile.exists()) {
if (propertiesOverrideFile.exists()) {
return loadProps(null, propertiesFile, propertiesOverrideFile); // depends on control dependency: [if], data = [none]
} else {
return loadProps(null, propertiesFile); // depends on control dependency: [if], data = [none]
}
} else {
logger.error("Plugin conf file " + propertiesFile + " not found."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
} else {
logger.error("Plugin conf path " + propertiesDir + " not found."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public SIDestinationAddress getDestinationAddress()
{
if (CoreSPIBifurcatedConsumerSession.tc.isEntryEnabled())
{
SibTr.entry(CoreSPIBifurcatedConsumerSession.tc, "getDestinationAddress", this);
SibTr.exit(CoreSPIBifurcatedConsumerSession.tc, "getDestinationAddress");
}
return _consumerSession.getDestinationAddress();
} }
|
public class class_name {
public SIDestinationAddress getDestinationAddress()
{
if (CoreSPIBifurcatedConsumerSession.tc.isEntryEnabled())
{
SibTr.entry(CoreSPIBifurcatedConsumerSession.tc, "getDestinationAddress", this); // depends on control dependency: [if], data = [none]
SibTr.exit(CoreSPIBifurcatedConsumerSession.tc, "getDestinationAddress"); // depends on control dependency: [if], data = [none]
}
return _consumerSession.getDestinationAddress();
} }
|
public class class_name {
@Override
protected void notifyDispatcher() {
if (threads != null) {
synchronized (threads) {
threads.notifyAll();
for (Thread thread : threads) {
((DispatcherThread) thread).setChanged(true);
}
}
}
} }
|
public class class_name {
@Override
protected void notifyDispatcher() {
if (threads != null) {
synchronized (threads) { // depends on control dependency: [if], data = [(threads]
threads.notifyAll();
for (Thread thread : threads) {
((DispatcherThread) thread).setChanged(true); // depends on control dependency: [for], data = [thread]
}
}
}
} }
|
public class class_name {
public JobResource withEc2AmiResources(Ec2AmiResource... ec2AmiResources) {
if (this.ec2AmiResources == null) {
setEc2AmiResources(new java.util.ArrayList<Ec2AmiResource>(ec2AmiResources.length));
}
for (Ec2AmiResource ele : ec2AmiResources) {
this.ec2AmiResources.add(ele);
}
return this;
} }
|
public class class_name {
public JobResource withEc2AmiResources(Ec2AmiResource... ec2AmiResources) {
if (this.ec2AmiResources == null) {
setEc2AmiResources(new java.util.ArrayList<Ec2AmiResource>(ec2AmiResources.length)); // depends on control dependency: [if], data = [none]
}
for (Ec2AmiResource ele : ec2AmiResources) {
this.ec2AmiResources.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
protected int handleParameter(ProtoNetwork pn, Parameter p) {
ParameterTable pt = pn.getParameterTable();
Integer npidx;
if (p.getNamespace() != null) {
// add parameter with namespace
TableNamespace ns = new TableNamespace(p.getNamespace());
npidx = pt.addTableParameter(new TableParameter(ns, p.getValue()));
} else if (doc.getNamespaceGroup() != null
&& doc.getNamespaceGroup().getDefaultResourceLocation() != null) {
// add parameter with user-defined default namespace
TableNamespace ns = new TableNamespace(doc.getNamespaceGroup()
.getDefaultResourceLocation());
npidx = pt.addTableParameter(new TableParameter(ns, p.getValue()));
} else {
// add parameter with TEXT namespace
npidx = pt.addTableParameter(new TableParameter(p.getValue()));
}
return npidx;
} }
|
public class class_name {
protected int handleParameter(ProtoNetwork pn, Parameter p) {
ParameterTable pt = pn.getParameterTable();
Integer npidx;
if (p.getNamespace() != null) {
// add parameter with namespace
TableNamespace ns = new TableNamespace(p.getNamespace());
npidx = pt.addTableParameter(new TableParameter(ns, p.getValue())); // depends on control dependency: [if], data = [none]
} else if (doc.getNamespaceGroup() != null
&& doc.getNamespaceGroup().getDefaultResourceLocation() != null) {
// add parameter with user-defined default namespace
TableNamespace ns = new TableNamespace(doc.getNamespaceGroup()
.getDefaultResourceLocation());
npidx = pt.addTableParameter(new TableParameter(ns, p.getValue())); // depends on control dependency: [if], data = [none]
} else {
// add parameter with TEXT namespace
npidx = pt.addTableParameter(new TableParameter(p.getValue())); // depends on control dependency: [if], data = [none]
}
return npidx;
} }
|
public class class_name {
public Digester init(String algorithm, Provider provider) {
if(null == provider) {
this.digest = SecureUtil.createMessageDigest(algorithm);
}else {
try {
this.digest = MessageDigest.getInstance(algorithm, provider);
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
}
}
return this;
} }
|
public class class_name {
public Digester init(String algorithm, Provider provider) {
if(null == provider) {
this.digest = SecureUtil.createMessageDigest(algorithm);
// depends on control dependency: [if], data = [none]
}else {
try {
this.digest = MessageDigest.getInstance(algorithm, provider);
// depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
}
// depends on control dependency: [catch], data = [none]
}
return this;
} }
|
public class class_name {
protected static boolean writeCustomType(Output out, Object obj) {
if (out.isCustom(obj)) {
// Write custom data
out.writeCustom(obj);
return true;
} else {
return false;
}
} }
|
public class class_name {
protected static boolean writeCustomType(Output out, Object obj) {
if (out.isCustom(obj)) {
// Write custom data
out.writeCustom(obj); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static GrayU8 edge4(GrayU8 input, GrayU8 output, boolean outsideZero ) {
output = InputSanityCheck.checkDeclare(input, output);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplBinaryInnerOps_MT.edge4(input, output);
} else {
ImplBinaryInnerOps.edge4(input, output);
}
ImplBinaryBorderOps.edge4(input, output, outsideZero);
return output;
} }
|
public class class_name {
public static GrayU8 edge4(GrayU8 input, GrayU8 output, boolean outsideZero ) {
output = InputSanityCheck.checkDeclare(input, output);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplBinaryInnerOps_MT.edge4(input, output); // depends on control dependency: [if], data = [none]
} else {
ImplBinaryInnerOps.edge4(input, output); // depends on control dependency: [if], data = [none]
}
ImplBinaryBorderOps.edge4(input, output, outsideZero);
return output;
} }
|
public class class_name {
public Map<String, Object> getProperties() {
// Shallow copy entries to a newly instantiated HashMap.
Map<String, Object> clone = new HashMap<String, Object>();
Set<Entry<String, Object>> set = _properties.entrySet();
for (Entry<String, Object> entry : set) {
// There wouldn't be any entry with a null value.
clone.put(entry.getKey(), entry.getValue());
}
return clone;
} }
|
public class class_name {
public Map<String, Object> getProperties() {
// Shallow copy entries to a newly instantiated HashMap.
Map<String, Object> clone = new HashMap<String, Object>();
Set<Entry<String, Object>> set = _properties.entrySet();
for (Entry<String, Object> entry : set) {
// There wouldn't be any entry with a null value.
clone.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
return clone;
} }
|
public class class_name {
@Trivial
@Override
public synchronized void reportCircuitHalfOpen() {
if (circuitBreakerState != CircuitBreakerState.HALF_OPEN) {
recordEndOfCircuitBreakerState(circuitBreakerState);
circuitBreakerState = CircuitBreakerState.HALF_OPEN;
}
} }
|
public class class_name {
@Trivial
@Override
public synchronized void reportCircuitHalfOpen() {
if (circuitBreakerState != CircuitBreakerState.HALF_OPEN) {
recordEndOfCircuitBreakerState(circuitBreakerState); // depends on control dependency: [if], data = [(circuitBreakerState]
circuitBreakerState = CircuitBreakerState.HALF_OPEN; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void onLatitudeChange(String latitude) {
try {
m_editValue.setLatitude(latitude);
updateMarkerPosition();
updateAddress();
} catch (Throwable t) {
CmsErrorDialog.handleException(t);
}
} }
|
public class class_name {
protected void onLatitudeChange(String latitude) {
try {
m_editValue.setLatitude(latitude); // depends on control dependency: [try], data = [none]
updateMarkerPosition(); // depends on control dependency: [try], data = [none]
updateAddress(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
CmsErrorDialog.handleException(t);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private final ProfileDisablingMechanism limitGrammars()
throws EXIException, IOException {
ProfileDisablingMechanism retVal = ProfileDisablingMechanism.NONE;
Grammar currGrammar = getCurrentGrammar();
if (limitGrammarLearning && grammar.isSchemaInformed()
&& !currGrammar.isSchemaInformed()) {
// number of built-in grammars reached
if (maxBuiltInElementGrammars != -1) {
int csize = runtimeGlobalElements.size();
if (csize > maxBuiltInElementGrammars) {
if (currGrammar.getNumberOfEvents() == 0) {
// new grammar that hits bound
retVal = ProfileDisablingMechanism.XSI_TYPE;
} else if (isBuiltInStartTagGrammarWithAtXsiTypeOnly(currGrammar)) {
// previous type cast
retVal = ProfileDisablingMechanism.XSI_TYPE;
}
}
}
// number of productions reached?
if (this.maxBuiltInProductions != -1
&& retVal == ProfileDisablingMechanism.NONE
&& learnedProductions >= this.maxBuiltInProductions) {
// bound reached
if (this.lastEvent == EventType.START_ELEMENT
|| this.lastEvent == EventType.NAMESPACE_DECLARATION) {
// First mean possible: Insert xsi:type
retVal = ProfileDisablingMechanism.XSI_TYPE;
} else {
// Only 2nd mean possible: use ghost productions
retVal = ProfileDisablingMechanism.GHOST_PRODUCTION;
currGrammar.stopLearning();
}
}
}
return retVal;
} }
|
public class class_name {
private final ProfileDisablingMechanism limitGrammars()
throws EXIException, IOException {
ProfileDisablingMechanism retVal = ProfileDisablingMechanism.NONE;
Grammar currGrammar = getCurrentGrammar();
if (limitGrammarLearning && grammar.isSchemaInformed()
&& !currGrammar.isSchemaInformed()) {
// number of built-in grammars reached
if (maxBuiltInElementGrammars != -1) {
int csize = runtimeGlobalElements.size();
if (csize > maxBuiltInElementGrammars) {
if (currGrammar.getNumberOfEvents() == 0) {
// new grammar that hits bound
retVal = ProfileDisablingMechanism.XSI_TYPE; // depends on control dependency: [if], data = [none]
} else if (isBuiltInStartTagGrammarWithAtXsiTypeOnly(currGrammar)) {
// previous type cast
retVal = ProfileDisablingMechanism.XSI_TYPE; // depends on control dependency: [if], data = [none]
}
}
}
// number of productions reached?
if (this.maxBuiltInProductions != -1
&& retVal == ProfileDisablingMechanism.NONE
&& learnedProductions >= this.maxBuiltInProductions) {
// bound reached
if (this.lastEvent == EventType.START_ELEMENT
|| this.lastEvent == EventType.NAMESPACE_DECLARATION) {
// First mean possible: Insert xsi:type
retVal = ProfileDisablingMechanism.XSI_TYPE;
} else {
// Only 2nd mean possible: use ghost productions
retVal = ProfileDisablingMechanism.GHOST_PRODUCTION;
currGrammar.stopLearning();
}
}
}
return retVal;
} }
|
public class class_name {
public void addNavButtons()
{
BaseApplication application = (BaseApplication)this.getTask().getApplication();
String strMessageScreen = application.getResources(ResourceConstants.MAIN_RESOURCE, true).getString(MessageLog.MESSAGE_SCREEN);
new SCannedBox(this.getNextLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, null, MessageLog.MESSAGE_ICON, MessageLog.MESSAGE_SCREEN, strMessageScreen);
if (!this.isContactDisplay())
{
strMessageScreen = application.getResources(ResourceConstants.MAIN_RESOURCE, true).getString(MessageLog.SOURCE_SCREEN);
new SCannedBox(this.getNextLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, null, MessageLog.SOURCE_ICON, MessageLog.SOURCE_SCREEN, strMessageScreen);
}
super.addNavButtons(); // Next buttons will be "First!"
} }
|
public class class_name {
public void addNavButtons()
{
BaseApplication application = (BaseApplication)this.getTask().getApplication();
String strMessageScreen = application.getResources(ResourceConstants.MAIN_RESOURCE, true).getString(MessageLog.MESSAGE_SCREEN);
new SCannedBox(this.getNextLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, null, MessageLog.MESSAGE_ICON, MessageLog.MESSAGE_SCREEN, strMessageScreen);
if (!this.isContactDisplay())
{
strMessageScreen = application.getResources(ResourceConstants.MAIN_RESOURCE, true).getString(MessageLog.SOURCE_SCREEN); // depends on control dependency: [if], data = [none]
new SCannedBox(this.getNextLocation(ScreenConstants.FIRST_SCREEN_LOCATION, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, null, MessageLog.SOURCE_ICON, MessageLog.SOURCE_SCREEN, strMessageScreen); // depends on control dependency: [if], data = [none]
}
super.addNavButtons(); // Next buttons will be "First!"
} }
|
public class class_name {
private List<CmsSelectWidgetOption> getLanguages() {
List<CmsSelectWidgetOption> locales = new ArrayList<CmsSelectWidgetOption>();
Locale defLocale = null;
if ((m_user != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
defLocale = new CmsUserSettings(m_user).getLocale();
}
if (defLocale == null) {
defLocale = getCms().getRequestContext().getLocale();
}
Iterator<Locale> itLocales = OpenCms.getLocaleManager().getAvailableLocales().iterator();
while (itLocales.hasNext()) {
Locale locale = itLocales.next();
boolean selected = locale.equals(defLocale);
locales.add(
new CmsSelectWidgetOption(locale.toString(), selected, locale.getDisplayName(getLocale()), null));
}
return locales;
} }
|
public class class_name {
private List<CmsSelectWidgetOption> getLanguages() {
List<CmsSelectWidgetOption> locales = new ArrayList<CmsSelectWidgetOption>();
Locale defLocale = null;
if ((m_user != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
defLocale = new CmsUserSettings(m_user).getLocale(); // depends on control dependency: [if], data = [none]
}
if (defLocale == null) {
defLocale = getCms().getRequestContext().getLocale(); // depends on control dependency: [if], data = [none]
}
Iterator<Locale> itLocales = OpenCms.getLocaleManager().getAvailableLocales().iterator();
while (itLocales.hasNext()) {
Locale locale = itLocales.next();
boolean selected = locale.equals(defLocale);
locales.add(
new CmsSelectWidgetOption(locale.toString(), selected, locale.getDisplayName(getLocale()), null)); // depends on control dependency: [while], data = [none]
}
return locales;
} }
|
public class class_name {
private void generateAbstractSbbClassInfo() {
CtClass sbbClass = null;
try {
sbbClass = pool.get(Sbb.class.getName());
} catch (NotFoundException e) {
throw new SLEEException(e.getMessage(), e);
}
AbstractSbbClassInfo abstractSbbClassInfo = sbbComponent.getAbstractSbbClassInfo();
for (CtMethod sbbClassMethod : sbbClass.getDeclaredMethods()) {
for (CtMethod sbbAbstractClassMethod : sbbAbstractClass
.getMethods()) {
if (sbbAbstractClassMethod.getName().equals(
sbbClassMethod.getName())
&& sbbAbstractClassMethod.getSignature().equals(
sbbClassMethod.getSignature())) {
// match, save info
abstractSbbClassInfo.setInvokeInfo(sbbAbstractClassMethod
.getMethodInfo().getName(), !sbbAbstractClassMethod
.isEmpty());
break;
}
}
}
} }
|
public class class_name {
private void generateAbstractSbbClassInfo() {
CtClass sbbClass = null;
try {
sbbClass = pool.get(Sbb.class.getName()); // depends on control dependency: [try], data = [none]
} catch (NotFoundException e) {
throw new SLEEException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
AbstractSbbClassInfo abstractSbbClassInfo = sbbComponent.getAbstractSbbClassInfo();
for (CtMethod sbbClassMethod : sbbClass.getDeclaredMethods()) {
for (CtMethod sbbAbstractClassMethod : sbbAbstractClass
.getMethods()) {
if (sbbAbstractClassMethod.getName().equals(
sbbClassMethod.getName())
&& sbbAbstractClassMethod.getSignature().equals(
sbbClassMethod.getSignature())) {
// match, save info
abstractSbbClassInfo.setInvokeInfo(sbbAbstractClassMethod
.getMethodInfo().getName(), !sbbAbstractClassMethod
.isEmpty()); // depends on control dependency: [if], data = [none]
break;
}
}
}
} }
|
public class class_name {
private List<Deployment> managedDeployments(List<Deployment> deployments) {
List<Deployment> managed = new ArrayList<Deployment>();
for (Deployment deployment : deployments) {
if (deployment.getDescription().managed()) {
managed.add(deployment);
}
}
return managed;
} }
|
public class class_name {
private List<Deployment> managedDeployments(List<Deployment> deployments) {
List<Deployment> managed = new ArrayList<Deployment>();
for (Deployment deployment : deployments) {
if (deployment.getDescription().managed()) {
managed.add(deployment); // depends on control dependency: [if], data = [none]
}
}
return managed;
} }
|
public class class_name {
public static Date formatDate(Date orig, String... patterns) {
String pattern = TIMESTAMP_PATTERN;
if (patterns != null && patterns.length > 0
&& StringUtils.isNotBlank(patterns[0])) {
pattern = patterns[0];
}
return parseDate(DateFormatUtils.format(orig, pattern));
} }
|
public class class_name {
public static Date formatDate(Date orig, String... patterns) {
String pattern = TIMESTAMP_PATTERN;
if (patterns != null && patterns.length > 0
&& StringUtils.isNotBlank(patterns[0])) {
pattern = patterns[0]; // depends on control dependency: [if], data = [none]
}
return parseDate(DateFormatUtils.format(orig, pattern));
} }
|
public class class_name {
static public String toResourceUri(FacesContext facesContext, Object o)
{
if (o == null)
{
return null;
}
String uri = o.toString();
// *** EL Coercion problem ***
// If icon or image attribute was declared with #{resource[]} and that expression
// evaluates to null (it means ResourceHandler.createResource returns null because
// requested resource does not exist)
// EL implementation turns null into ""
// see http://www.irian.at/blog/blogid/unifiedElCoercion/#unifiedElCoercion
if (uri.length() == 0)
{
return null;
}
// With JSF 2.0 url for resources can be done with EL like #{resource['resourcename']}
// and such EL after evalution contains context path for the current web application already,
// -> we dont want call viewHandler.getResourceURL()
if (uri.contains(ResourceHandler.RESOURCE_IDENTIFIER))
{
return uri;
}
// Treat two slashes as server-relative
if (uri.startsWith("//"))
{
return uri.substring(1);
}
else
{
// If the specified path starts with a "/",
// following method will prefix it with the context path for the current web application,
// and return the result
String resourceURL = facesContext.getApplication().getViewHandler()
.getResourceURL(facesContext, uri);
return facesContext.getExternalContext().encodeResourceURL(
resourceURL);
}
} }
|
public class class_name {
static public String toResourceUri(FacesContext facesContext, Object o)
{
if (o == null)
{
return null; // depends on control dependency: [if], data = [none]
}
String uri = o.toString();
// *** EL Coercion problem ***
// If icon or image attribute was declared with #{resource[]} and that expression
// evaluates to null (it means ResourceHandler.createResource returns null because
// requested resource does not exist)
// EL implementation turns null into ""
// see http://www.irian.at/blog/blogid/unifiedElCoercion/#unifiedElCoercion
if (uri.length() == 0)
{
return null; // depends on control dependency: [if], data = [none]
}
// With JSF 2.0 url for resources can be done with EL like #{resource['resourcename']}
// and such EL after evalution contains context path for the current web application already,
// -> we dont want call viewHandler.getResourceURL()
if (uri.contains(ResourceHandler.RESOURCE_IDENTIFIER))
{
return uri; // depends on control dependency: [if], data = [none]
}
// Treat two slashes as server-relative
if (uri.startsWith("//"))
{
return uri.substring(1);
}
else
{
// If the specified path starts with a "/",
// following method will prefix it with the context path for the current web application,
// and return the result
String resourceURL = facesContext.getApplication().getViewHandler()
.getResourceURL(facesContext, uri);
return facesContext.getExternalContext().encodeResourceURL(
resourceURL);
}
} }
|
public class class_name {
public String getTableNames(boolean bAddQuotes)
{
if (m_tableName == null)
{
String strDatabaseName = "";
if (this.getDatabaseName() != null)
if (!this.getDatabaseName().endsWith("_" + this.getDatabaseName()))
strDatabaseName = "_" + this.getDatabaseName();
return Record.formatTableNames(DATABASE_INFO_FILE, bAddQuotes) + strDatabaseName;
}
return super.getTableNames(bAddQuotes);
} }
|
public class class_name {
public String getTableNames(boolean bAddQuotes)
{
if (m_tableName == null)
{
String strDatabaseName = "";
if (this.getDatabaseName() != null)
if (!this.getDatabaseName().endsWith("_" + this.getDatabaseName()))
strDatabaseName = "_" + this.getDatabaseName();
return Record.formatTableNames(DATABASE_INFO_FILE, bAddQuotes) + strDatabaseName; // depends on control dependency: [if], data = [none]
}
return super.getTableNames(bAddQuotes);
} }
|
public class class_name {
protected Object getLdpComponent(final T config, final boolean initialize) {
final TrellisHttpResource ldpResource = new TrellisHttpResource(getServiceBundler(), config.getBaseUrl());
if (initialize) {
ldpResource.initialize();
}
return ldpResource;
} }
|
public class class_name {
protected Object getLdpComponent(final T config, final boolean initialize) {
final TrellisHttpResource ldpResource = new TrellisHttpResource(getServiceBundler(), config.getBaseUrl());
if (initialize) {
ldpResource.initialize(); // depends on control dependency: [if], data = [none]
}
return ldpResource;
} }
|
public class class_name {
public void start() {
application = new CitrusRemoteApplication(configuration);
port(configuration.getPort());
application.init();
if (!configuration.isSkipTests()) {
new RunController(configuration).run();
}
if (configuration.getTimeToLive() == 0) {
stop();
}
} }
|
public class class_name {
public void start() {
application = new CitrusRemoteApplication(configuration);
port(configuration.getPort());
application.init();
if (!configuration.isSkipTests()) {
new RunController(configuration).run(); // depends on control dependency: [if], data = [none]
}
if (configuration.getTimeToLive() == 0) {
stop(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setItem(int index) {
if (index < 0 || index >= items.size()) {
return;
}
stop();
currentItemIndex = index;
try {
PlayItemEntry entry = items.get(currentItemIndex);
if (entry != null) {
IPlayItem item = entry.item;
engine.play(item);
entry.played = true;
}
} catch (IOException e) {
log.warn("setItem caught a IOException", e);
} catch (StreamNotFoundException e) {
// let the engine retain the STOPPED stateand wait for control from outside
log.debug("setItem caught a StreamNotFoundException");
} catch (IllegalStateException e) {
log.warn("Illegal state exception on playlist item setup", e);
}
} }
|
public class class_name {
public void setItem(int index) {
if (index < 0 || index >= items.size()) {
return;
// depends on control dependency: [if], data = [none]
}
stop();
currentItemIndex = index;
try {
PlayItemEntry entry = items.get(currentItemIndex);
if (entry != null) {
IPlayItem item = entry.item;
engine.play(item);
// depends on control dependency: [if], data = [none]
entry.played = true;
// depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
log.warn("setItem caught a IOException", e);
} catch (StreamNotFoundException e) {
// depends on control dependency: [catch], data = [none]
// let the engine retain the STOPPED stateand wait for control from outside
log.debug("setItem caught a StreamNotFoundException");
} catch (IllegalStateException e) {
// depends on control dependency: [catch], data = [none]
log.warn("Illegal state exception on playlist item setup", e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected AppendResponse appendEntries(AppendRequest request) {
// Get the last entry index or default to the request log index.
long lastEntryIndex = request.logIndex();
if (!request.entries().isEmpty()) {
lastEntryIndex = request.entries().get(request.entries().size() - 1).getIndex();
}
// Ensure the commitIndex is not increased beyond the index of the last entry in the request.
long commitIndex = Math.max(context.getCommitIndex(), Math.min(request.commitIndex(), lastEntryIndex));
// Append entries to the log starting at the last log index.
for (Entry entry : request.entries()) {
// If the entry index is greater than the last index and less than the commit index, append the entry.
// We perform no additional consistency checks here since passive members may only receive committed entries.
if (context.getLog().lastIndex() < entry.getIndex() && entry.getIndex() <= commitIndex) {
context.getLog().skip(entry.getIndex() - context.getLog().lastIndex() - 1).append(entry);
LOGGER.trace("{} - Appended {} to log at index {}", context.getCluster().member().address(), entry, entry.getIndex());
}
}
// Update the context commit and global indices.
long previousCommitIndex = context.getCommitIndex();
context.setCommitIndex(commitIndex);
context.setGlobalIndex(request.globalIndex());
if (context.getCommitIndex() > previousCommitIndex) {
LOGGER.trace("{} - Committed entries up to index {}", context.getCluster().member().address(), commitIndex);
}
// Apply commits to the state machine in batch.
context.getStateMachine().applyAll(context.getCommitIndex());
return AppendResponse.builder()
.withStatus(Response.Status.OK)
.withTerm(context.getTerm())
.withSucceeded(true)
.withLogIndex(context.getLog().lastIndex())
.build();
} }
|
public class class_name {
protected AppendResponse appendEntries(AppendRequest request) {
// Get the last entry index or default to the request log index.
long lastEntryIndex = request.logIndex();
if (!request.entries().isEmpty()) {
lastEntryIndex = request.entries().get(request.entries().size() - 1).getIndex(); // depends on control dependency: [if], data = [none]
}
// Ensure the commitIndex is not increased beyond the index of the last entry in the request.
long commitIndex = Math.max(context.getCommitIndex(), Math.min(request.commitIndex(), lastEntryIndex));
// Append entries to the log starting at the last log index.
for (Entry entry : request.entries()) {
// If the entry index is greater than the last index and less than the commit index, append the entry.
// We perform no additional consistency checks here since passive members may only receive committed entries.
if (context.getLog().lastIndex() < entry.getIndex() && entry.getIndex() <= commitIndex) {
context.getLog().skip(entry.getIndex() - context.getLog().lastIndex() - 1).append(entry); // depends on control dependency: [if], data = [none]
LOGGER.trace("{} - Appended {} to log at index {}", context.getCluster().member().address(), entry, entry.getIndex()); // depends on control dependency: [if], data = [none]
}
}
// Update the context commit and global indices.
long previousCommitIndex = context.getCommitIndex();
context.setCommitIndex(commitIndex);
context.setGlobalIndex(request.globalIndex());
if (context.getCommitIndex() > previousCommitIndex) {
LOGGER.trace("{} - Committed entries up to index {}", context.getCluster().member().address(), commitIndex); // depends on control dependency: [if], data = [none]
}
// Apply commits to the state machine in batch.
context.getStateMachine().applyAll(context.getCommitIndex());
return AppendResponse.builder()
.withStatus(Response.Status.OK)
.withTerm(context.getTerm())
.withSucceeded(true)
.withLogIndex(context.getLog().lastIndex())
.build();
} }
|
public class class_name {
public String registerDatastreamLocation(String dsLocation,
String dsControlGroupType, String beServiceCallbackRole,
String methodName) throws ServerException {
String tempID = null;
Timestamp timeStamp = null;
if (counter > 999999) {
counter = 0;
}
long currentTime = new Timestamp(new Date().getTime()).getTime();
long expireLimit = currentTime - (long) datastreamExpirationLimit
* 1000;
try {
// Remove any datastream registrations that have expired.
// The expiration limit can be adjusted using the Fedora config
// parameter
// named "datastreamExpirationLimit" which is in seconds.
for (Enumeration<String> e = dsRegistry.keys(); e.hasMoreElements();) {
String key = e.nextElement();
timeStamp = Timestamp.valueOf(extractTimestamp(key));
if (expireLimit > timeStamp.getTime()) {
dsRegistry.remove(key);
logger.debug("DatastreamMediationKey removed from Hash: {}",
key);
}
}
// Register datastream.
if (tempID == null) {
timeStamp = new Timestamp(new Date().getTime());
tempID = timeStamp.toString() + ":" + counter++;
DatastreamMediation dm = new DatastreamMediation();
dm.mediatedDatastreamID = tempID;
dm.dsLocation = dsLocation;
dm.dsControlGroupType = dsControlGroupType;
dm.methodName = methodName;
// See if datastream reference is to fedora server itself or an
// external location.
// M and X type datastreams always reference fedora server. With
// E type datastreams
// we must examine URL to see if this is referencing a remote
// datastream or is
// simply a callback to the fedora server. If the reference is
// remote, then use
// the role of the backend service that will make a callback for
// this datastream.
// If the referenc s to the fedora server, use the special role
// of "fedoraInternalCall-1" to
// denote that the callback will come from the fedora server
// itself.
String beServiceRole = null;
if (ServerUtility.isURLFedoraServer(dsLocation)
|| dsControlGroupType.equals("M")
|| dsControlGroupType.equals("X")) {
beServiceRole = BackendPolicies.FEDORA_INTERNAL_CALL;
} else {
beServiceRole = beServiceCallbackRole;
}
// Store beSecurity info in hash
Hashtable<String, String> beHash = m_beSS.getSecuritySpec(
beServiceRole, methodName);
boolean beServiceCallbackBasicAuth = Boolean.parseBoolean(
beHash.get("callbackBasicAuth"));
boolean beServiceCallBasicAuth = Boolean.parseBoolean(
beHash.get("callBasicAuth"));
boolean beServiceCallbackSSL = Boolean.parseBoolean(
beHash.get("callbackSSL"));
boolean beServiceCallSSL = Boolean.parseBoolean(
beHash.get("callSSL"));
String beServiceCallUsername = beHash.get("callUsername");
String beServiceCallPassword = beHash.get("callPassword");
if (logger.isDebugEnabled()) {
logger.debug(
"******************Registering datastream dsLocation: {}",
dsLocation);
logger.debug(
"******************Registering datastream dsControlGroupType: {}",
dsControlGroupType);
logger.debug(
"******************Registering datastream beServiceRole: {}",
beServiceRole);
logger.debug(
"******************Registering datastream beServiceCallbackBasicAuth: {}",
beServiceCallbackBasicAuth);
logger.debug(
"******************Registering datastream beServiceCallBasicAuth: {}",
beServiceCallBasicAuth);
logger.debug(
"******************Registering datastream beServiceCallbackSSL: {}",
beServiceCallbackSSL);
logger.debug(
"******************Registering datastream beServiceCallSSL: {}",
beServiceCallSSL);
logger.debug(
"******************Registering datastream beServiceCallUsername: {}",
beServiceCallUsername);
logger.debug(
"******************Registering datastream beServiceCallPassword: {}",
beServiceCallPassword);
}
dm.callbackRole = beServiceRole;
dm.callUsername = beServiceCallUsername;
dm.callPassword = beServiceCallPassword;
dm.callbackBasicAuth = beServiceCallbackBasicAuth;
dm.callBasicAuth = beServiceCallBasicAuth;
dm.callbackSSL = beServiceCallbackSSL;
dm.callSSL = beServiceCallSSL;
dsRegistry.put(tempID, dm);
logger.debug("DatastreammediationKey added to Hash: " + tempID);
}
} catch (Throwable th) {
throw new DisseminationException("[DisseminationService] register"
+ "DatastreamLocation: "
+ "returned an error. The underlying error was a "
+ th.getClass().getName() + " The message " + "was \""
+ th.getMessage() + "\" .");
}
// Replace the blank between date and time with the character "T".
return tempID.replace(' ', 'T');
} }
|
public class class_name {
public String registerDatastreamLocation(String dsLocation,
String dsControlGroupType, String beServiceCallbackRole,
String methodName) throws ServerException {
String tempID = null;
Timestamp timeStamp = null;
if (counter > 999999) {
counter = 0;
}
long currentTime = new Timestamp(new Date().getTime()).getTime();
long expireLimit = currentTime - (long) datastreamExpirationLimit
* 1000;
try {
// Remove any datastream registrations that have expired.
// The expiration limit can be adjusted using the Fedora config
// parameter
// named "datastreamExpirationLimit" which is in seconds.
for (Enumeration<String> e = dsRegistry.keys(); e.hasMoreElements();) {
String key = e.nextElement();
timeStamp = Timestamp.valueOf(extractTimestamp(key)); // depends on control dependency: [for], data = [none]
if (expireLimit > timeStamp.getTime()) {
dsRegistry.remove(key); // depends on control dependency: [if], data = [none]
logger.debug("DatastreamMediationKey removed from Hash: {}",
key); // depends on control dependency: [if], data = [none]
}
}
// Register datastream.
if (tempID == null) {
timeStamp = new Timestamp(new Date().getTime()); // depends on control dependency: [if], data = [none]
tempID = timeStamp.toString() + ":" + counter++; // depends on control dependency: [if], data = [none]
DatastreamMediation dm = new DatastreamMediation();
dm.mediatedDatastreamID = tempID; // depends on control dependency: [if], data = [none]
dm.dsLocation = dsLocation; // depends on control dependency: [if], data = [none]
dm.dsControlGroupType = dsControlGroupType; // depends on control dependency: [if], data = [none]
dm.methodName = methodName; // depends on control dependency: [if], data = [none]
// See if datastream reference is to fedora server itself or an
// external location.
// M and X type datastreams always reference fedora server. With
// E type datastreams
// we must examine URL to see if this is referencing a remote
// datastream or is
// simply a callback to the fedora server. If the reference is
// remote, then use
// the role of the backend service that will make a callback for
// this datastream.
// If the referenc s to the fedora server, use the special role
// of "fedoraInternalCall-1" to
// denote that the callback will come from the fedora server
// itself.
String beServiceRole = null;
if (ServerUtility.isURLFedoraServer(dsLocation)
|| dsControlGroupType.equals("M")
|| dsControlGroupType.equals("X")) {
beServiceRole = BackendPolicies.FEDORA_INTERNAL_CALL; // depends on control dependency: [if], data = [none]
} else {
beServiceRole = beServiceCallbackRole; // depends on control dependency: [if], data = [none]
}
// Store beSecurity info in hash
Hashtable<String, String> beHash = m_beSS.getSecuritySpec(
beServiceRole, methodName);
boolean beServiceCallbackBasicAuth = Boolean.parseBoolean(
beHash.get("callbackBasicAuth"));
boolean beServiceCallBasicAuth = Boolean.parseBoolean(
beHash.get("callBasicAuth"));
boolean beServiceCallbackSSL = Boolean.parseBoolean(
beHash.get("callbackSSL"));
boolean beServiceCallSSL = Boolean.parseBoolean(
beHash.get("callSSL"));
String beServiceCallUsername = beHash.get("callUsername");
String beServiceCallPassword = beHash.get("callPassword");
if (logger.isDebugEnabled()) {
logger.debug(
"******************Registering datastream dsLocation: {}", // depends on control dependency: [if], data = [none]
dsLocation);
logger.debug(
"******************Registering datastream dsControlGroupType: {}", // depends on control dependency: [if], data = [none]
dsControlGroupType);
logger.debug(
"******************Registering datastream beServiceRole: {}", // depends on control dependency: [if], data = [none]
beServiceRole);
logger.debug(
"******************Registering datastream beServiceCallbackBasicAuth: {}", // depends on control dependency: [if], data = [none]
beServiceCallbackBasicAuth);
logger.debug(
"******************Registering datastream beServiceCallBasicAuth: {}", // depends on control dependency: [if], data = [none]
beServiceCallBasicAuth);
logger.debug(
"******************Registering datastream beServiceCallbackSSL: {}", // depends on control dependency: [if], data = [none]
beServiceCallbackSSL);
logger.debug(
"******************Registering datastream beServiceCallSSL: {}", // depends on control dependency: [if], data = [none]
beServiceCallSSL);
logger.debug(
"******************Registering datastream beServiceCallUsername: {}", // depends on control dependency: [if], data = [none]
beServiceCallUsername);
logger.debug(
"******************Registering datastream beServiceCallPassword: {}", // depends on control dependency: [if], data = [none]
beServiceCallPassword);
}
dm.callbackRole = beServiceRole; // depends on control dependency: [if], data = [none]
dm.callUsername = beServiceCallUsername; // depends on control dependency: [if], data = [none]
dm.callPassword = beServiceCallPassword; // depends on control dependency: [if], data = [none]
dm.callbackBasicAuth = beServiceCallbackBasicAuth; // depends on control dependency: [if], data = [none]
dm.callBasicAuth = beServiceCallBasicAuth; // depends on control dependency: [if], data = [none]
dm.callbackSSL = beServiceCallbackSSL; // depends on control dependency: [if], data = [none]
dm.callSSL = beServiceCallSSL; // depends on control dependency: [if], data = [none]
dsRegistry.put(tempID, dm); // depends on control dependency: [if], data = [(tempID]
logger.debug("DatastreammediationKey added to Hash: " + tempID); // depends on control dependency: [if], data = [none]
}
} catch (Throwable th) {
throw new DisseminationException("[DisseminationService] register"
+ "DatastreamLocation: "
+ "returned an error. The underlying error was a "
+ th.getClass().getName() + " The message " + "was \""
+ th.getMessage() + "\" .");
}
// Replace the blank between date and time with the character "T".
return tempID.replace(' ', 'T');
} }
|
public class class_name {
public DataSource createDataSource(DataMediaSource dataMediaSource) {
Assert.notNull(dataMediaSource);
DbMediaSource dbMediaSource = (DbMediaSource) dataMediaSource;
// 扩展功能,可以自定义一些自己实现的 dataSource
DataSource customDataSource = preCreate(0L, dbMediaSource);
if (customDataSource != null) {
return customDataSource;
}
return createDataSource(dbMediaSource.getUrl(),
dbMediaSource.getUsername(),
dbMediaSource.getPassword(),
dbMediaSource.getDriver(),
dbMediaSource.getType(),
dbMediaSource.getEncode());
} }
|
public class class_name {
public DataSource createDataSource(DataMediaSource dataMediaSource) {
Assert.notNull(dataMediaSource);
DbMediaSource dbMediaSource = (DbMediaSource) dataMediaSource;
// 扩展功能,可以自定义一些自己实现的 dataSource
DataSource customDataSource = preCreate(0L, dbMediaSource);
if (customDataSource != null) {
return customDataSource; // depends on control dependency: [if], data = [none]
}
return createDataSource(dbMediaSource.getUrl(),
dbMediaSource.getUsername(),
dbMediaSource.getPassword(),
dbMediaSource.getDriver(),
dbMediaSource.getType(),
dbMediaSource.getEncode());
} }
|
public class class_name {
protected static ByteBuffer getRgba(Image image) {
int w = (int) image.width(), h = (int) image.height(), size = w * h;
int[] rawPixels = new int[size];
ByteBuffer pixels = ByteBuffer.allocateDirect(size * 4);
pixels.order(ByteOrder.nativeOrder());
IntBuffer rgba = pixels.asIntBuffer();
image.getRgb(0, 0, w, h, rawPixels, 0, w);
for (int i = 0; i < size; i++) {
int argb = rawPixels[i];
// Order is inverted because this is read as a byte array, and we store intel ints.
rgba.put(i, ((argb >> 16) & 0x0ff) | (argb & 0x0ff00ff00) | ((argb & 0xff) << 16));
}
return pixels;
} }
|
public class class_name {
protected static ByteBuffer getRgba(Image image) {
int w = (int) image.width(), h = (int) image.height(), size = w * h;
int[] rawPixels = new int[size];
ByteBuffer pixels = ByteBuffer.allocateDirect(size * 4);
pixels.order(ByteOrder.nativeOrder());
IntBuffer rgba = pixels.asIntBuffer();
image.getRgb(0, 0, w, h, rawPixels, 0, w);
for (int i = 0; i < size; i++) {
int argb = rawPixels[i];
// Order is inverted because this is read as a byte array, and we store intel ints.
rgba.put(i, ((argb >> 16) & 0x0ff) | (argb & 0x0ff00ff00) | ((argb & 0xff) << 16)); // depends on control dependency: [for], data = [i]
}
return pixels;
} }
|
public class class_name {
public static synchronized Pool getPoolForLocator(JMX jmx)
{
String locatorsPoolName = jmx.getHost()+"["+jmx.getPort()+"]";
Pool pool = PoolManager.find(locatorsPoolName);
if(pool != null)
return pool;
PoolFactory poolFactory = PoolManager.createFactory();
try
{
int port = getLocatorPort(jmx);
poolFactory= poolFactory.addLocator(jmx.getHost(), port);
return poolFactory.create(locatorsPoolName);
}
catch (Exception e)
{
throw new RuntimeException("Unable to create pool for locator:"+jmx.getHost()+" error:"+e.getMessage(),e);
}
} }
|
public class class_name {
public static synchronized Pool getPoolForLocator(JMX jmx)
{
String locatorsPoolName = jmx.getHost()+"["+jmx.getPort()+"]";
Pool pool = PoolManager.find(locatorsPoolName);
if(pool != null)
return pool;
PoolFactory poolFactory = PoolManager.createFactory();
try
{
int port = getLocatorPort(jmx);
poolFactory= poolFactory.addLocator(jmx.getHost(), port); // depends on control dependency: [try], data = [none]
return poolFactory.create(locatorsPoolName); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
throw new RuntimeException("Unable to create pool for locator:"+jmx.getHost()+" error:"+e.getMessage(),e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static Level parse(final String property, final Level defaultValue) {
if (property == null) {
return defaultValue;
} else {
try {
return Level.valueOf(property.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException ex) {
InternalLogger.log(Level.ERROR, "Illegal severity level: " + property);
return defaultValue;
}
}
} }
|
public class class_name {
private static Level parse(final String property, final Level defaultValue) {
if (property == null) {
return defaultValue; // depends on control dependency: [if], data = [none]
} else {
try {
return Level.valueOf(property.toUpperCase(Locale.ROOT)); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException ex) {
InternalLogger.log(Level.ERROR, "Illegal severity level: " + property);
return defaultValue;
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
private static MavenCoordinates findCompileDependency(String zipEntryPath, String groupId) {
int apiNameIndex = zipEntryPath.indexOf(groupId);
int extensionIndex = zipEntryPath.lastIndexOf(".jar");
if (apiNameIndex >= 0 && extensionIndex >= 0) {
String fileNameWithoutExtension = zipEntryPath.substring(apiNameIndex, extensionIndex);
String artifactId = fileNameWithoutExtension.substring(0, fileNameWithoutExtension.lastIndexOf("_"));
String versionId = fileNameWithoutExtension.substring(fileNameWithoutExtension.lastIndexOf("_")+1, fileNameWithoutExtension.length());
MavenCoordinates coordinates = new MavenCoordinates(groupId, artifactId, versionId);
System.out.println("Found compile dependency: " + coordinates);
return coordinates;
}
return null;
} }
|
public class class_name {
private static MavenCoordinates findCompileDependency(String zipEntryPath, String groupId) {
int apiNameIndex = zipEntryPath.indexOf(groupId);
int extensionIndex = zipEntryPath.lastIndexOf(".jar");
if (apiNameIndex >= 0 && extensionIndex >= 0) {
String fileNameWithoutExtension = zipEntryPath.substring(apiNameIndex, extensionIndex);
String artifactId = fileNameWithoutExtension.substring(0, fileNameWithoutExtension.lastIndexOf("_"));
String versionId = fileNameWithoutExtension.substring(fileNameWithoutExtension.lastIndexOf("_")+1, fileNameWithoutExtension.length());
MavenCoordinates coordinates = new MavenCoordinates(groupId, artifactId, versionId);
System.out.println("Found compile dependency: " + coordinates); // depends on control dependency: [if], data = [none]
return coordinates; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public final String getVariableNameFromIndex(int num) {
int index = getVariableIndex(num);
if (index >= 0) {
return names[index];
} else {
return null;
}
} }
|
public class class_name {
public final String getVariableNameFromIndex(int num) {
int index = getVariableIndex(num);
if (index >= 0) {
return names[index]; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String getFormLoginURL(HttpServletRequest req, WebRequest webRequest, WebAppSecurityConfig webAppSecConfig) {
FormLoginConfiguration formLoginConfig = webRequest.getFormLoginConfiguration();
String inURL = null;
String contextPath = null;
// if the global login is set as CERT and the fallback is allowed to FORM,
// use global form login.
String authMech = webAppSecConfig.getOverrideHttpAuthMethod();
if (authMech != null && authMech.equals("CLIENT_CERT") && webAppSecConfig.getAllowFailOverToFormLogin()) {
inURL = webAppSecConfig.getLoginFormURL();
} else if (formLoginConfig != null) {
inURL = formLoginConfig.getLoginPage();
if (inURL != null)
contextPath = req.getContextPath();
else
inURL = webAppSecConfig.getLoginFormURL();
}
return buildFormLoginURL(req, inURL, contextPath);
} }
|
public class class_name {
private String getFormLoginURL(HttpServletRequest req, WebRequest webRequest, WebAppSecurityConfig webAppSecConfig) {
FormLoginConfiguration formLoginConfig = webRequest.getFormLoginConfiguration();
String inURL = null;
String contextPath = null;
// if the global login is set as CERT and the fallback is allowed to FORM,
// use global form login.
String authMech = webAppSecConfig.getOverrideHttpAuthMethod();
if (authMech != null && authMech.equals("CLIENT_CERT") && webAppSecConfig.getAllowFailOverToFormLogin()) {
inURL = webAppSecConfig.getLoginFormURL(); // depends on control dependency: [if], data = [none]
} else if (formLoginConfig != null) {
inURL = formLoginConfig.getLoginPage(); // depends on control dependency: [if], data = [none]
if (inURL != null)
contextPath = req.getContextPath();
else
inURL = webAppSecConfig.getLoginFormURL();
}
return buildFormLoginURL(req, inURL, contextPath);
} }
|
public class class_name {
public RouteBuilder options(){
if(!methods.contains(HttpMethod.OPTIONS)){
methods.add(HttpMethod.OPTIONS);
}
return this;
} }
|
public class class_name {
public RouteBuilder options(){
if(!methods.contains(HttpMethod.OPTIONS)){
methods.add(HttpMethod.OPTIONS); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation,
boolean isStatic, List<Throwable> errors) {
List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation);
for (FrameworkMethod eachTestMethod : methods) {
eachTestMethod.validatePublicVoidNoArg(isStatic, errors);
}
} }
|
public class class_name {
protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation,
boolean isStatic, List<Throwable> errors) {
List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation);
for (FrameworkMethod eachTestMethod : methods) {
eachTestMethod.validatePublicVoidNoArg(isStatic, errors); // depends on control dependency: [for], data = [eachTestMethod]
}
} }
|
public class class_name {
public int solve(int[] prefix, SolutionAcceptor<ColumnName> output) {
List<Node<ColumnName>> choices = new ArrayList<Node<ColumnName>>();
for(int i=0; i < prefix.length; ++i) {
choices.add(advance(prefix[i]));
}
int result = search(choices, output);
for(int i=prefix.length-1; i >=0; --i) {
rollback(choices.get(i));
}
return result;
} }
|
public class class_name {
public int solve(int[] prefix, SolutionAcceptor<ColumnName> output) {
List<Node<ColumnName>> choices = new ArrayList<Node<ColumnName>>();
for(int i=0; i < prefix.length; ++i) {
choices.add(advance(prefix[i])); // depends on control dependency: [for], data = [i]
}
int result = search(choices, output);
for(int i=prefix.length-1; i >=0; --i) {
rollback(choices.get(i)); // depends on control dependency: [for], data = [i]
}
return result;
} }
|
public class class_name {
public static boolean moveFilesFromDirectoryToDirectory(File origDir,
File destDir,
File baseDir) {
if (!origDir.exists()) {
return false;
}
if (!baseDir.exists()) {
return false;
}
if (!destDir.exists()) {
destDir.mkdirs();
}
File array[]=origDir.listFiles();
if ( array!= null) {
for (File file : array) {
File destFile = new File(destDir, file.getName());
if (file.isDirectory()) {
moveFilesFromDirectoryToDirectory(file, destFile,
baseDir);
} else {
if (!copyFile(file, destFile)) {
return false;
}
}
}
} else {
return false;
}
if (deleteFilesOfDir(origDir)) {
cleanParentDirectories(origDir, baseDir);
return true;
} else {
return false;
}
} }
|
public class class_name {
public static boolean moveFilesFromDirectoryToDirectory(File origDir,
File destDir,
File baseDir) {
if (!origDir.exists()) {
return false;
// depends on control dependency: [if], data = [none]
}
if (!baseDir.exists()) {
return false;
// depends on control dependency: [if], data = [none]
}
if (!destDir.exists()) {
destDir.mkdirs();
// depends on control dependency: [if], data = [none]
}
File array[]=origDir.listFiles();
if ( array!= null) {
for (File file : array) {
File destFile = new File(destDir, file.getName());
if (file.isDirectory()) {
moveFilesFromDirectoryToDirectory(file, destFile,
baseDir);
// depends on control dependency: [if], data = [none]
} else {
if (!copyFile(file, destFile)) {
return false;
// depends on control dependency: [if], data = [none]
}
}
}
} else {
return false;
// depends on control dependency: [if], data = [none]
}
if (deleteFilesOfDir(origDir)) {
cleanParentDirectories(origDir, baseDir);
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
} else {
return false;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void register(Monitor<?> monitor) {
try {
List<MonitorMBean> beans = MonitorMBean.createMBeans(name, monitor, mapper);
for (MonitorMBean bean : beans) {
register(bean.getObjectName(), bean);
}
monitors.put(monitor.getConfig(), monitor);
updatePending.set(true);
} catch (Exception e) {
LOG.warn("Unable to register Monitor:" + monitor.getConfig(), e);
}
} }
|
public class class_name {
@Override
public void register(Monitor<?> monitor) {
try {
List<MonitorMBean> beans = MonitorMBean.createMBeans(name, monitor, mapper);
for (MonitorMBean bean : beans) {
register(bean.getObjectName(), bean); // depends on control dependency: [for], data = [bean]
}
monitors.put(monitor.getConfig(), monitor); // depends on control dependency: [try], data = [none]
updatePending.set(true); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.warn("Unable to register Monitor:" + monitor.getConfig(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static Annotation[] readAnnotations(ValueExpression p_expression, UIComponent p_component) {
FacesContext context = FacesContext.getCurrentInstance();
ELContext elContext = context.getELContext();
try {
ValueReference valueReference = p_expression.getValueReference(elContext);
Object base;
if (null == valueReference) {
base = evaluteBaseForMojarra(elContext, p_expression);
} else {
base = valueReference.getBase();
}
if (null == base) {
return null;
}
Field declaredField = getField(base, p_expression.getExpressionString());
if (null != declaredField) {
return declaredField.getAnnotations();
}
Method getter = getGetter(base, p_expression.getExpressionString());
if (null != getter) {
return getter.getAnnotations();
}
} catch (PropertyNotFoundException ex) {
// this happens if a bean is null. That's a legal state, so suffice it to return no annotation.
}
return null;
} }
|
public class class_name {
public static Annotation[] readAnnotations(ValueExpression p_expression, UIComponent p_component) {
FacesContext context = FacesContext.getCurrentInstance();
ELContext elContext = context.getELContext();
try {
ValueReference valueReference = p_expression.getValueReference(elContext);
Object base;
if (null == valueReference) {
base = evaluteBaseForMojarra(elContext, p_expression); // depends on control dependency: [if], data = [none]
} else {
base = valueReference.getBase(); // depends on control dependency: [if], data = [none]
}
if (null == base) {
return null; // depends on control dependency: [if], data = [none]
}
Field declaredField = getField(base, p_expression.getExpressionString());
if (null != declaredField) {
return declaredField.getAnnotations(); // depends on control dependency: [if], data = [none]
}
Method getter = getGetter(base, p_expression.getExpressionString());
if (null != getter) {
return getter.getAnnotations(); // depends on control dependency: [if], data = [none]
}
} catch (PropertyNotFoundException ex) {
// this happens if a bean is null. That's a legal state, so suffice it to return no annotation.
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public void schedule(CmsValidationController action) {
if (m_idle) {
m_idle = false;
action.internalStartValidation();
} else {
m_actions.add(action);
}
} }
|
public class class_name {
public void schedule(CmsValidationController action) {
if (m_idle) {
m_idle = false; // depends on control dependency: [if], data = [none]
action.internalStartValidation(); // depends on control dependency: [if], data = [none]
} else {
m_actions.add(action); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(AuthenticationResultType authenticationResultType, ProtocolMarshaller protocolMarshaller) {
if (authenticationResultType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(authenticationResultType.getAccessToken(), ACCESSTOKEN_BINDING);
protocolMarshaller.marshall(authenticationResultType.getExpiresIn(), EXPIRESIN_BINDING);
protocolMarshaller.marshall(authenticationResultType.getTokenType(), TOKENTYPE_BINDING);
protocolMarshaller.marshall(authenticationResultType.getRefreshToken(), REFRESHTOKEN_BINDING);
protocolMarshaller.marshall(authenticationResultType.getIdToken(), IDTOKEN_BINDING);
protocolMarshaller.marshall(authenticationResultType.getNewDeviceMetadata(), NEWDEVICEMETADATA_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(AuthenticationResultType authenticationResultType, ProtocolMarshaller protocolMarshaller) {
if (authenticationResultType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(authenticationResultType.getAccessToken(), ACCESSTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authenticationResultType.getExpiresIn(), EXPIRESIN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authenticationResultType.getTokenType(), TOKENTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authenticationResultType.getRefreshToken(), REFRESHTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authenticationResultType.getIdToken(), IDTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(authenticationResultType.getNewDeviceMetadata(), NEWDEVICEMETADATA_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void writeStrictFormatting(List<Object> list, Object paramExtractor, String scriptToUse) {
if (HAS_SCRIPT) {
/*
* {
* "script":{
* "inline": "...",
* "lang": "...",
* "params": ...,
* },
* "upsert": {...}
* }
*/
list.add(scriptToUse);
if (HAS_LANG) {
list.add(SCRIPT_LANG_5X);
}
if (paramExtractor != null) {
list.add(",\"params\":");
list.add(paramExtractor);
}
list.add("}");
if (UPSERT) {
list.add(",\"upsert\":");
}
} else {
/*
* {
* "doc_as_upsert": true,
* "doc": {...}
* }
*/
list.add("{");
if (UPSERT) {
list.add("\"doc_as_upsert\":true,");
}
list.add("\"doc\":");
}
} }
|
public class class_name {
private void writeStrictFormatting(List<Object> list, Object paramExtractor, String scriptToUse) {
if (HAS_SCRIPT) {
/*
* {
* "script":{
* "inline": "...",
* "lang": "...",
* "params": ...,
* },
* "upsert": {...}
* }
*/
list.add(scriptToUse); // depends on control dependency: [if], data = [none]
if (HAS_LANG) {
list.add(SCRIPT_LANG_5X); // depends on control dependency: [if], data = [none]
}
if (paramExtractor != null) {
list.add(",\"params\":"); // depends on control dependency: [if], data = [none]
list.add(paramExtractor); // depends on control dependency: [if], data = [(paramExtractor]
}
list.add("}"); // depends on control dependency: [if], data = [none]
if (UPSERT) {
list.add(",\"upsert\":"); // depends on control dependency: [if], data = [none]
}
} else {
/*
* {
* "doc_as_upsert": true,
* "doc": {...}
* }
*/
list.add("{"); // depends on control dependency: [if], data = [none]
if (UPSERT) {
list.add("\"doc_as_upsert\":true,"); // depends on control dependency: [if], data = [none]
}
list.add("\"doc\":"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Observable<ServiceResponse<Void>> deletePredictionWithServiceResponseAsync(UUID projectId, List<String> ids) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (ids == null) {
throw new IllegalArgumentException("Parameter ids is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
Validator.validate(ids);
String idsConverted = this.client.serializerAdapter().serializeList(ids, CollectionFormat.CSV);
return service.deletePrediction(projectId, idsConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = deletePredictionDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Void>> deletePredictionWithServiceResponseAsync(UUID projectId, List<String> ids) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (ids == null) {
throw new IllegalArgumentException("Parameter ids is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
Validator.validate(ids);
String idsConverted = this.client.serializerAdapter().serializeList(ids, CollectionFormat.CSV);
return service.deletePrediction(projectId, idsConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = deletePredictionDelegate(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 String[] readTitle() {
try {
reader.readLine();
return Strings.split(reader.readLine(), ",");
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
} }
|
public class class_name {
public String[] readTitle() {
try {
reader.readLine(); // depends on control dependency: [try], data = [none]
return Strings.split(reader.readLine(), ","); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static CmsMenuItemVisibilityMode visibilityCheckHasModule(String name) {
if (OpenCms.getModuleManager().hasModule(name)) {
return CmsMenuItemVisibilityMode.VISIBILITY_ACTIVE;
} else {
return CmsMenuItemVisibilityMode.VISIBILITY_INVISIBLE;
}
} }
|
public class class_name {
public static CmsMenuItemVisibilityMode visibilityCheckHasModule(String name) {
if (OpenCms.getModuleManager().hasModule(name)) {
return CmsMenuItemVisibilityMode.VISIBILITY_ACTIVE; // depends on control dependency: [if], data = [none]
} else {
return CmsMenuItemVisibilityMode.VISIBILITY_INVISIBLE; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void next(final boolean skipSlideStep) {
synchronized (this) {
// Try to display the next slide step first
// If no slide step is remaining, display the next slide
if (skipSlideStep || this.selectedSlideModel.nextStep() && this.slidePosition < getPresentationService().getPresentation().getSlides().getSlide().size() - 1) {
this.slidePosition = Math.min(this.slidePosition + 1, getPresentationService().getPresentation().getSlides().getSlide().size() - 1);
displaySlide(getPresentationService().getPresentation().getSlides().getSlide().get(this.slidePosition), false);
}
}
} }
|
public class class_name {
public void next(final boolean skipSlideStep) {
synchronized (this) {
// Try to display the next slide step first
// If no slide step is remaining, display the next slide
if (skipSlideStep || this.selectedSlideModel.nextStep() && this.slidePosition < getPresentationService().getPresentation().getSlides().getSlide().size() - 1) {
this.slidePosition = Math.min(this.slidePosition + 1, getPresentationService().getPresentation().getSlides().getSlide().size() - 1); // depends on control dependency: [if], data = [getPresentationService().getPresentation().getSlides().getSlide().size() - 1)]
displaySlide(getPresentationService().getPresentation().getSlides().getSlide().get(this.slidePosition), false); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static <T extends ViewTraverse<T>> String[] replaceDataReferences(
final String[] args,
final MultiDataContext<T, DataContext> data,
final T currentContext,
final BiFunction<Integer, String, T> viewMap,
final Converter<String, String> converter,
boolean failIfUnexpanded,
boolean blankIfUnexpanded
)
{
if (null == data) {
return args;
}
if (null == args || args.length < 1) {
return args;
}
final String[] newargs = new String[args.length];
for (int i = 0; i < args.length; i++) {
final String arg = args[i];
newargs[i] = replaceDataReferences(
arg,
data,
currentContext,
viewMap,
converter,
failIfUnexpanded,
blankIfUnexpanded
);
}
return newargs;
} }
|
public class class_name {
public static <T extends ViewTraverse<T>> String[] replaceDataReferences(
final String[] args,
final MultiDataContext<T, DataContext> data,
final T currentContext,
final BiFunction<Integer, String, T> viewMap,
final Converter<String, String> converter,
boolean failIfUnexpanded,
boolean blankIfUnexpanded
)
{
if (null == data) {
return args; // depends on control dependency: [if], data = [none]
}
if (null == args || args.length < 1) {
return args; // depends on control dependency: [if], data = [none]
}
final String[] newargs = new String[args.length];
for (int i = 0; i < args.length; i++) {
final String arg = args[i];
newargs[i] = replaceDataReferences(
arg,
data,
currentContext,
viewMap,
converter,
failIfUnexpanded,
blankIfUnexpanded
); // depends on control dependency: [for], data = [none]
}
return newargs;
} }
|
public class class_name {
public static double[] parseCoordinateString(String coordinatesString, int numberOfCoordinates) {
StringTokenizer stringTokenizer = new StringTokenizer(coordinatesString, DELIMITER, true);
boolean isDelimiter = true;
List<String> tokens = new ArrayList<>(numberOfCoordinates);
while (stringTokenizer.hasMoreTokens()) {
String token = stringTokenizer.nextToken();
isDelimiter = !isDelimiter;
if (isDelimiter) {
continue;
}
tokens.add(token);
}
if (isDelimiter) {
throw new IllegalArgumentException("invalid coordinate delimiter: " + coordinatesString);
} else if (tokens.size() != numberOfCoordinates) {
throw new IllegalArgumentException("invalid number of coordinate values: " + coordinatesString);
}
double[] coordinates = new double[numberOfCoordinates];
for (int i = 0; i < numberOfCoordinates; ++i) {
coordinates[i] = Double.parseDouble(tokens.get(i));
}
return coordinates;
} }
|
public class class_name {
public static double[] parseCoordinateString(String coordinatesString, int numberOfCoordinates) {
StringTokenizer stringTokenizer = new StringTokenizer(coordinatesString, DELIMITER, true);
boolean isDelimiter = true;
List<String> tokens = new ArrayList<>(numberOfCoordinates);
while (stringTokenizer.hasMoreTokens()) {
String token = stringTokenizer.nextToken();
isDelimiter = !isDelimiter; // depends on control dependency: [while], data = [none]
if (isDelimiter) {
continue;
}
tokens.add(token); // depends on control dependency: [while], data = [none]
}
if (isDelimiter) {
throw new IllegalArgumentException("invalid coordinate delimiter: " + coordinatesString);
} else if (tokens.size() != numberOfCoordinates) {
throw new IllegalArgumentException("invalid number of coordinate values: " + coordinatesString);
}
double[] coordinates = new double[numberOfCoordinates];
for (int i = 0; i < numberOfCoordinates; ++i) {
coordinates[i] = Double.parseDouble(tokens.get(i)); // depends on control dependency: [for], data = [i]
}
return coordinates;
} }
|
public class class_name {
protected Object executeEvents(final EventType _eventType,
final TargetMode _targetMode)
throws EFapsException
{
Object ret = null;
if (this.fieldId > 0 && getField().hasEvents(_eventType)) {
final List<EventDefinition> events = getField().getEvents(_eventType);
final StringBuilder html = new StringBuilder();
if (events != null) {
final Parameter parameter = new Parameter();
parameter.put(ParameterValues.ACCESSMODE, _targetMode);
parameter.put(ParameterValues.INSTANCE, this.instance);
parameter.put(ParameterValues.CLASS, this.classObject);
parameter.put(ParameterValues.UIOBJECT, this);
parameter.put(ParameterValues.CALL_INSTANCE, getCallInstance());
parameter.put(ParameterValues.REQUEST_INSTANCES, getRequestInstances());
if (parameter.get(ParameterValues.PARAMETERS) == null) {
parameter.put(ParameterValues.PARAMETERS, Context.getThreadContext().getParameters());
}
for (final EventDefinition evenDef : events) {
final Return retu = evenDef.execute(parameter);
if (retu.get(ReturnValues.SNIPLETT) != null) {
html.append(retu.get(ReturnValues.SNIPLETT));
} else if (retu.get(ReturnValues.VALUES) != null) {
ret = retu.get(ReturnValues.VALUES);
if (retu.get(ReturnValues.INSTANCE) != null) {
final Instance inst = (Instance) retu.get(ReturnValues.INSTANCE);
if (inst != null && inst.isValid()) {
setInstance(inst);
} else {
setInstance(null);
}
}
}
}
}
if (html.length() > 0) {
ret = html.toString();
}
}
return ret;
} }
|
public class class_name {
protected Object executeEvents(final EventType _eventType,
final TargetMode _targetMode)
throws EFapsException
{
Object ret = null;
if (this.fieldId > 0 && getField().hasEvents(_eventType)) {
final List<EventDefinition> events = getField().getEvents(_eventType);
final StringBuilder html = new StringBuilder();
if (events != null) {
final Parameter parameter = new Parameter();
parameter.put(ParameterValues.ACCESSMODE, _targetMode); // depends on control dependency: [if], data = [none]
parameter.put(ParameterValues.INSTANCE, this.instance); // depends on control dependency: [if], data = [none]
parameter.put(ParameterValues.CLASS, this.classObject); // depends on control dependency: [if], data = [none]
parameter.put(ParameterValues.UIOBJECT, this); // depends on control dependency: [if], data = [none]
parameter.put(ParameterValues.CALL_INSTANCE, getCallInstance()); // depends on control dependency: [if], data = [none]
parameter.put(ParameterValues.REQUEST_INSTANCES, getRequestInstances()); // depends on control dependency: [if], data = [none]
if (parameter.get(ParameterValues.PARAMETERS) == null) {
parameter.put(ParameterValues.PARAMETERS, Context.getThreadContext().getParameters()); // depends on control dependency: [if], data = [none]
}
for (final EventDefinition evenDef : events) {
final Return retu = evenDef.execute(parameter);
if (retu.get(ReturnValues.SNIPLETT) != null) {
html.append(retu.get(ReturnValues.SNIPLETT)); // depends on control dependency: [if], data = [(retu.get(ReturnValues.SNIPLETT)]
} else if (retu.get(ReturnValues.VALUES) != null) {
ret = retu.get(ReturnValues.VALUES); // depends on control dependency: [if], data = [none]
if (retu.get(ReturnValues.INSTANCE) != null) {
final Instance inst = (Instance) retu.get(ReturnValues.INSTANCE);
if (inst != null && inst.isValid()) {
setInstance(inst); // depends on control dependency: [if], data = [(inst]
} else {
setInstance(null); // depends on control dependency: [if], data = [none]
}
}
}
}
}
if (html.length() > 0) {
ret = html.toString(); // depends on control dependency: [if], data = [none]
}
}
return ret;
} }
|
public class class_name {
private void parseLinkValue(DBObject owningObj,
UNode linkNode,
FieldDefinition linkFieldDef) {
// Prerequisites:
assert owningObj != null;
assert linkNode != null;
assert linkFieldDef != null;
assert linkFieldDef.isLinkField();
TableDefinition tableDef = linkFieldDef.getTableDef();
// Value should be an array, though it could be a map with one child.
Utils.require(linkNode.isCollection(), "Value of link field should be a collection: " + linkNode);
// Iterate through child nodes.
TableDefinition extentTableDef =
tableDef.getAppDef().getTableDef(linkFieldDef.getLinkExtent());
for (UNode childNode : linkNode.getMemberList()) {
// Ensure this element is "doc" node.
Utils.require(childNode.getName().equals("doc"),
"link field array values should be 'doc' objects: " + childNode);
// Recurse and build a DBObject from the doc node.
DBObject linkedObject = parseObject(extentTableDef, childNode);
// Add the linked object to the cache and add its object ID to the set.
String objID = linkedObject.getObjectID();
cacheLinkedObject(owningObj.getObjectID(), linkFieldDef.getName(), linkedObject);
owningObj.addFieldValues(linkFieldDef.getName(), Arrays.asList(objID));
}
} }
|
public class class_name {
private void parseLinkValue(DBObject owningObj,
UNode linkNode,
FieldDefinition linkFieldDef) {
// Prerequisites:
assert owningObj != null;
assert linkNode != null;
assert linkFieldDef != null;
assert linkFieldDef.isLinkField();
TableDefinition tableDef = linkFieldDef.getTableDef();
// Value should be an array, though it could be a map with one child.
Utils.require(linkNode.isCollection(), "Value of link field should be a collection: " + linkNode);
// Iterate through child nodes.
TableDefinition extentTableDef =
tableDef.getAppDef().getTableDef(linkFieldDef.getLinkExtent());
for (UNode childNode : linkNode.getMemberList()) {
// Ensure this element is "doc" node.
Utils.require(childNode.getName().equals("doc"),
"link field array values should be 'doc' objects: " + childNode);
// depends on control dependency: [for], data = [childNode]
// Recurse and build a DBObject from the doc node.
DBObject linkedObject = parseObject(extentTableDef, childNode);
// Add the linked object to the cache and add its object ID to the set.
String objID = linkedObject.getObjectID();
cacheLinkedObject(owningObj.getObjectID(), linkFieldDef.getName(), linkedObject);
// depends on control dependency: [for], data = [none]
owningObj.addFieldValues(linkFieldDef.getName(), Arrays.asList(objID));
// depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public static SharedFlowController getSharedFlow( String sharedFlowClassName, HttpServletRequest request,
ServletContext servletContext )
{
StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
HttpServletRequest unwrappedRequest = unwrapMultipart( request );
RequestContext rc = new RequestContext( unwrappedRequest, null );
String attrName = ScopedServletUtils.getScopedSessionAttrName(InternalConstants.SHARED_FLOW_ATTR_PREFIX
+ sharedFlowClassName, request);
SharedFlowController sf = (SharedFlowController) sh.getAttribute(rc, attrName);
if (sf != null) {
sf.reinitializeIfNecessary(request, null, servletContext);
}
return sf;
} }
|
public class class_name {
public static SharedFlowController getSharedFlow( String sharedFlowClassName, HttpServletRequest request,
ServletContext servletContext )
{
StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
HttpServletRequest unwrappedRequest = unwrapMultipart( request );
RequestContext rc = new RequestContext( unwrappedRequest, null );
String attrName = ScopedServletUtils.getScopedSessionAttrName(InternalConstants.SHARED_FLOW_ATTR_PREFIX
+ sharedFlowClassName, request);
SharedFlowController sf = (SharedFlowController) sh.getAttribute(rc, attrName);
if (sf != null) {
sf.reinitializeIfNecessary(request, null, servletContext); // depends on control dependency: [if], data = [none]
}
return sf;
} }
|
public class class_name {
void appendStrings(JCTree tree) {
tree = TreeInfo.skipParens(tree);
if (tree.hasTag(PLUS) && tree.type.constValue() == null) {
JCBinary op = (JCBinary) tree;
if (op.operator.kind == MTH &&
((OperatorSymbol) op.operator).opcode == string_add) {
appendStrings(op.lhs);
appendStrings(op.rhs);
return;
}
}
genExpr(tree, tree.type).load();
appendString(tree);
} }
|
public class class_name {
void appendStrings(JCTree tree) {
tree = TreeInfo.skipParens(tree);
if (tree.hasTag(PLUS) && tree.type.constValue() == null) {
JCBinary op = (JCBinary) tree;
if (op.operator.kind == MTH &&
((OperatorSymbol) op.operator).opcode == string_add) {
appendStrings(op.lhs); // depends on control dependency: [if], data = [none]
appendStrings(op.rhs); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
genExpr(tree, tree.type).load();
appendString(tree);
} }
|
public class class_name {
public void start(JBakeConfiguration config) {
try {
FileSystemManager fsMan = VFS.getManager();
FileObject listenPath = fsMan.resolveFile(config.getContentFolder().toURI());
FileObject templateListenPath = fsMan.resolveFile(config.getTemplateFolder().toURI());
FileObject assetPath = fsMan.resolveFile(config.getAssetFolder().toURI());
logger.info("Watching for (content, template, asset) changes in [{}]", config.getSourceFolder().getPath());
DefaultFileMonitor monitor = new DefaultFileMonitor(new CustomFSChangeListener(config));
monitor.setRecursive(true);
monitor.addFile(listenPath);
monitor.addFile(templateListenPath);
monitor.addFile(assetPath);
monitor.start();
} catch (FileSystemException e) {
logger.error("Problems watching filesystem changes", e);
}
} }
|
public class class_name {
public void start(JBakeConfiguration config) {
try {
FileSystemManager fsMan = VFS.getManager();
FileObject listenPath = fsMan.resolveFile(config.getContentFolder().toURI());
FileObject templateListenPath = fsMan.resolveFile(config.getTemplateFolder().toURI());
FileObject assetPath = fsMan.resolveFile(config.getAssetFolder().toURI());
logger.info("Watching for (content, template, asset) changes in [{}]", config.getSourceFolder().getPath()); // depends on control dependency: [try], data = [none]
DefaultFileMonitor monitor = new DefaultFileMonitor(new CustomFSChangeListener(config));
monitor.setRecursive(true); // depends on control dependency: [try], data = [none]
monitor.addFile(listenPath); // depends on control dependency: [try], data = [none]
monitor.addFile(templateListenPath); // depends on control dependency: [try], data = [none]
monitor.addFile(assetPath); // depends on control dependency: [try], data = [none]
monitor.start(); // depends on control dependency: [try], data = [none]
} catch (FileSystemException e) {
logger.error("Problems watching filesystem changes", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String joinURIQuery(Map<String, String> uriParams) {
StringBuilder buffer = new StringBuilder();
for (String name : uriParams.keySet()) {
String value = uriParams.get(name);
if (buffer.length() > 0) {
buffer.append("&");
}
buffer.append(Utils.urlEncode(name));
if (!Utils.isEmpty(value)) {
buffer.append("=");
buffer.append(Utils.urlEncode(value));
}
}
return buffer.toString();
} }
|
public class class_name {
public static String joinURIQuery(Map<String, String> uriParams) {
StringBuilder buffer = new StringBuilder();
for (String name : uriParams.keySet()) {
String value = uriParams.get(name);
if (buffer.length() > 0) {
buffer.append("&");
// depends on control dependency: [if], data = [none]
}
buffer.append(Utils.urlEncode(name));
// depends on control dependency: [for], data = [name]
if (!Utils.isEmpty(value)) {
buffer.append("=");
// depends on control dependency: [if], data = [none]
buffer.append(Utils.urlEncode(value));
// depends on control dependency: [if], data = [none]
}
}
return buffer.toString();
} }
|
public class class_name {
private void addChild(String path, String[] value) {
String subname = fetchName(path);
ObjectNaviNode onn = child.get(subname);
if (onn == null) {
onn = new ObjectNaviNode();
}
onn.putPath(path, value);
child.put(subname, onn);
} }
|
public class class_name {
private void addChild(String path, String[] value) {
String subname = fetchName(path);
ObjectNaviNode onn = child.get(subname);
if (onn == null) {
onn = new ObjectNaviNode(); // depends on control dependency: [if], data = [none]
}
onn.putPath(path, value);
child.put(subname, onn);
} }
|
public class class_name {
Symbol findPolymorphicSignatureInstance(Env<AttrContext> env,
final Symbol spMethod,
List<Type> argtypes) {
Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
(MethodSymbol)spMethod, currentResolutionContext, argtypes);
for (Symbol sym : polymorphicSignatureScope.getSymbolsByName(spMethod.name)) {
// Check that there is already a method symbol for the method
// type and owner
if (types.isSameType(mtype, sym.type) &&
spMethod.owner == sym.owner) {
return sym;
}
}
// Create the desired method
// Retain static modifier is to support invocations to
// MethodHandle.linkTo* methods
long flags = ABSTRACT | HYPOTHETICAL |
spMethod.flags() & (Flags.AccessFlags | Flags.STATIC);
Symbol msym = new MethodSymbol(flags, spMethod.name, mtype, spMethod.owner) {
@Override
public Symbol baseSymbol() {
return spMethod;
}
};
if (!mtype.isErroneous()) { // Cache only if kosher.
polymorphicSignatureScope.enter(msym);
}
return msym;
} }
|
public class class_name {
Symbol findPolymorphicSignatureInstance(Env<AttrContext> env,
final Symbol spMethod,
List<Type> argtypes) {
Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
(MethodSymbol)spMethod, currentResolutionContext, argtypes);
for (Symbol sym : polymorphicSignatureScope.getSymbolsByName(spMethod.name)) {
// Check that there is already a method symbol for the method
// type and owner
if (types.isSameType(mtype, sym.type) &&
spMethod.owner == sym.owner) {
return sym; // depends on control dependency: [if], data = [none]
}
}
// Create the desired method
// Retain static modifier is to support invocations to
// MethodHandle.linkTo* methods
long flags = ABSTRACT | HYPOTHETICAL |
spMethod.flags() & (Flags.AccessFlags | Flags.STATIC);
Symbol msym = new MethodSymbol(flags, spMethod.name, mtype, spMethod.owner) {
@Override
public Symbol baseSymbol() {
return spMethod;
}
};
if (!mtype.isErroneous()) { // Cache only if kosher.
polymorphicSignatureScope.enter(msym); // depends on control dependency: [if], data = [none]
}
return msym;
} }
|
public class class_name {
@Override
protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException {
assert item != null;
if (item.getVersion() == null) {
throw new MojoExecutionException("Unable to find artifact without version specified: " + item.getGroupId()
+ ":" + item.getArtifactId() + ":" + item.getVersion() + " in either project dependencies or in project dependencyManagement.");
}
// if version is a range get the highest available version
if (item.getVersion().trim().startsWith("[") || item.getVersion().trim().startsWith("(") ) {
try {
item.setVersion(resolveVersionRange(item.getGroupId(), item.getArtifactId(), item.getType(), item.getVersion()));
} catch (VersionRangeResolutionException e) {
throw new MojoExecutionException("Could not get the highest version from the range: " + item.getVersion(), e);
}
}
return resolveArtifactItem(item);
} }
|
public class class_name {
@Override
protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException {
assert item != null;
if (item.getVersion() == null) {
throw new MojoExecutionException("Unable to find artifact without version specified: " + item.getGroupId()
+ ":" + item.getArtifactId() + ":" + item.getVersion() + " in either project dependencies or in project dependencyManagement.");
}
// if version is a range get the highest available version
if (item.getVersion().trim().startsWith("[") || item.getVersion().trim().startsWith("(") ) {
try {
item.setVersion(resolveVersionRange(item.getGroupId(), item.getArtifactId(), item.getType(), item.getVersion())); // depends on control dependency: [try], data = [none]
} catch (VersionRangeResolutionException e) {
throw new MojoExecutionException("Could not get the highest version from the range: " + item.getVersion(), e);
} // depends on control dependency: [catch], data = [none]
}
return resolveArtifactItem(item);
} }
|
public class class_name {
protected void closePopupDefault() {
if (m_previewHandlerRegistration != null) {
m_previewHandlerRegistration.removeHandler();
}
m_previewHandlerRegistration = null;
if (checkvalue(m_textboxColorValue.getText())) {
m_popup.hide();
}
} }
|
public class class_name {
protected void closePopupDefault() {
if (m_previewHandlerRegistration != null) {
m_previewHandlerRegistration.removeHandler(); // depends on control dependency: [if], data = [none]
}
m_previewHandlerRegistration = null;
if (checkvalue(m_textboxColorValue.getText())) {
m_popup.hide(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void propertyBound(final PropertyMap map) {
// only set the field if the map contains the property already
if (map.containsProperty(propertyName)) {
setFieldValue(map.getProperty(propertyName));
}
} }
|
public class class_name {
public void propertyBound(final PropertyMap map) {
// only set the field if the map contains the property already
if (map.containsProperty(propertyName)) {
setFieldValue(map.getProperty(propertyName)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void openEditor(String contents, String name) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IStorage storage = new StringStorage(contents, name);
IStorageEditorInput input = new StringInput(storage);
IWorkbenchPage page = window.getActivePage();
IEditorDescriptor desc = PlatformUI.getWorkbench().
getEditorRegistry().getDefaultEditor(name);
// If there is no editor associated with the given file name, we'll just
// use the eclipse text editor as a default
String editorId = desc != null?desc.getId():"org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
try {
if (page != null) {
page.openEditor(input, editorId);
}
} catch (Exception e) {
Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true);
}
} }
|
public class class_name {
public static void openEditor(String contents, String name) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IStorage storage = new StringStorage(contents, name);
IStorageEditorInput input = new StringInput(storage);
IWorkbenchPage page = window.getActivePage();
IEditorDescriptor desc = PlatformUI.getWorkbench().
getEditorRegistry().getDefaultEditor(name);
// If there is no editor associated with the given file name, we'll just
// use the eclipse text editor as a default
String editorId = desc != null?desc.getId():"org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
try {
if (page != null) {
page.openEditor(input, editorId); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String generateExceptionString(Throwable t, String delim) {
StringBuffer sb = new StringBuffer();
if (t != null) {
sb.append(t.toString());
Throwable nextThrowable = getNextThrowable(t);
if (nextThrowable != null) {
sb.append(delim);
sb.append(generateExceptionString(getNextThrowable(t), delim));
}
}
return sb.toString();
} }
|
public class class_name {
public static String generateExceptionString(Throwable t, String delim) {
StringBuffer sb = new StringBuffer();
if (t != null) {
sb.append(t.toString()); // depends on control dependency: [if], data = [(t]
Throwable nextThrowable = getNextThrowable(t);
if (nextThrowable != null) {
sb.append(delim); // depends on control dependency: [if], data = [none]
sb.append(generateExceptionString(getNextThrowable(t), delim)); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} }
|
public class class_name {
public GetAggregateConfigRuleComplianceSummaryResult withAggregateComplianceCounts(AggregateComplianceCount... aggregateComplianceCounts) {
if (this.aggregateComplianceCounts == null) {
setAggregateComplianceCounts(new com.amazonaws.internal.SdkInternalList<AggregateComplianceCount>(aggregateComplianceCounts.length));
}
for (AggregateComplianceCount ele : aggregateComplianceCounts) {
this.aggregateComplianceCounts.add(ele);
}
return this;
} }
|
public class class_name {
public GetAggregateConfigRuleComplianceSummaryResult withAggregateComplianceCounts(AggregateComplianceCount... aggregateComplianceCounts) {
if (this.aggregateComplianceCounts == null) {
setAggregateComplianceCounts(new com.amazonaws.internal.SdkInternalList<AggregateComplianceCount>(aggregateComplianceCounts.length)); // depends on control dependency: [if], data = [none]
}
for (AggregateComplianceCount ele : aggregateComplianceCounts) {
this.aggregateComplianceCounts.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
protected static void replaceXrefsWithRelatedER(
Collection<BioPAXElement> elements)
{
Set<EntityReference> ers = new HashSet<EntityReference>();
Set<Xref> xrefs = new HashSet<Xref>();
for (BioPAXElement element : elements)
{
if (element instanceof Xref)
{
xrefs.add((Xref) element);
for (XReferrable able : ((Xref) element).getXrefOf())
{
if (able instanceof EntityReference)
{
ers.add((EntityReference) able);
}
}
}
}
elements.removeAll(xrefs);
for (EntityReference er : ers)
{
if (!elements.contains(er)) elements.add(er);
}
} }
|
public class class_name {
protected static void replaceXrefsWithRelatedER(
Collection<BioPAXElement> elements)
{
Set<EntityReference> ers = new HashSet<EntityReference>();
Set<Xref> xrefs = new HashSet<Xref>();
for (BioPAXElement element : elements)
{
if (element instanceof Xref)
{
xrefs.add((Xref) element); // depends on control dependency: [if], data = [none]
for (XReferrable able : ((Xref) element).getXrefOf())
{
if (able instanceof EntityReference)
{
ers.add((EntityReference) able); // depends on control dependency: [if], data = [none]
}
}
}
}
elements.removeAll(xrefs);
for (EntityReference er : ers)
{
if (!elements.contains(er)) elements.add(er);
}
} }
|
public class class_name {
public int numOfSelectOptions() {
if (isNotPresentSelect()) {
return -1;
}
WebElement webElement = element.getWebElement();
Select dropdown = new Select(webElement);
List<WebElement> options = dropdown.getOptions();
return options.size();
} }
|
public class class_name {
public int numOfSelectOptions() {
if (isNotPresentSelect()) {
return -1; // depends on control dependency: [if], data = [none]
}
WebElement webElement = element.getWebElement();
Select dropdown = new Select(webElement);
List<WebElement> options = dropdown.getOptions();
return options.size();
} }
|
public class class_name {
public static <T extends Annotation> T getAnnotation(final Class<?> componentClass,
final Class<T> annotationClass)
{
T annotation = componentClass.getAnnotation(annotationClass);
if (annotation != null)
{
return annotation;
}
for (final Class<?> ifc : componentClass.getInterfaces())
{
annotation = getAnnotation(ifc, annotationClass);
if (annotation != null)
{
return annotation;
}
}
if (!Annotation.class.isAssignableFrom(componentClass))
{
for (final Annotation ann : componentClass.getAnnotations())
{
annotation = getAnnotation(ann.annotationType(), annotationClass);
if (annotation != null)
{
return annotation;
}
}
}
final Class<?> superClass = componentClass.getSuperclass();
if (superClass == null || superClass.equals(Object.class))
{
return null;
}
return getAnnotation(superClass, annotationClass);
} }
|
public class class_name {
public static <T extends Annotation> T getAnnotation(final Class<?> componentClass,
final Class<T> annotationClass)
{
T annotation = componentClass.getAnnotation(annotationClass);
if (annotation != null)
{
return annotation; // depends on control dependency: [if], data = [none]
}
for (final Class<?> ifc : componentClass.getInterfaces())
{
annotation = getAnnotation(ifc, annotationClass); // depends on control dependency: [for], data = [ifc]
if (annotation != null)
{
return annotation; // depends on control dependency: [if], data = [none]
}
}
if (!Annotation.class.isAssignableFrom(componentClass))
{
for (final Annotation ann : componentClass.getAnnotations())
{
annotation = getAnnotation(ann.annotationType(), annotationClass); // depends on control dependency: [for], data = [ann]
if (annotation != null)
{
return annotation; // depends on control dependency: [if], data = [none]
}
}
}
final Class<?> superClass = componentClass.getSuperclass();
if (superClass == null || superClass.equals(Object.class))
{
return null; // depends on control dependency: [if], data = [none]
}
return getAnnotation(superClass, annotationClass);
} }
|
public class class_name {
public static String normalizeSpace(final String str) {
if (N.isNullOrEmpty(str)) {
return str;
}
return WHITESPACE_PATTERN.matcher(str.trim()).replaceAll(WD.SPACE);
} }
|
public class class_name {
public static String normalizeSpace(final String str) {
if (N.isNullOrEmpty(str)) {
return str;
// depends on control dependency: [if], data = [none]
}
return WHITESPACE_PATTERN.matcher(str.trim()).replaceAll(WD.SPACE);
} }
|
public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("RECALC".equals(EVENT_TYPE)) {
minValue = gauge.getMinValue();
maxValue = gauge.getMaxValue();
range = gauge.getRange();
sections = gauge.getSections();
angleStep = ANGLE_RANGE / range;
redraw();
rotateNeedle(gauge.getCurrentValue());
} else if ("FINISHED".equals(EVENT_TYPE)) {
needleTooltip.setText(String.format(locale, formatString, gauge.getValue()));
}
} }
|
public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("RECALC".equals(EVENT_TYPE)) {
minValue = gauge.getMinValue(); // depends on control dependency: [if], data = [none]
maxValue = gauge.getMaxValue(); // depends on control dependency: [if], data = [none]
range = gauge.getRange(); // depends on control dependency: [if], data = [none]
sections = gauge.getSections(); // depends on control dependency: [if], data = [none]
angleStep = ANGLE_RANGE / range; // depends on control dependency: [if], data = [none]
redraw(); // depends on control dependency: [if], data = [none]
rotateNeedle(gauge.getCurrentValue()); // depends on control dependency: [if], data = [none]
} else if ("FINISHED".equals(EVENT_TYPE)) {
needleTooltip.setText(String.format(locale, formatString, gauge.getValue())); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public LruList<LoggingEvent> getEvents() {
if (events == null) {
events = new LruList<LoggingEvent>(LoggingEvent.class, getSize());
}
return events;
} }
|
public class class_name {
public LruList<LoggingEvent> getEvents() {
if (events == null) {
events = new LruList<LoggingEvent>(LoggingEvent.class, getSize()); // depends on control dependency: [if], data = [none]
}
return events;
} }
|
public class class_name {
private void removeIncomingPhoneNumbers(Sid accountSid, IncomingPhoneNumbersDao dao) {
List<IncomingPhoneNumber> numbers = dao.getIncomingPhoneNumbers(accountSid);
if (numbers != null && numbers.size() > 0) {
// manager is retrieved in a lazy way. If any number needs it, it will be first retrieved
// from the servlet context. If not there it will be created, stored in context and returned.
boolean managerQueried = false;
PhoneNumberProvisioningManager manager = null;
for (IncomingPhoneNumber number : numbers) {
// if this is not just a SIP number try to release it by contacting the provider
if (number.isPureSip() == null || !number.isPureSip()) {
if ( ! managerQueried )
manager = new PhoneNumberProvisioningManagerProvider(rootConfiguration,context).get(); // try to retrieve/build manager only once
if (manager != null) {
try {
if (! manager.cancelNumber(IncomingPhoneNumbersEndpoint.convertIncomingPhoneNumbertoPhoneNumber(number)) ) {
logger.error("Number cancelation failed for provided number '" + number.getPhoneNumber()+"'. Number entity " + number.getSid() + " will stay in database");
} else {
dao.removeIncomingPhoneNumber(number.getSid());
}
} catch (Exception e) {
logger.error("Number cancelation failed for provided number '" + number.getPhoneNumber()+"'",e);
}
}
else
logger.error("Number cancelation failed for provided number '" + number.getPhoneNumber()+"'. Provisioning Manager was null. "+"Number entity " + number.getSid() + " will stay in database");
} else {
// pureSIP numbers only to be removed from database. No need to contact provider
dao.removeIncomingPhoneNumber(number.getSid());
}
}
}
} }
|
public class class_name {
private void removeIncomingPhoneNumbers(Sid accountSid, IncomingPhoneNumbersDao dao) {
List<IncomingPhoneNumber> numbers = dao.getIncomingPhoneNumbers(accountSid);
if (numbers != null && numbers.size() > 0) {
// manager is retrieved in a lazy way. If any number needs it, it will be first retrieved
// from the servlet context. If not there it will be created, stored in context and returned.
boolean managerQueried = false;
PhoneNumberProvisioningManager manager = null;
for (IncomingPhoneNumber number : numbers) {
// if this is not just a SIP number try to release it by contacting the provider
if (number.isPureSip() == null || !number.isPureSip()) {
if ( ! managerQueried )
manager = new PhoneNumberProvisioningManagerProvider(rootConfiguration,context).get(); // try to retrieve/build manager only once
if (manager != null) {
try {
if (! manager.cancelNumber(IncomingPhoneNumbersEndpoint.convertIncomingPhoneNumbertoPhoneNumber(number)) ) {
logger.error("Number cancelation failed for provided number '" + number.getPhoneNumber()+"'. Number entity " + number.getSid() + " will stay in database"); // depends on control dependency: [if], data = [none]
} else {
dao.removeIncomingPhoneNumber(number.getSid()); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
logger.error("Number cancelation failed for provided number '" + number.getPhoneNumber()+"'",e);
} // depends on control dependency: [catch], data = [none]
}
else
logger.error("Number cancelation failed for provided number '" + number.getPhoneNumber()+"'. Provisioning Manager was null. "+"Number entity " + number.getSid() + " will stay in database");
} else {
// pureSIP numbers only to be removed from database. No need to contact provider
dao.removeIncomingPhoneNumber(number.getSid()); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public JComponent createComponentButton(String strProductType, BaseApplet applet)
{
ProductTypeInfo productType = ProductTypeInfo.getProductType(strProductType);
if (productType == null)
{
ImageIcon icon = null;
if (applet != null)
icon = applet.loadImageIcon(strProductType, null);
productType = new ProductTypeInfo(strProductType, icon, icon, 0x00c0c0c0, Colors.NULL);
}
JUnderlinedButton button = new JUnderlinedButton(productType.getDescription(), productType.getStartIcon());
String strLink = strProductType;
button.setName(strLink);
button.setOpaque(false);
Color colorBackground = new Color(productType.getSelectColor());
button.setBackground(colorBackground); // Since the button is opaque, this is only needed for those look and feels that want their own background color.
button.setBorderPainted(false);
button.addActionListener(m_actionListener);
button.addActionListener(this);
return button;
} }
|
public class class_name {
public JComponent createComponentButton(String strProductType, BaseApplet applet)
{
ProductTypeInfo productType = ProductTypeInfo.getProductType(strProductType);
if (productType == null)
{
ImageIcon icon = null;
if (applet != null)
icon = applet.loadImageIcon(strProductType, null);
productType = new ProductTypeInfo(strProductType, icon, icon, 0x00c0c0c0, Colors.NULL); // depends on control dependency: [if], data = [none]
}
JUnderlinedButton button = new JUnderlinedButton(productType.getDescription(), productType.getStartIcon());
String strLink = strProductType;
button.setName(strLink);
button.setOpaque(false);
Color colorBackground = new Color(productType.getSelectColor());
button.setBackground(colorBackground); // Since the button is opaque, this is only needed for those look and feels that want their own background color.
button.setBorderPainted(false);
button.addActionListener(m_actionListener);
button.addActionListener(this);
return button;
} }
|
public class class_name {
public static void RGB_to_PLU8(Picture input, Planar<GrayU8> output) {
if( input.getColor() != ColorSpace.RGB )
throw new RuntimeException("Unexpected input color space!");
if( output.getNumBands() != 3 )
throw new RuntimeException("Unexpected number of bands in output image!");
output.reshape(input.getWidth(),input.getHeight());
int dataIn[] = input.getData()[0];
GrayU8 out0 = output.getBand(0);
GrayU8 out1 = output.getBand(1);
GrayU8 out2 = output.getBand(2);
int indexIn = 0;
int indexOut = 0;
for (int i = 0; i < output.height; i++) {
for (int j = 0; j < output.width; j++, indexOut++ ) {
int r = dataIn[indexIn++];
int g = dataIn[indexIn++];
int b = dataIn[indexIn++];
out2.data[indexOut] = (byte)r;
out1.data[indexOut] = (byte)g;
out0.data[indexOut] = (byte)b;
}
}
} }
|
public class class_name {
public static void RGB_to_PLU8(Picture input, Planar<GrayU8> output) {
if( input.getColor() != ColorSpace.RGB )
throw new RuntimeException("Unexpected input color space!");
if( output.getNumBands() != 3 )
throw new RuntimeException("Unexpected number of bands in output image!");
output.reshape(input.getWidth(),input.getHeight());
int dataIn[] = input.getData()[0];
GrayU8 out0 = output.getBand(0);
GrayU8 out1 = output.getBand(1);
GrayU8 out2 = output.getBand(2);
int indexIn = 0;
int indexOut = 0;
for (int i = 0; i < output.height; i++) {
for (int j = 0; j < output.width; j++, indexOut++ ) {
int r = dataIn[indexIn++];
int g = dataIn[indexIn++];
int b = dataIn[indexIn++];
out2.data[indexOut] = (byte)r; // depends on control dependency: [for], data = [none]
out1.data[indexOut] = (byte)g; // depends on control dependency: [for], data = [none]
out0.data[indexOut] = (byte)b; // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
protected HttpResponse _sendRequest(final HttpRequest httpRequest, final HttpResponse previouseResponse) {
if (!keepAlive) {
httpRequest.open(httpConnectionProvider);
} else {
// keeping alive
if (previouseResponse == null) {
httpRequest.open(httpConnectionProvider).connectionKeepAlive(true);
} else {
httpRequest.keepAlive(previouseResponse, true);
}
}
return httpRequest.send();
} }
|
public class class_name {
protected HttpResponse _sendRequest(final HttpRequest httpRequest, final HttpResponse previouseResponse) {
if (!keepAlive) {
httpRequest.open(httpConnectionProvider); // depends on control dependency: [if], data = [none]
} else {
// keeping alive
if (previouseResponse == null) {
httpRequest.open(httpConnectionProvider).connectionKeepAlive(true); // depends on control dependency: [if], data = [none]
} else {
httpRequest.keepAlive(previouseResponse, true); // depends on control dependency: [if], data = [(previouseResponse]
}
}
return httpRequest.send();
} }
|
public class class_name {
public void setProvisioningArtifactParameters(java.util.Collection<ProvisioningArtifactParameter> provisioningArtifactParameters) {
if (provisioningArtifactParameters == null) {
this.provisioningArtifactParameters = null;
return;
}
this.provisioningArtifactParameters = new java.util.ArrayList<ProvisioningArtifactParameter>(provisioningArtifactParameters);
} }
|
public class class_name {
public void setProvisioningArtifactParameters(java.util.Collection<ProvisioningArtifactParameter> provisioningArtifactParameters) {
if (provisioningArtifactParameters == null) {
this.provisioningArtifactParameters = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.provisioningArtifactParameters = new java.util.ArrayList<ProvisioningArtifactParameter>(provisioningArtifactParameters);
} }
|
public class class_name {
@Override
public void handleRequest(final Request request) {
if (!isDisabled()) {
final SelectToggleModel model = getComponentModel();
String requestParam = request.getParameter(getId());
final State newValue;
if ("all".equals(requestParam)) {
newValue = State.ALL;
} else if ("none".equals(requestParam)) {
newValue = State.NONE;
} else if ("some".equals(requestParam)) {
newValue = State.SOME;
} else {
newValue = model.state;
}
if (!newValue.equals(model.state)) {
setState(newValue);
}
if (!model.clientSide && model.target != null && !State.SOME.equals(newValue)) {
// We need to change the selections *after* all components
// Have updated themselves from the request, as they may change
// their values when their handleRequest methods are called.
invokeLater(new Runnable() {
@Override
public void run() {
setSelections(model.target, State.ALL.equals(newValue));
}
});
}
}
} }
|
public class class_name {
@Override
public void handleRequest(final Request request) {
if (!isDisabled()) {
final SelectToggleModel model = getComponentModel();
String requestParam = request.getParameter(getId());
final State newValue;
if ("all".equals(requestParam)) {
newValue = State.ALL; // depends on control dependency: [if], data = [none]
} else if ("none".equals(requestParam)) {
newValue = State.NONE; // depends on control dependency: [if], data = [none]
} else if ("some".equals(requestParam)) {
newValue = State.SOME; // depends on control dependency: [if], data = [none]
} else {
newValue = model.state; // depends on control dependency: [if], data = [none]
}
if (!newValue.equals(model.state)) {
setState(newValue); // depends on control dependency: [if], data = [none]
}
if (!model.clientSide && model.target != null && !State.SOME.equals(newValue)) {
// We need to change the selections *after* all components
// Have updated themselves from the request, as they may change
// their values when their handleRequest methods are called.
invokeLater(new Runnable() {
@Override
public void run() {
setSelections(model.target, State.ALL.equals(newValue));
}
}); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@SuppressWarnings("EqualsBetweenInconvertibleTypes")
public byte[] getBytes(String key, byte[] defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
else if (o.getClass().equals(byte[].class)) {
return (byte[]) o;
}
else {
LOG.warn("Configuration cannot evaluate value {} as a byte[] value", o);
return defaultValue;
}
} }
|
public class class_name {
@SuppressWarnings("EqualsBetweenInconvertibleTypes")
public byte[] getBytes(String key, byte[] defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
else if (o.getClass().equals(byte[].class)) {
return (byte[]) o; // depends on control dependency: [if], data = [none]
}
else {
LOG.warn("Configuration cannot evaluate value {} as a byte[] value", o); // depends on control dependency: [if], data = [none]
return defaultValue; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String getQueueName(Configuration jobConf) {
// look for the hadoop2 queuename first
String hRavenQueueName = jobConf.get(Constants.QUEUENAME_HADOOP2);
if (StringUtils.isBlank(hRavenQueueName)) {
// presumably a hadoop1 conf, check for fair scheduler pool name
hRavenQueueName = jobConf
.get(Constants.FAIR_SCHEDULER_POOLNAME_HADOOP1);
if (StringUtils.isBlank(hRavenQueueName)) {
// check for capacity scheduler queue name
hRavenQueueName = jobConf
.get(Constants.CAPACITY_SCHEDULER_QUEUENAME_HADOOP1);
if (StringUtils.isBlank(hRavenQueueName)) {
// neither pool (hadoop1) nor queuename (hadoop2) found
// presumably FIFO scheduler, hence set to "DEFAULT_QUEUE"
hRavenQueueName = Constants.DEFAULT_QUEUENAME;
LOG.info(" Found neither "
+ Constants.FAIR_SCHEDULER_POOLNAME_HADOOP1
+ " nor " + Constants.QUEUENAME_HADOOP2 + " nor "
+ Constants.CAPACITY_SCHEDULER_QUEUENAME_HADOOP1
+ " hence presuming FIFO scheduler "
+ " and setting the queuename to "
+ Constants.DEFAULT_QUEUENAME);
}
}
}
return hRavenQueueName;
} }
|
public class class_name {
public static String getQueueName(Configuration jobConf) {
// look for the hadoop2 queuename first
String hRavenQueueName = jobConf.get(Constants.QUEUENAME_HADOOP2);
if (StringUtils.isBlank(hRavenQueueName)) {
// presumably a hadoop1 conf, check for fair scheduler pool name
hRavenQueueName = jobConf
.get(Constants.FAIR_SCHEDULER_POOLNAME_HADOOP1); // depends on control dependency: [if], data = [none]
if (StringUtils.isBlank(hRavenQueueName)) {
// check for capacity scheduler queue name
hRavenQueueName = jobConf
.get(Constants.CAPACITY_SCHEDULER_QUEUENAME_HADOOP1); // depends on control dependency: [if], data = [none]
if (StringUtils.isBlank(hRavenQueueName)) {
// neither pool (hadoop1) nor queuename (hadoop2) found
// presumably FIFO scheduler, hence set to "DEFAULT_QUEUE"
hRavenQueueName = Constants.DEFAULT_QUEUENAME; // depends on control dependency: [if], data = [none]
LOG.info(" Found neither "
+ Constants.FAIR_SCHEDULER_POOLNAME_HADOOP1
+ " nor " + Constants.QUEUENAME_HADOOP2 + " nor "
+ Constants.CAPACITY_SCHEDULER_QUEUENAME_HADOOP1
+ " hence presuming FIFO scheduler "
+ " and setting the queuename to "
+ Constants.DEFAULT_QUEUENAME); // depends on control dependency: [if], data = [none]
}
}
}
return hRavenQueueName;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.