id stringlengths 7 14 | text stringlengths 1 106k |
|---|---|
1768307_7 | @Deprecated
public Query createQuery(String query, boolean returnGeneratedKeys) {
return new Connection(this, true).createQuery(query, returnGeneratedKeys);
} |
1768307_8 | @Deprecated
public Query createQuery(String query, boolean returnGeneratedKeys) {
return new Connection(this, true).createQuery(query, returnGeneratedKeys);
} |
1768307_9 | @Deprecated
public Query createQuery(String query, boolean returnGeneratedKeys) {
return new Connection(this, true).createQuery(query, returnGeneratedKeys);
} |
1768380_0 | @SuppressWarnings("unchecked")
public Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {
return decodeSignedRequest(signedRequest, Map.class);
} |
1768380_1 | @SuppressWarnings("unchecked")
public Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {
return decodeSignedRequest(signedRequest, Map.class);
} |
1768380_2 | @SuppressWarnings("unchecked")
public Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {
return decodeSignedRequest(signedRequest, Map.class);
} |
1768380_3 | @SuppressWarnings("unchecked")
public Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {
return decodeSignedRequest(signedRequest, Map.class);
} |
1768380_4 | @SuppressWarnings("unchecked")
public Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {
return decodeSignedRequest(signedRequest, Map.class);
} |
1768380_5 | @SuppressWarnings("unchecked")
public Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {
return decodeSignedRequest(signedRequest, Map.class);
} |
1768380_6 | @RequestMapping(method=RequestMethod.POST)
public ResponseEntity<String> disconnect(@RequestParam("signed_request") String signedRequest) {
try {
String userId = getUserId(signedRequest);
logger.info("Deauthorization request received for Facebook User ID: " + userId + "; Removing connections.");
Set<String> providerUserIds = new HashSet<String>();
providerUserIds.add(userId);
Set<String> localUserIds = usersConnectionRepository.findUserIdsConnectedTo("facebook", providerUserIds);
for (String localUserId : localUserIds) {
ConnectionRepository connectionRepository = usersConnectionRepository.createConnectionRepository(localUserId);
logger.info(" Removing Facebook connection for local user '" + localUserId + "'");
connectionRepository.removeConnection(new ConnectionKey("facebook", userId));
}
return new ResponseEntity<String>(HttpStatus.NO_CONTENT);
} catch (SignedRequestException e) {
return new ResponseEntity<String>(HttpStatus.BAD_REQUEST);
}
} |
1768380_7 | @SuppressWarnings({ "unchecked", "rawtypes" })
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest request, WebDataBinderFactory binderFactory) throws Exception {
SignedRequest annotation = parameter.getParameterAnnotation(SignedRequest.class);
if (annotation == null) {
return WebArgumentResolver.UNRESOLVED;
}
String signedRequest = request.getParameter("signed_request");
if (signedRequest == null && annotation.required()) {
throw new IllegalStateException("Required signed_request parameter is missing.");
}
if (signedRequest == null) {
return null;
}
Class<?> parameterType = parameter.getParameterType();
if (MultiValueMap.class.isAssignableFrom(parameterType)) {
Map map = signedRequestDecoder.decodeSignedRequest(signedRequest, Map.class);
LinkedMultiValueMap<String, Object> mvm = new LinkedMultiValueMap<String, Object>(map.size());
mvm.setAll((Map<String, Object>) map);
return mvm;
}
return signedRequestDecoder.decodeSignedRequest(signedRequest, parameterType);
} |
1768380_8 | @SuppressWarnings({ "unchecked", "rawtypes" })
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest request, WebDataBinderFactory binderFactory) throws Exception {
SignedRequest annotation = parameter.getParameterAnnotation(SignedRequest.class);
if (annotation == null) {
return WebArgumentResolver.UNRESOLVED;
}
String signedRequest = request.getParameter("signed_request");
if (signedRequest == null && annotation.required()) {
throw new IllegalStateException("Required signed_request parameter is missing.");
}
if (signedRequest == null) {
return null;
}
Class<?> parameterType = parameter.getParameterType();
if (MultiValueMap.class.isAssignableFrom(parameterType)) {
Map map = signedRequestDecoder.decodeSignedRequest(signedRequest, Map.class);
LinkedMultiValueMap<String, Object> mvm = new LinkedMultiValueMap<String, Object>(map.size());
mvm.setAll((Map<String, Object>) map);
return mvm;
}
return signedRequestDecoder.decodeSignedRequest(signedRequest, parameterType);
} |
1768380_9 | @SuppressWarnings({ "unchecked", "rawtypes" })
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest request, WebDataBinderFactory binderFactory) throws Exception {
SignedRequest annotation = parameter.getParameterAnnotation(SignedRequest.class);
if (annotation == null) {
return WebArgumentResolver.UNRESOLVED;
}
String signedRequest = request.getParameter("signed_request");
if (signedRequest == null && annotation.required()) {
throw new IllegalStateException("Required signed_request parameter is missing.");
}
if (signedRequest == null) {
return null;
}
Class<?> parameterType = parameter.getParameterType();
if (MultiValueMap.class.isAssignableFrom(parameterType)) {
Map map = signedRequestDecoder.decodeSignedRequest(signedRequest, Map.class);
LinkedMultiValueMap<String, Object> mvm = new LinkedMultiValueMap<String, Object>(map.size());
mvm.setAll((Map<String, Object>) map);
return mvm;
}
return signedRequestDecoder.decodeSignedRequest(signedRequest, parameterType);
} |
1772396_0 | public static Date parse(String str) {
return parse(str, true);
} |
1772628_0 | public BusinessServiceLevel computeServiceLevel(long responseTime,Date timeStamp){
//assume that the service is at it best shape
BusinessServiceLevel sl=BusinessServiceLevel.GOLD;
//check if its gold
if(goldPeriod.inPeriod(timeStamp)&&responseTime>maxGold){
//it s not so its silver
sl=BusinessServiceLevel.SILVER;
//check if it s worse than silver
if(silverPeriod.inPeriod(timeStamp)&&responseTime>maxSilver){
//it's not even silver level so it s bronze
sl=BusinessServiceLevel.BRONZE;
//lets checks if there is a violation of the sla
if(bronzePeriod.inPeriod(timeStamp)&&responseTime>maxBronze){
//violation of the sla
sl=BusinessServiceLevel.VIOLATION;
}
}
}
return sl;
} |
1772628_1 | public BusinessServiceLevel computeServiceLevel(long responseTime,Date timeStamp){
//assume that the service is at it best shape
BusinessServiceLevel sl=BusinessServiceLevel.GOLD;
//check if its gold
if(goldPeriod.inPeriod(timeStamp)&&responseTime>maxGold){
//it s not so its silver
sl=BusinessServiceLevel.SILVER;
//check if it s worse than silver
if(silverPeriod.inPeriod(timeStamp)&&responseTime>maxSilver){
//it's not even silver level so it s bronze
sl=BusinessServiceLevel.BRONZE;
//lets checks if there is a violation of the sla
if(bronzePeriod.inPeriod(timeStamp)&&responseTime>maxBronze){
//violation of the sla
sl=BusinessServiceLevel.VIOLATION;
}
}
}
return sl;
} |
1772628_2 | public BusinessServiceLevel computeServiceLevel(long responseTime,Date timeStamp){
//assume that the service is at it best shape
BusinessServiceLevel sl=BusinessServiceLevel.GOLD;
//check if its gold
if(goldPeriod.inPeriod(timeStamp)&&responseTime>maxGold){
//it s not so its silver
sl=BusinessServiceLevel.SILVER;
//check if it s worse than silver
if(silverPeriod.inPeriod(timeStamp)&&responseTime>maxSilver){
//it's not even silver level so it s bronze
sl=BusinessServiceLevel.BRONZE;
//lets checks if there is a violation of the sla
if(bronzePeriod.inPeriod(timeStamp)&&responseTime>maxBronze){
//violation of the sla
sl=BusinessServiceLevel.VIOLATION;
}
}
}
return sl;
} |
1772628_3 | public BusinessServiceLevel computeServiceLevel(long responseTime,Date timeStamp){
//assume that the service is at it best shape
BusinessServiceLevel sl=BusinessServiceLevel.GOLD;
//check if its gold
if(goldPeriod.inPeriod(timeStamp)&&responseTime>maxGold){
//it s not so its silver
sl=BusinessServiceLevel.SILVER;
//check if it s worse than silver
if(silverPeriod.inPeriod(timeStamp)&&responseTime>maxSilver){
//it's not even silver level so it s bronze
sl=BusinessServiceLevel.BRONZE;
//lets checks if there is a violation of the sla
if(bronzePeriod.inPeriod(timeStamp)&&responseTime>maxBronze){
//violation of the sla
sl=BusinessServiceLevel.VIOLATION;
}
}
}
return sl;
} |
1772628_4 | public boolean equals(Object p){
if(p instanceof HoursPeriod)
return ((HoursPeriod)p).begining==begining&&((HoursPeriod)p).ending==ending;
return false;
} |
1772628_5 | public boolean inPeriod(Date date){
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int nbMinutes=cal.get(Calendar.HOUR_OF_DAY)*60+cal.get(Calendar.MINUTE);
return nbMinutes>begining&& nbMinutes<ending ;
} |
1772628_6 | public String toString(){
return "begining:"+begining+" ending:"+ending;
} |
1772628_7 | public String calculIndicators(JasmineEventEB[] events) {
// if no events return nothing
if (events == null)
return "";
// a hashmap to store the result
Hashtable<String, BusinessServiceLevel> serviceLevels = new Hashtable<String, BusinessServiceLevel>();
// for each events
for (JasmineEventEB ev : events) {
// parsing the database line
String probe = ev.getProbe();
String[] evProp = probe.split("\\.");
String provider = evProp[1] + "." + evProp[2];
String service = evProp[3];
String identifier = service + "@" + provider;
String dataType = evProp[4];
// if it s a response time event
if (dataType.equals("ResponseTime")) {
// finding corresponding BusinessSLA
Iterator<BusinessSLA> it = businessSLA.iterator();
BusinessSLA sla = null;
int k = 0;
while (it.hasNext()
&& (!(sla = it.next()).getProvider().equals(provider) || !sla
.getService().equals(service))) {
k++;
}
// there is a SLA
if (k < businessSLA.size()) {
// Checking SLA
BusinessServiceLevel level = sla.computeServiceLevel(
Long.parseLong((String) ev.getValue()),
ev.getTimestamp());
// update SL of the service if it worse than actual
BusinessServiceLevel oldLevel = serviceLevels
.get(identifier);
if (oldLevel == null || level.isWorse(oldLevel)) {
serviceLevels.put(identifier, level);
}
}
}
}
// building response string
StringBuffer res = new StringBuffer();
Enumeration<String> serviceIdentifiers = serviceLevels.keys();
while (serviceIdentifiers.hasMoreElements()) {
String serviceIdentifier = serviceIdentifiers.nextElement();
BusinessServiceLevel level = serviceLevels.get(serviceIdentifier);
res.append(serviceIdentifier + " is " + level + " level");
res.append("\n");
}
return res.toString();
} |
1772628_8 | public JasmineEventEB[] getQoSEvents(final Date from, final Date to,
final int nbrecords) throws NamingException, ParseException,
IOException {
if (!configdone) {
setConfig();
}
// The classloader thing is here to solve a osgi problem
ClassLoader saved = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(
AdapterService.class.getClassLoader());
JasmineEventEB[] events = null;
try {
// ask the bean to extract events from the database
events = getBean().getEvents("qos-event", null, null, null, null,
from, to, "timestamp", 0, nbrecords);
} finally {
Thread.currentThread().setContextClassLoader(saved);
}
return events;
} |
1772795_0 | @Override
public void saveMetricSnapshot(long timeSnapshot, Collection<MetricValueAggregator> snapshotCollection) throws ServiceException {
delegate.saveMetricSnapshot(timeSnapshot, snapshotCollection);
} |
1772795_1 | @Override
public void saveMetricSnapshot(long timeSnapshot, Collection<MetricValueAggregator> snapshotCollection) throws ServiceException {
delegate.saveMetricSnapshot(timeSnapshot, snapshotCollection);
} |
1772795_2 | @Override
public void saveMetricSnapshot(long timeSnapshot, Collection<MetricValueAggregator> snapshotCollection) throws ServiceException {
delegate.saveMetricSnapshot(timeSnapshot, snapshotCollection);
} |
1772795_3 | @Override
public void saveMetricSnapshot(long timeSnapshot, Collection<MetricValueAggregator> snapshotCollection) throws ServiceException {
delegate.saveMetricSnapshot(timeSnapshot, snapshotCollection);
} |
1772795_4 | public static List<String> generateErrorValuesKeys(final boolean serverSide,
final Map<String, List<String>> filters, final String param1) {
final List<String> errorKeys = new ArrayList<String>();
final List<String> serverNames = (filters.get("Server")!= null ? new ArrayList<String>(filters.get("Server")): new ArrayList<String>()) ;
final List<String> serviceAdminNames = (filters.get("Service")!= null ? new ArrayList<String>(filters.get("Service")): new ArrayList<String>()) ;
final List<String> operationNames = (filters.get("Operation")!= null ? new ArrayList<String>(filters.get("Operation")): new ArrayList<String>()) ;
final List<String> consumerNames = (filters.get("Consumer")!= null ? new ArrayList<String>(filters.get("Consumer")): new ArrayList<String>()) ;
if (serverNames == null || serverNames.isEmpty()) {
serverNames.add(KEY_ALL );
}
if (serviceAdminNames == null || serviceAdminNames.isEmpty()) {
serviceAdminNames.add(KEY_ALL );
}
if (consumerNames == null || consumerNames.isEmpty()) {
consumerNames.add(KEY_ALL );
}
if (operationNames == null || operationNames.isEmpty()) {
operationNames.add(KEY_ALL );
}
for (String serverName : serverNames) {
for (String serviceName : serviceAdminNames) {
for (String consumerName : consumerNames) {
for (String operationName : operationNames) {
errorKeys.add(serverName + KEY_TOKEN + serviceName + KEY_TOKEN + consumerName
+ KEY_TOKEN + operationName + KEY_TOKEN + param1 + KEY_TOKEN + serverSide);
}
}
}
}
return errorKeys;
} |
1772795_5 | public static List<String> generateErrorValuesKeys(final boolean serverSide,
final Map<String, List<String>> filters, final String param1) {
final List<String> errorKeys = new ArrayList<String>();
final List<String> serverNames = (filters.get("Server")!= null ? new ArrayList<String>(filters.get("Server")): new ArrayList<String>()) ;
final List<String> serviceAdminNames = (filters.get("Service")!= null ? new ArrayList<String>(filters.get("Service")): new ArrayList<String>()) ;
final List<String> operationNames = (filters.get("Operation")!= null ? new ArrayList<String>(filters.get("Operation")): new ArrayList<String>()) ;
final List<String> consumerNames = (filters.get("Consumer")!= null ? new ArrayList<String>(filters.get("Consumer")): new ArrayList<String>()) ;
if (serverNames == null || serverNames.isEmpty()) {
serverNames.add(KEY_ALL );
}
if (serviceAdminNames == null || serviceAdminNames.isEmpty()) {
serviceAdminNames.add(KEY_ALL );
}
if (consumerNames == null || consumerNames.isEmpty()) {
consumerNames.add(KEY_ALL );
}
if (operationNames == null || operationNames.isEmpty()) {
operationNames.add(KEY_ALL );
}
for (String serverName : serverNames) {
for (String serviceName : serviceAdminNames) {
for (String consumerName : consumerNames) {
for (String operationName : operationNames) {
errorKeys.add(serverName + KEY_TOKEN + serviceName + KEY_TOKEN + consumerName
+ KEY_TOKEN + operationName + KEY_TOKEN + param1 + KEY_TOKEN + serverSide);
}
}
}
}
return errorKeys;
} |
1772795_6 | public static List<String> generateErrorValuesKeys(final boolean serverSide,
final Map<String, List<String>> filters, final String param1) {
final List<String> errorKeys = new ArrayList<String>();
final List<String> serverNames = (filters.get("Server")!= null ? new ArrayList<String>(filters.get("Server")): new ArrayList<String>()) ;
final List<String> serviceAdminNames = (filters.get("Service")!= null ? new ArrayList<String>(filters.get("Service")): new ArrayList<String>()) ;
final List<String> operationNames = (filters.get("Operation")!= null ? new ArrayList<String>(filters.get("Operation")): new ArrayList<String>()) ;
final List<String> consumerNames = (filters.get("Consumer")!= null ? new ArrayList<String>(filters.get("Consumer")): new ArrayList<String>()) ;
if (serverNames == null || serverNames.isEmpty()) {
serverNames.add(KEY_ALL );
}
if (serviceAdminNames == null || serviceAdminNames.isEmpty()) {
serviceAdminNames.add(KEY_ALL );
}
if (consumerNames == null || consumerNames.isEmpty()) {
consumerNames.add(KEY_ALL );
}
if (operationNames == null || operationNames.isEmpty()) {
operationNames.add(KEY_ALL );
}
for (String serverName : serverNames) {
for (String serviceName : serviceAdminNames) {
for (String consumerName : consumerNames) {
for (String operationName : operationNames) {
errorKeys.add(serverName + KEY_TOKEN + serviceName + KEY_TOKEN + consumerName
+ KEY_TOKEN + operationName + KEY_TOKEN + param1 + KEY_TOKEN + serverSide);
}
}
}
}
return errorKeys;
} |
1772795_7 | public static List<String> generateErrorValuesKeys(final boolean serverSide,
final Map<String, List<String>> filters, final String param1) {
final List<String> errorKeys = new ArrayList<String>();
final List<String> serverNames = (filters.get("Server")!= null ? new ArrayList<String>(filters.get("Server")): new ArrayList<String>()) ;
final List<String> serviceAdminNames = (filters.get("Service")!= null ? new ArrayList<String>(filters.get("Service")): new ArrayList<String>()) ;
final List<String> operationNames = (filters.get("Operation")!= null ? new ArrayList<String>(filters.get("Operation")): new ArrayList<String>()) ;
final List<String> consumerNames = (filters.get("Consumer")!= null ? new ArrayList<String>(filters.get("Consumer")): new ArrayList<String>()) ;
if (serverNames == null || serverNames.isEmpty()) {
serverNames.add(KEY_ALL );
}
if (serviceAdminNames == null || serviceAdminNames.isEmpty()) {
serviceAdminNames.add(KEY_ALL );
}
if (consumerNames == null || consumerNames.isEmpty()) {
consumerNames.add(KEY_ALL );
}
if (operationNames == null || operationNames.isEmpty()) {
operationNames.add(KEY_ALL );
}
for (String serverName : serverNames) {
for (String serviceName : serviceAdminNames) {
for (String consumerName : consumerNames) {
for (String operationName : operationNames) {
errorKeys.add(serverName + KEY_TOKEN + serviceName + KEY_TOKEN + consumerName
+ KEY_TOKEN + operationName + KEY_TOKEN + param1 + KEY_TOKEN + serverSide);
}
}
}
}
return errorKeys;
} |
1772795_8 | public static List<String> generateErrorValuesKeys(final boolean serverSide,
final Map<String, List<String>> filters, final String param1) {
final List<String> errorKeys = new ArrayList<String>();
final List<String> serverNames = (filters.get("Server")!= null ? new ArrayList<String>(filters.get("Server")): new ArrayList<String>()) ;
final List<String> serviceAdminNames = (filters.get("Service")!= null ? new ArrayList<String>(filters.get("Service")): new ArrayList<String>()) ;
final List<String> operationNames = (filters.get("Operation")!= null ? new ArrayList<String>(filters.get("Operation")): new ArrayList<String>()) ;
final List<String> consumerNames = (filters.get("Consumer")!= null ? new ArrayList<String>(filters.get("Consumer")): new ArrayList<String>()) ;
if (serverNames == null || serverNames.isEmpty()) {
serverNames.add(KEY_ALL );
}
if (serviceAdminNames == null || serviceAdminNames.isEmpty()) {
serviceAdminNames.add(KEY_ALL );
}
if (consumerNames == null || consumerNames.isEmpty()) {
consumerNames.add(KEY_ALL );
}
if (operationNames == null || operationNames.isEmpty()) {
operationNames.add(KEY_ALL );
}
for (String serverName : serverNames) {
for (String serviceName : serviceAdminNames) {
for (String consumerName : consumerNames) {
for (String operationName : operationNames) {
errorKeys.add(serverName + KEY_TOKEN + serviceName + KEY_TOKEN + consumerName
+ KEY_TOKEN + operationName + KEY_TOKEN + param1 + KEY_TOKEN + serverSide);
}
}
}
}
return errorKeys;
} |
1772795_9 | public static List<String> generateErrorValuesKeys(final boolean serverSide,
final Map<String, List<String>> filters, final String param1) {
final List<String> errorKeys = new ArrayList<String>();
final List<String> serverNames = (filters.get("Server")!= null ? new ArrayList<String>(filters.get("Server")): new ArrayList<String>()) ;
final List<String> serviceAdminNames = (filters.get("Service")!= null ? new ArrayList<String>(filters.get("Service")): new ArrayList<String>()) ;
final List<String> operationNames = (filters.get("Operation")!= null ? new ArrayList<String>(filters.get("Operation")): new ArrayList<String>()) ;
final List<String> consumerNames = (filters.get("Consumer")!= null ? new ArrayList<String>(filters.get("Consumer")): new ArrayList<String>()) ;
if (serverNames == null || serverNames.isEmpty()) {
serverNames.add(KEY_ALL );
}
if (serviceAdminNames == null || serviceAdminNames.isEmpty()) {
serviceAdminNames.add(KEY_ALL );
}
if (consumerNames == null || consumerNames.isEmpty()) {
consumerNames.add(KEY_ALL );
}
if (operationNames == null || operationNames.isEmpty()) {
operationNames.add(KEY_ALL );
}
for (String serverName : serverNames) {
for (String serviceName : serviceAdminNames) {
for (String consumerName : consumerNames) {
for (String operationName : operationNames) {
errorKeys.add(serverName + KEY_TOKEN + serviceName + KEY_TOKEN + consumerName
+ KEY_TOKEN + operationName + KEY_TOKEN + param1 + KEY_TOKEN + serverSide);
}
}
}
}
return errorKeys;
} |
1772863_0 | private void fetchPoliciesByName(String name, String type, String effect) {
PolicyKey key = new PolicyKey();
key.setName(name);
key.setType(type);
QueryCondition condition = new QueryCondition();
if ("RL".equals(type) && effect != null) {
condition.addQuery(new QueryCondition.Query(QueryCondition.EffectValue.valueOf(effect)));
}
condition.addQuery(new QueryCondition.Query(QueryCondition.ActivePoliciesOnlyValue.FALSE));
service.findPolicies(null, Collections.singletonList(key), null, null, null, null, null, condition,
new AsyncCallback<GetPoliciesResponse>() {
public void onFailure(Throwable arg) {
if (arg.getLocalizedMessage().contains("500")) {
view.error(PolicyAdminUIUtil.messages
.serverError(PolicyAdminUIUtil.policyAdminConstants
.genericErrorMessage()));
}
else {
view.error(PolicyAdminUIUtil.messages.serverError(arg.getLocalizedMessage()));
}
}
public void onSuccess(GetPoliciesResponse result) {
PolicySummaryPresenter.this.policies = copyToWriteable(result.getPolicies());
PolicySummaryPresenter.this.view.setPolicies(policies);
if(policies.isEmpty()){
view.info(PolicyAdminUIUtil.policyAdminConstants
.noItemFoundMessage());
}else{
for (GenericPolicy p : policies){
fetchAccess(p);
}
}
}
});
} |
1772863_1 | public static List<PolicyKey> getAllPolicyKeyList() {
return poKeys;
} |
1772863_2 | public static List<ResourceKey> getAllResourceKeyList() {
return rsKeys;
} |
1772863_3 | public static List<SubjectKey> getAllSubjectKeyList() {
return sKeys;
} |
1772863_4 | public static List<OperationKey> getAllOperationKeyList() {
return opKeys;
} |
1772863_5 | public Throwable getErrorAsThrowable (String responseName, Response response) {
if (response == null)
return null;
//try parsing the json as an errorMessage
ErrorResponse errorResponse = ErrorResponse.fromJSON(response.getText());
JsArray<RemoteError> errors = errorResponse.getErrors();
if (errors == null || errors.length()==0)
errors = errorResponse.getServiceErrors(responseName);
if (errors == null)
return new Throwable(PolicyAdminUIUtil.constants.error()+" "+response.getStatusCode());
String s = "";
for (int i=0;i<errors.length();i++) {
RemoteError re = errors.get(i);
s += re.getCategory()+":"+re.getSeverity()+":"+re.getMessage()+" ";
}
if (!"".equals(s))
return new Throwable(s);
return new Throwable(PolicyAdminUIUtil.messages.badRequestData());
} |
1772863_6 | public Throwable getErrorAsThrowable (String responseName, Response response) {
if (response == null)
return null;
//try parsing the json as an errorMessage
ErrorResponse errorResponse = ErrorResponse.fromJSON(response.getText());
JsArray<RemoteError> errors = errorResponse.getErrors();
if (errors == null || errors.length()==0)
errors = errorResponse.getServiceErrors(responseName);
if (errors == null)
return new Throwable(PolicyAdminUIUtil.constants.error()+" "+response.getStatusCode());
String s = "";
for (int i=0;i<errors.length();i++) {
RemoteError re = errors.get(i);
s += re.getCategory()+":"+re.getSeverity()+":"+re.getMessage()+" ";
}
if (!"".equals(s))
return new Throwable(s);
return new Throwable(PolicyAdminUIUtil.messages.badRequestData());
} |
1772863_7 | @Override
protected String getPolicyType() {
return "WHITELIST";
} |
1772863_8 | @Override
public GetAuthenticationPolicyResponse getAuthenticationPolicy(
GetAuthenticationPolicyRequest request) throws PolicyProviderException {
if (request == null ||
request.getResourceName() == null ||
request.getResourceType() == null ||
request.getOperationName() == null ||
request.getResourceName().equals("") ||
request.getResourceType().equals("") ||
request.getOperationName().equals("")) {
hrow new org.ebayopensource.turmeric.policyservice.exceptions.PolicyProviderException(Category.POLICY,
"AUTHN", "invalid request");
y {
olicyProvider.initialize();
catch (org.ebayopensource.turmeric.utils.config.exceptions.PolicyProviderException e) {
hrow new PolicyProviderException(Category.POLICY,
"AUTHN", "initialization failed", e);
tAuthenticationPolicyResponse response = new GetAuthenticationPolicyResponse();
y {
uthenticationProviderInfo authInfo = policyProvider.getAuthnPolicyByResource(
request.getResourceName(),
request.getOperationName(),
request.getResourceType());
f (authInfo != null) {
mapAuthnPolicy(response, authInfo);
esponse.setAck(AckValue.SUCCESS);
catch (org.ebayopensource.turmeric.utils.config.exceptions.PolicyProviderException e) {
hrow new org.ebayopensource.turmeric.policyservice.exceptions.PolicyProviderException(Category.POLICY,
"AUTHN", "unexpected error", e);
turn response;
} |
1772863_9 | @Override
public GetAuthenticationPolicyResponse getAuthenticationPolicy(
GetAuthenticationPolicyRequest request) throws PolicyProviderException {
if (request == null ||
request.getResourceName() == null ||
request.getResourceType() == null ||
request.getOperationName() == null ||
request.getResourceName().equals("") ||
request.getResourceType().equals("") ||
request.getOperationName().equals("")) {
hrow new org.ebayopensource.turmeric.policyservice.exceptions.PolicyProviderException(Category.POLICY,
"AUTHN", "invalid request");
y {
olicyProvider.initialize();
catch (org.ebayopensource.turmeric.utils.config.exceptions.PolicyProviderException e) {
hrow new PolicyProviderException(Category.POLICY,
"AUTHN", "initialization failed", e);
tAuthenticationPolicyResponse response = new GetAuthenticationPolicyResponse();
y {
uthenticationProviderInfo authInfo = policyProvider.getAuthnPolicyByResource(
request.getResourceName(),
request.getOperationName(),
request.getResourceType());
f (authInfo != null) {
mapAuthnPolicy(response, authInfo);
esponse.setAck(AckValue.SUCCESS);
catch (org.ebayopensource.turmeric.utils.config.exceptions.PolicyProviderException e) {
hrow new org.ebayopensource.turmeric.policyservice.exceptions.PolicyProviderException(Category.POLICY,
"AUTHN", "unexpected error", e);
turn response;
} |
1772983_0 | @Override
public AuthenticationResponse authenticate(AuthenticationRequest authnRequest)
throws AuthenticationException {
return impl.authenticate(authnRequest);
} |
1772983_1 | @Override
public IsRateLimitedResponse isRateLimited(
IsRateLimitedRequest isRateLimitedRequest) {
IsRateLimitedResponse response = new IsRateLimitedResponse();
response.setStatus(RateLimiterStatus.SERVE_OK);
if (!"SERVICE".equalsIgnoreCase(isRateLimitedRequest.getResourceType())) {
response.setStatus(RateLimiterStatus.UNSUPPORTED);
}
if (isRateLimitedRequest.getResourceName() == null
|| isRateLimitedRequest.getResourceType() == null)
response.setStatus(RateLimiterStatus.BLOCK);
checkPolices(response, isRateLimitedRequest);
setTimeStamp(response);
response.setAck(AckValue.SUCCESS);
return response;
} |
1772983_2 | @Override
public IsRateLimitedResponse isRateLimited(
IsRateLimitedRequest isRateLimitedRequest) {
IsRateLimitedResponse response = new IsRateLimitedResponse();
response.setStatus(RateLimiterStatus.SERVE_OK);
if (!"SERVICE".equalsIgnoreCase(isRateLimitedRequest.getResourceType())) {
response.setStatus(RateLimiterStatus.UNSUPPORTED);
}
if (isRateLimitedRequest.getResourceName() == null
|| isRateLimitedRequest.getResourceType() == null)
response.setStatus(RateLimiterStatus.BLOCK);
checkPolices(response, isRateLimitedRequest);
setTimeStamp(response);
response.setAck(AckValue.SUCCESS);
return response;
} |
1772983_3 | @Override
public IsRateLimitedResponse isRateLimited(
IsRateLimitedRequest isRateLimitedRequest) {
IsRateLimitedResponse response = new IsRateLimitedResponse();
response.setStatus(RateLimiterStatus.SERVE_OK);
if (!"SERVICE".equalsIgnoreCase(isRateLimitedRequest.getResourceType())) {
response.setStatus(RateLimiterStatus.UNSUPPORTED);
}
if (isRateLimitedRequest.getResourceName() == null
|| isRateLimitedRequest.getResourceType() == null)
response.setStatus(RateLimiterStatus.BLOCK);
checkPolices(response, isRateLimitedRequest);
setTimeStamp(response);
response.setAck(AckValue.SUCCESS);
return response;
} |
1772983_4 | @Override
public IsRateLimitedResponse isRateLimited(
IsRateLimitedRequest isRateLimitedRequest) {
IsRateLimitedResponse response = new IsRateLimitedResponse();
response.setStatus(RateLimiterStatus.SERVE_OK);
if (!"SERVICE".equalsIgnoreCase(isRateLimitedRequest.getResourceType())) {
response.setStatus(RateLimiterStatus.UNSUPPORTED);
}
if (isRateLimitedRequest.getResourceName() == null
|| isRateLimitedRequest.getResourceType() == null)
response.setStatus(RateLimiterStatus.BLOCK);
checkPolices(response, isRateLimitedRequest);
setTimeStamp(response);
response.setAck(AckValue.SUCCESS);
return response;
} |
1772983_5 | @Override
public IsRateLimitedResponse isRateLimited(
IsRateLimitedRequest isRateLimitedRequest) {
IsRateLimitedResponse response = new IsRateLimitedResponse();
response.setStatus(RateLimiterStatus.SERVE_OK);
if (!"SERVICE".equalsIgnoreCase(isRateLimitedRequest.getResourceType())) {
response.setStatus(RateLimiterStatus.UNSUPPORTED);
}
if (isRateLimitedRequest.getResourceName() == null
|| isRateLimitedRequest.getResourceType() == null)
response.setStatus(RateLimiterStatus.BLOCK);
checkPolices(response, isRateLimitedRequest);
setTimeStamp(response);
response.setAck(AckValue.SUCCESS);
return response;
} |
1772983_6 | @Override
public IsRateLimitedResponse isRateLimited(
IsRateLimitedRequest isRateLimitedRequest) {
IsRateLimitedResponse response = new IsRateLimitedResponse();
response.setStatus(RateLimiterStatus.SERVE_OK);
if (!"SERVICE".equalsIgnoreCase(isRateLimitedRequest.getResourceType())) {
response.setStatus(RateLimiterStatus.UNSUPPORTED);
}
if (isRateLimitedRequest.getResourceName() == null
|| isRateLimitedRequest.getResourceType() == null)
response.setStatus(RateLimiterStatus.BLOCK);
checkPolices(response, isRateLimitedRequest);
setTimeStamp(response);
response.setAck(AckValue.SUCCESS);
return response;
} |
1772983_7 | @Override
public IsRateLimitedResponse isRateLimited(
IsRateLimitedRequest isRateLimitedRequest) {
IsRateLimitedResponse response = new IsRateLimitedResponse();
response.setStatus(RateLimiterStatus.SERVE_OK);
if (!"SERVICE".equalsIgnoreCase(isRateLimitedRequest.getResourceType())) {
response.setStatus(RateLimiterStatus.UNSUPPORTED);
}
if (isRateLimitedRequest.getResourceName() == null
|| isRateLimitedRequest.getResourceType() == null)
response.setStatus(RateLimiterStatus.BLOCK);
checkPolices(response, isRateLimitedRequest);
setTimeStamp(response);
response.setAck(AckValue.SUCCESS);
return response;
} |
1772983_8 | @Override
public IsRateLimitedResponse isRateLimited(
IsRateLimitedRequest isRateLimitedRequest) {
IsRateLimitedResponse response = new IsRateLimitedResponse();
response.setStatus(RateLimiterStatus.SERVE_OK);
if (!"SERVICE".equalsIgnoreCase(isRateLimitedRequest.getResourceType())) {
response.setStatus(RateLimiterStatus.UNSUPPORTED);
}
if (isRateLimitedRequest.getResourceName() == null
|| isRateLimitedRequest.getResourceType() == null)
response.setStatus(RateLimiterStatus.BLOCK);
checkPolices(response, isRateLimitedRequest);
setTimeStamp(response);
response.setAck(AckValue.SUCCESS);
return response;
} |
1772983_9 | @Override
public IsRateLimitedResponse isRateLimited(
IsRateLimitedRequest isRateLimitedRequest) {
IsRateLimitedResponse response = new IsRateLimitedResponse();
response.setStatus(RateLimiterStatus.SERVE_OK);
if (!"SERVICE".equalsIgnoreCase(isRateLimitedRequest.getResourceType())) {
response.setStatus(RateLimiterStatus.UNSUPPORTED);
}
if (isRateLimitedRequest.getResourceName() == null
|| isRateLimitedRequest.getResourceType() == null)
response.setStatus(RateLimiterStatus.BLOCK);
checkPolices(response, isRateLimitedRequest);
setTimeStamp(response);
response.setAck(AckValue.SUCCESS);
return response;
} |
1782556_0 | void afterRender(final MarkupWriter writer)
{
writer.end();
writer.element("span", "id", getWrapperClientId(), "style", "display:inline-block");
writer.end();
} |
1782556_1 | void onRemoveUpload(int serverIndex)
{
// We use index of an uploadedFile in 'value' as a key at
// the client side and if the uploaded file is removed we cleanup and set
// the element at that index to null. As the 'value' may contain null, we
// need to remove those entries in processSubmission()
if (value != null && serverIndex >= 0 && serverIndex < value.size())
{
UploadedFile item = value.get(serverIndex);
if (item != null && (item instanceof UploadedFileItem))
{
((UploadedFileItem) item).cleanup();
}
value.set(serverIndex, null);
}
} |
1782556_2 | @Override
public boolean isAjaxUploadRequest(HttpServletRequest request)
{
return request.getHeader(AJAX_UPLOAD_HEADER) != null;
} |
1782556_3 | @Override
public boolean isAjaxUploadRequest(HttpServletRequest request)
{
return request.getHeader(AJAX_UPLOAD_HEADER) != null;
} |
1782556_4 | @Override
public boolean isAjaxUploadRequest(HttpServletRequest request)
{
return request.getHeader(AJAX_UPLOAD_HEADER) != null;
} |
1782556_5 | @Override
public boolean isAjaxUploadRequest(HttpServletRequest request)
{
return request.getHeader(AJAX_UPLOAD_HEADER) != null;
} |
1782556_6 | @Override
public boolean isAjaxUploadRequest(HttpServletRequest request)
{
return request.getHeader(AJAX_UPLOAD_HEADER) != null;
} |
1782556_7 | @Override
public void setupUploadedFile(HttpServletRequest request)
{
String fieldName = request.getHeader(AJAX_UPLOAD_HEADER);
FileItem item = fileItemFactory.createItem(fieldName, request.getContentType(), false,
request.getParameter(AjaxUploadConstants.FILE_PARAMETER));
try
{
TapestryInternalUtils.copy(request.getInputStream(), item.getOutputStream());
}
catch (IOException e)
{
throw new RuntimeException("Could not copy request's input stream to file", e);
}
uploadedFile = new UploadedFileItem(item);
} |
1782556_8 | @Override
public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler)
throws IOException
{
if (decoder.isAjaxUploadRequest(request))
{
decoder.setupUploadedFile(request);
}
return handler.service(request, response);
} |
1782556_9 | @Override
public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler)
throws IOException
{
if (decoder.isAjaxUploadRequest(request))
{
decoder.setupUploadedFile(request);
}
return handler.service(request, response);
} |
1783046_0 | Config createConfig() {
return new ConfigBuilder()
.withMasterUrl(kubernetesMaster)
.withApiVersion(kubernetesApiVersion)
.withTrustCerts(kubernetesTrustCertificates)
.withDisableHostnameVerification(kubernetesDisableHostnameVerification)
.withCaCertFile(kubernetesCertsCaFile)
.withCaCertData(kubernetesCertsCaData)
.withClientCertFile(kubernetesCertsClientFile)
.withClientCertData(kubernetesCertsClientData)
.withClientKeyFile(kubernetesCertsClientKeyFile)
.withClientKeyData(kubernetesCertsClientKeyData)
.withClientKeyAlgo(kubernetesCertsClientKeyAlgo)
.withClientKeyPassphrase(kubernetesCertsClientKeyPassphrase)
.withUsername(kubernetesAuthBasicUsername)
.withPassword(kubernetesAuthBasicPassword)
.withOauthToken(kubernetesOauthToken)
.withWatchReconnectInterval(kubernetesWatchReconnectInterval)
.withWatchReconnectLimit(kubernetesWatchReconnectLimit)
.withUserAgent(kubernetesUserAgent)
.withTlsVersions(TlsVersion.forJavaName(kubernetesTlsVersion))
.withTrustStoreFile(kubernetesTruststoreFile)
.withTrustStorePassphrase(kubernetesTruststorePassphrase)
.withKeyStoreFile(kubernetesKeystoreFile)
.withKeyStorePassphrase(kubernetesKeystorePassphrase)
.build();
} |
1783046_1 | @Override
public Set<String> discoverMembers() {
LOGGER.debug("CELLAR KUBERNETES: query pods with labeled with [{}={}]", kubernetesPodLabelKey, kubernetesPodLabelValue);
Set<String> members = new HashSet<String>();
try {
PodList podList = kubernetesClient.pods().list();
for (Pod pod : podList.getItems()) {
String value = pod.getMetadata().getLabels().get(kubernetesPodLabelKey);
if (value != null && !value.isEmpty() && value.equals(kubernetesPodLabelValue)) {
members.add(pod.getStatus().getPodIP());
}
}
} catch (Exception e) {
LOGGER.error("CELLAR KUBERNETES: can't get pods", e);
}
return members;
} |
1783046_2 | @Override
public Set<String> discoverMembers() {
LOGGER.debug("CELLAR KUBERNETES: query pods with labeled with [{}={}]", kubernetesPodLabelKey, kubernetesPodLabelValue);
Set<String> members = new HashSet<String>();
try {
PodList podList = kubernetesClient.pods().list();
for (Pod pod : podList.getItems()) {
String value = pod.getMetadata().getLabels().get(kubernetesPodLabelKey);
if (value != null && !value.isEmpty() && value.equals(kubernetesPodLabelValue)) {
members.add(pod.getStatus().getPodIP());
}
}
} catch (Exception e) {
LOGGER.error("CELLAR KUBERNETES: can't get pods", e);
}
return members;
} |
1783046_3 | public boolean matches(String filter) {
Filter f;
try {
f = FrameworkUtil.createFilter(filter);
} catch (InvalidSyntaxException e) {
IllegalArgumentException iae = new IllegalArgumentException(e.getMessage());
iae.initCause(e);
throw iae;
}
Dictionary dictionary = new Properties();
for (Map.Entry<String, Object> entry : properties.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
dictionary.put(key, value);
}
/*
* we can use matchCase here since properties already supports case
* insensitive key lookup.
*/
return f.matchCase(dictionary);
} |
1783046_4 | public Set<String> getServiceInterfaces(Object service, String[] services) {
Set<String> interfaceList = new LinkedHashSet<String>();
if (service != null && services != null && services.length > 0) {
for (String s : services) {
if (Constants.ALL_INTERFACES.equals(s)) {
Class[] classes = service.getClass().getInterfaces();
if (classes != null && classes.length > 0) {
for (Class c : classes) {
interfaceList.add(c.getCanonicalName());
}
}
} else {
try {
ClassLoader classLoader = null;
if (service.getClass() != null && service.getClass().getClassLoader() != null) {
classLoader = service.getClass().getClassLoader();
} else {
classLoader = ClassLoader.getSystemClassLoader();
}
Class clazz = classLoader.loadClass(s);
String ifaceName = clazz.getCanonicalName();
interfaceList.add(ifaceName);
} catch (ClassNotFoundException e) {
LOGGER.error("CELLAR DOSGI: could not load class", e);
}
}
}
}
return interfaceList;
} |
1783046_5 | public boolean isUpdated(Map properties) {
Boolean updated = Boolean.FALSE;
if (properties != null) {
if (properties.containsKey(Discovery.DISCOVERED_MEMBERS_PROPERTY_NAME)) {
Set<String> newDiscoveredMemberSet = CellarUtils.createSetFromString((String) properties.get(Discovery.DISCOVERED_MEMBERS_PROPERTY_NAME));
if (!CellarUtils.collectionEquals(discoveredMemberSet, newDiscoveredMemberSet)) {
LOGGER.debug("Hazelcast discoveredMemberSet has been changed from {} to {}", discoveredMemberSet, newDiscoveredMemberSet);
discoveredMemberSet = newDiscoveredMemberSet;
for (String discoveredMember:discoveredMemberSet) {
if (discoveredMember != null && !String.valueOf(discoveredMember).equals("null") && !tcpIpConfig.getMembers().contains(discoveredMember)) {
tcpIpConfig.getMembers().add(discoveredMember);
}
}
Iterator<String> iterator = tcpIpConfig.getMembers().iterator();
while (iterator.hasNext()) {
String member = iterator.next();
if (!discoveredMemberSet.contains(member)) {
iterator.remove();
}
}
updated = Boolean.TRUE;
}
}
}
return updated;
} |
1783046_6 | public boolean isUpdated(Map properties) {
Boolean updated = Boolean.FALSE;
if (properties != null) {
if (properties.containsKey(Discovery.DISCOVERED_MEMBERS_PROPERTY_NAME)) {
Set<String> newDiscoveredMemberSet = CellarUtils.createSetFromString((String) properties.get(Discovery.DISCOVERED_MEMBERS_PROPERTY_NAME));
if (!CellarUtils.collectionEquals(discoveredMemberSet, newDiscoveredMemberSet)) {
LOGGER.debug("Hazelcast discoveredMemberSet has been changed from {} to {}", discoveredMemberSet, newDiscoveredMemberSet);
discoveredMemberSet = newDiscoveredMemberSet;
for (String discoveredMember:discoveredMemberSet) {
if (discoveredMember != null && !String.valueOf(discoveredMember).equals("null") && !tcpIpConfig.getMembers().contains(discoveredMember)) {
tcpIpConfig.getMembers().add(discoveredMember);
}
}
Iterator<String> iterator = tcpIpConfig.getMembers().iterator();
while (iterator.hasNext()) {
String member = iterator.next();
if (!discoveredMemberSet.contains(member)) {
iterator.remove();
}
}
updated = Boolean.TRUE;
}
}
}
return updated;
} |
1783046_7 | public static boolean collectionEquals(Collection col1, Collection col2) {
return collectionSubset(col1, col2) && collectionSubset(col2, col1);
} |
1783046_8 | public static String createStringFromSet(Set<String> items, boolean mergeable) {
StringBuilder builder = new StringBuilder();
Iterator<String> iterator = items.iterator();
while (iterator.hasNext()) {
builder.append(iterator.next());
if (iterator.hasNext()) {
builder.append(",");
}
}
if (mergeable) {
return String.format(MERGABLE, builder.toString());
} else {
return builder.toString();
}
} |
1783046_9 | public Boolean isAllowed(Group group, String category, String event, EventType type) {
Set<String> whiteList = getListEntries(Configurations.WHITELIST, group, category, type);
Set<String> blackList = getListEntries(Configurations.BLACKLIST, group, category, type);
if (blackList == null || whiteList == null) {
// If one list is missing, we probably have a configuration issue - do not synchronize anything
LOGGER.warn("No whitelist/blacklist found for " + group.getName() + ", check your configuration !");
return false;
}
// if no white listed items we assume all are accepted.
Boolean result = true;
if (!whiteList.isEmpty()) {
result = false;
for (String whiteListItem : whiteList) {
if (wildCardMatch(event, whiteListItem)) {
result = true;
break;
}
}
}
if (result) {
// we passed whitelist, now check the blacklist
// if any blackList item matched, then false is returned.
for (String blackListItem : blackList) {
if (wildCardMatch(event, blackListItem)) {
return false;
}
}
}
return result;
} |
1783083_0 | public static String formatSize(String size) {
if (size != null) {
String incomingSize = size.trim();
if (incomingSize.length() > 0) {
char lastChar = incomingSize.charAt(incomingSize.length() - 1);
if (Character.isDigit(lastChar)) {
return incomingSize + "px";
}
}
}
return size;
} |
1783083_1 | public ResourceBundle getBundle(Enum<?> messageKey, Locale locale) throws MissingResourceException,
IllegalArgumentException {
MessageBundle bundleAnnotation = asMessageBundle(messageKey);
return ResourceBundle.getBundle(bundleAnnotation.baseName(), locale, getClassLoader());
} |
1783083_2 | public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, Locale locale)
throws MissingResourceException {
if (facesContext == null) {
throw new MissingResourceException("FacesContext is null", getClass().getName(), messageKey.toString());
}
Application application = facesContext.getApplication();
if (application == null || application.getMessageBundle() == null) {
throw new MissingResourceException("Cannot read message bundle name from application", getClass().getName(),
messageKey.toString());
}
return ResourceBundle.getBundle(application.getMessageBundle(), locale, getClassLoader());
} |
1783083_3 | public static String escapeCSSMetachars(String s) {
if (s == null || s.length() == 0) {
return s;
}
StringBuilder builder = new StringBuilder();
int start = 0;
int idx = 0;
int length = s.length();
for (; idx < length; idx++) {
char c = s.charAt(idx);
int searchIdx = Arrays.binarySearch(CSS_SELECTOR_CHARS_TO_ESCAPE, c);
if (searchIdx >= 0) {
builder.append(s.substring(start, idx));
builder.append("\\");
builder.append(c);
start = idx + 1;
}
}
builder.append(s.substring(start, idx));
return builder.toString();
} |
1783083_4 | public static String toScript(Object obj) {
StringBuilder sb = new StringBuilder();
if ((obj != null) && (obj instanceof String))
sb.ensureCapacity((int)(((String) obj).length() * 1.66));
try {
appendScript(sb, obj, new IdentityHashMap<Object, Boolean>());
} catch (IOException e) {
// ignore
}
return sb.toString();
} |
1783083_5 | public static String getMD5scriptHash(String script) {
byte[] bytesOfScript = new byte[0];
try {
bytesOfScript = script.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 appears to be an unsupported character set on this platform", e);
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Unable to locate MD5 hash algorithm", e);
}
md.reset();
//byte[] thedigest = md.digest(bytesOfScript);
md.update(bytesOfScript);
byte[] messageDigest = md.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++) {
String hex = Integer.toHexString(0xFF & messageDigest[i]);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString();
} |
1783083_6 | static String getLocation() {
if (getStaticResourceLocation() != null) {
return getStaticResourceLocation();
}
return getConfiguration(CoreConfiguration.Items.resourceMappingLocation);
} |
1783083_7 | static String getLocation() {
if (getStaticResourceLocation() != null) {
return getStaticResourceLocation();
}
return getConfiguration(CoreConfiguration.Items.resourceMappingLocation);
} |
1783083_8 | static String getLocation() {
if (getStaticResourceLocation() != null) {
return getStaticResourceLocation();
}
return getConfiguration(CoreConfiguration.Items.resourceMappingLocation);
} |
1783083_9 | static String getLocation() {
if (getStaticResourceLocation() != null) {
return getStaticResourceLocation();
}
return getConfiguration(CoreConfiguration.Items.resourceMappingLocation);
} |
1784308_0 | @Override
public List<Rule> getRules() {
return Collections.unmodifiableList(rules);
} |
1784308_1 | public void addRule(Rule rule) {
rules.add(rule);
} |
1784308_2 | public BasicRuleSet withRule(Rule rule) {
addRule(rule);
return this;
} |
1784308_3 | @Override
public String toString() {
return getClass().getSimpleName() + "[" + (rules.isEmpty() ? "<Empty RuleSet>" : StringUtils.join(collectRuleNames(), ", ")) + "]";
} |
1784308_4 | public static void notNull(Object object) {
notNull("Parameter may not be null.", object);
} |
1784308_5 | public static void notNull(Object object) {
notNull("Parameter may not be null.", object);
} |
1784308_6 | public static void notNull(Object object) {
notNull("Parameter may not be null.", object);
} |
1784308_7 | public static void notNull(Object object) {
notNull("Parameter may not be null.", object);
} |
1784308_8 | public static void notNull(Object object) {
notNull("Parameter may not be null.", object);
} |
1784308_9 | public static void notEmpty(String string) {
notEmpty("Parameter may not be null or empty.", string);
} |
1784501_0 | @Override
public boolean equals(Object t) {
if (t == null || getClass() != t.getClass()) {
return false;
} else {
ColumnType other = (ColumnType) t;
return m_type == other.getType() && Objects.equals(m_typeCode, other.getTypeCode());
}
} |
1795594_0 | public StreamingHttpRequest append(HttpChunk httpChunk) {
if (currentRequest.append(httpChunk)) {
HttpChunk incompleteHttpChunk = currentRequest.httpChunks.remove(currentRequest.httpChunks.size() - 1);
Map<Boolean, List<AwsChunk>> awsChunkPartition = currentRequest.awsChunks.stream().collect(partitioningBy(AwsChunk::isComplete));
List<AwsChunk> completeAwsChunks = awsChunkPartition.get(Boolean.TRUE);
List<AwsChunk> incompleteAwsChunks = awsChunkPartition.get(Boolean.FALSE);
StreamingHttpRequest result = currentRequest;
result.awsChunks = completeAwsChunks;
currentRequest = new StreamingHttpRequest(incompleteHttpChunk, incompleteAwsChunks);
return result;
} else {
return null;
}
} |
1795594_1 | public StreamingHttpRequest append(HttpChunk httpChunk) {
if (currentRequest.append(httpChunk)) {
HttpChunk incompleteHttpChunk = currentRequest.httpChunks.remove(currentRequest.httpChunks.size() - 1);
Map<Boolean, List<AwsChunk>> awsChunkPartition = currentRequest.awsChunks.stream().collect(partitioningBy(AwsChunk::isComplete));
List<AwsChunk> completeAwsChunks = awsChunkPartition.get(Boolean.TRUE);
List<AwsChunk> incompleteAwsChunks = awsChunkPartition.get(Boolean.FALSE);
StreamingHttpRequest result = currentRequest;
result.awsChunks = completeAwsChunks;
currentRequest = new StreamingHttpRequest(incompleteHttpChunk, incompleteAwsChunks);
return result;
} else {
return null;
}
} |
1795594_2 | static String buildCanonicalResourcePath(String path) {
if (path == null || path.isEmpty())
return "/";
if (path.startsWith("/"))
return path;
else
return "/".concat(path);
} |
1795594_3 | static String buildCanonicalResourcePath(String path) {
if (path == null || path.isEmpty())
return "/";
if (path.startsWith("/"))
return path;
else
return "/".concat(path);
} |
1795594_4 | static String getUnverifiedPayloadHash( final MappingHttpRequest request) throws AccessDeniedException {
final String contentShaHeader = request.getHeader(S3V4Authentication.AWS_CONTENT_SHA_HEADER);
if ( !Strings.isNullOrEmpty(contentShaHeader) ) {
if ( !STREAMING_PAYLOAD.equals(contentShaHeader) && !UNSIGNED_PAYLOAD.equals(contentShaHeader) ) {
final byte[] binSha256 = BaseEncoding.base16( ).lowerCase( ).decode( contentShaHeader );
if ( binSha256.length != 32 ) {
throw new AccessDeniedException(null, "x-amz-content-sha256 header is invalid.");
}
}
} else {
throw new AccessDeniedException( null, "x-amz-content-sha256 header is missing." );
}
return contentShaHeader;
} |
1795594_5 | static void buildCanonicalHeaders(MappingHttpRequest request, String signedHeaders, StringBuilder sb) {
for (String header : signedHeaders.split(";")) {
List<String> values = Lists.transform(request.getHeaders(header), text -> text != null ? text.trim() : null);
sb.append(header.toLowerCase());
sb.append(':');
sb.append(Joiner.on(',').join(Ordering.<String>natural().sortedCopy(values)));
sb.append('\n');
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.