_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q177200 | AbstractProfileMBeanImpl.writeMode | test | private void writeMode() throws SLEEException, ManagementException {
if (!isProfileWriteable()) {
if (logger.isDebugEnabled()) {
logger.debug("Changing state to read-write, for profile mbean with name " + profileName + ", from table with name " + this.profileTable.getProfileTableName());
}
// get object & make it writable
ProfileObjectImpl profileObject = profileTable.getProfile(profileName);
profileObject.getProfileEntity().setReadOnly(false);
// change state
state = State.write;
} else {
if (logger.isDebugEnabled()) {
logger.debug("Already in write state, for profile mbean with name " + profileName + ", from table with name " + this.profileTable.getProfileTableName());
}
}
} | java | {
"resource": ""
} |
q177201 | AbstractProfileMBeanImpl.beforeSetCmpField | test | protected void beforeSetCmpField() throws ManagementException, InvalidStateException {
if (logger.isDebugEnabled()) {
logger.debug("beforeSetCmpField() on profile with name " + profileName + " of table " + profileTable.getProfileTableName());
}
if (isProfileWriteable()) {
try {
sleeContainer.getTransactionManager().resume(transaction);
} catch (Throwable e) {
throw new ManagementException(e.getMessage(), e);
}
} else {
throw new InvalidStateException();
}
} | java | {
"resource": ""
} |
q177202 | AbstractProfileMBeanImpl.afterSetCmpField | test | protected void afterSetCmpField() throws ManagementException {
if (logger.isDebugEnabled()) {
logger.debug("afterSetCmpField() on profile with name " + profileName + " of table " + profileTable.getProfileTableName());
}
try {
sleeContainer.getTransactionManager().suspend();
} catch (Throwable e) {
throw new ManagementException(e.getMessage(), e);
}
} | java | {
"resource": ""
} |
q177203 | AbstractProfileMBeanImpl.beforeGetCmpField | test | protected boolean beforeGetCmpField() throws ManagementException {
if (logger.isDebugEnabled()) {
logger.debug("beforeGetCmpField() on profile with name " + profileName + " of table " + profileTable.getProfileTableName());
}
return beforeNonSetCmpField();
} | java | {
"resource": ""
} |
q177204 | AbstractProfileMBeanImpl.afterGetCmpField | test | protected void afterGetCmpField(boolean activatedTransaction) throws ManagementException {
if (logger.isDebugEnabled()) {
logger.debug("afterGetCmpField( activatedTransaction = " + activatedTransaction + " ) on profile with name " + profileName + " of table " + profileTable.getProfileTableName());
}
afterNonSetCmpField(activatedTransaction);
} | java | {
"resource": ""
} |
q177205 | AbstractProfileMBeanImpl.beforeManagementMethodInvocation | test | protected boolean beforeManagementMethodInvocation() throws ManagementException {
if (logger.isDebugEnabled()) {
logger.debug("beforeManagementMethodInvocation() on profile with name " + profileName + " of table " + profileTable.getProfileTableName());
}
jndiManagement = sleeContainer.getJndiManagement();
jndiManagement.pushJndiContext(profileTable.getProfileSpecificationComponent());
return beforeNonSetCmpField();
} | java | {
"resource": ""
} |
q177206 | AbstractProfileMBeanImpl.afterManagementMethodInvocation | test | protected void afterManagementMethodInvocation(boolean activatedTransaction) throws ManagementException {
if (logger.isDebugEnabled()) {
logger.debug("afterManagementMethodInvocation( activatedTransaction = " + activatedTransaction + " ) on profile with name " + profileName + " of table " + profileTable.getProfileTableName());
}
afterNonSetCmpField(activatedTransaction);
jndiManagement.popJndiContext();
} | java | {
"resource": ""
} |
q177207 | DeployableUnitImpl.deletePath | test | private void deletePath(File path) {
if (path.isDirectory()) {
File[] files = path.listFiles();
if (files != null) {
for (File file : files) {
deletePath(file);
}
}
}
path.delete();
} | java | {
"resource": ""
} |
q177208 | ConcreteSbbGenerator.createDefaultConstructor | test | protected void createDefaultConstructor() throws DeploymentException {
CtConstructor defaultConstructor = new CtConstructor(null,
sbbConcreteClass);
// We need a "do nothing" constructor because the
// convergence name creation method may need to actually
// create the object instance to run the method that
// creates the convergence name.
String constructorBody = "{ }";
try {
defaultConstructor.setBody(constructorBody);
sbbConcreteClass.addConstructor(defaultConstructor);
logger.trace("DefaultConstructor created");
} catch (CannotCompileException e) {
throw new DeploymentException(e.getMessage(), e);
}
} | java | {
"resource": ""
} |
q177209 | ConcreteSbbGenerator.createDefaultUsageParameterGetter | test | private void createDefaultUsageParameterGetter(CtClass sbbConcrete)
throws DeploymentException {
String methodName = "getDefaultSbbUsageParameterSet";
CtMethod method = (CtMethod) abstractMethods.get(methodName);
if (method == null) {
method = (CtMethod) superClassesAbstractMethods.get(methodName);
}
if (method != null) {
try {
// copy method from abstract to concrete class
CtMethod concreteMethod = CtNewMethod.copy(method,
sbbConcreteClass, null);
// create the method body
String concreteMethodBody = "{ return ($r)"
+ SbbAbstractMethodHandler.class.getName()
+ ".getDefaultSbbUsageParameterSet(sbbEntity); }";
if (logger.isTraceEnabled()) {
logger.trace("Generated method " + methodName
+ " , body = " + concreteMethodBody);
}
concreteMethod.setBody(concreteMethodBody);
sbbConcreteClass.addMethod(concreteMethod);
} catch (CannotCompileException cce) {
throw new SLEEException("Cannot compile method "
+ method.getName(), cce);
}
}
} | java | {
"resource": ""
} |
q177210 | ConcreteSbbGenerator.createSbbEntityGetterAndSetter | test | private void createSbbEntityGetterAndSetter(CtClass sbbConcrete)
throws DeploymentException {
try {
CtMethod getSbbEntity = CtNewMethod
.make("public " + SbbEntity.class.getName()
+ " getSbbEntity() { return this.sbbEntity; }",
sbbConcrete);
getSbbEntity.setModifiers(Modifier.PUBLIC);
sbbConcrete.addMethod(getSbbEntity);
CtMethod setSbbEntity = CtNewMethod.make(
"public void setSbbEntity ( " + SbbEntity.class.getName()
+ " sbbEntity )" + "{"
+ "this.sbbEntity = sbbEntity;" + "}", sbbConcrete);
setSbbEntity.setModifiers(Modifier.PUBLIC);
sbbConcrete.addMethod(setSbbEntity);
} catch (Exception e) {
throw new DeploymentException(e.getMessage(), e);
}
} | java | {
"resource": ""
} |
q177211 | ConcreteSbbGenerator.createFireEventMethods | test | protected void createFireEventMethods(Collection<EventEntryDescriptor> mEventEntries) {
if (mEventEntries == null)
return;
for (EventEntryDescriptor mEventEntry : mEventEntries) {
if (mEventEntry.isFired()) {
String methodName = "fire" + mEventEntry.getEventName();
CtMethod method = (CtMethod) abstractMethods.get(methodName);
if (method == null) {
method = (CtMethod) superClassesAbstractMethods
.get(methodName);
}
if (method != null) {
try {
// copy method from abstract to concrete class
CtMethod concreteMethod = CtNewMethod.copy(method,
sbbConcreteClass, null);
// create the method body
String concreteMethodBody = "{";
concreteMethodBody += getEventTypeIDInstantionString(mEventEntry);
concreteMethodBody += SbbAbstractMethodHandler.class
.getName()
+ ".fireEvent(sbbEntity,eventTypeID";
for (int i = 0; i < method.getParameterTypes().length; i++) {
concreteMethodBody += ",$" + (i + 1);
}
concreteMethodBody += ");}";
if (logger.isTraceEnabled()) {
logger.trace("Generated method " + methodName
+ " , body = " + concreteMethodBody);
}
concreteMethod.setBody(concreteMethodBody);
sbbConcreteClass.addMethod(concreteMethod);
} catch (Exception e) {
throw new SLEEException("Cannot compile method "
+ method.getName(), e);
}
}
}
}
} | java | {
"resource": ""
} |
q177212 | ConcreteSbbGenerator.createGetSbbActivityContextInterfaceMethod | test | protected void createGetSbbActivityContextInterfaceMethod(
CtClass activityContextInterface,
Class<?> concreteActivityContextInterfaceClass)
throws DeploymentException {
String methodToAdd = "public "
+ activityContextInterface.getName()
+ " asSbbActivityContextInterface(javax.slee.ActivityContextInterface aci) {"
+ "if(aci==null)"
+ " throw new "
+ IllegalStateException.class.getName()
+ "(\"Passed argument can not be of null value.\");"
+ " if(sbbEntity == null || sbbEntity.getSbbObject().getState() != "
+ SbbObjectState.class.getName() + ".READY) { throw new "
+ IllegalStateException.class.getName()
+ "(\"Cannot call asSbbActivityContextInterface\"); } "
+ "else if ( aci instanceof "
+ concreteActivityContextInterfaceClass.getName()
+ ") return aci;" + "else return new "
+ concreteActivityContextInterfaceClass.getName() + " ( (" + ActivityContextInterface.class.getName() + ") $1, "
+ "sbbEntity.getSbbComponent());" + "}";
CtMethod methodTest;
try {
methodTest = CtNewMethod.make(methodToAdd, sbbConcreteClass);
sbbConcreteClass.addMethod(methodTest);
if (logger.isTraceEnabled()) {
logger.trace("Method " + methodToAdd + " added");
}
} catch (CannotCompileException e) {
throw new DeploymentException(e.getMessage(), e);
}
} | java | {
"resource": ""
} |
q177213 | CompositeQueryExpression.add | test | protected final void add(QueryExpression expr) throws NullPointerException, IllegalArgumentException {
if (expr == null) throw new NullPointerException("expr is null");
// check for cycles
if (expr instanceof CompositeQueryExpression) {
((CompositeQueryExpression)expr).checkForCycles(this);
}
else if (expr instanceof Not) {
((Not)expr).checkForCycles(this);
}
// no cycles, so add the expression to the list
exprs.add(expr);
} | java | {
"resource": ""
} |
q177214 | NonSerializableFactory.bind | test | public static synchronized void bind(String key, Object target) throws NameAlreadyBoundException
{
if( wrapperMap.containsKey(key) == true )
throw new NameAlreadyBoundException(key+" already exists in the NonSerializableFactory map");
wrapperMap.put(key, target);
} | java | {
"resource": ""
} |
q177215 | NonSerializableFactory.rebind | test | public static synchronized void rebind(Name name, Object target) throws NamingException
{
rebind(name, target, false);
} | java | {
"resource": ""
} |
q177216 | SbbAbstractClassDecorator.decorateAbstractSbb | test | public boolean decorateAbstractSbb() throws DeploymentException {
ClassPool pool = component.getClassPool();
String sbbAbstractClassName = component.getDescriptor().getSbbAbstractClass().getSbbAbstractClassName();
try {
sbbAbstractClass = pool.get(sbbAbstractClassName);
} catch (NotFoundException nfe) {
throw new DeploymentException("Could not find Abstract Sbb Class: "
+ sbbAbstractClassName, nfe);
}
// populate the list of concrete methods. It will be needed by the
// decorating methods.
concreteMethods = new HashMap();
CtMethod[] methods = sbbAbstractClass.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
int mods = methods[i].getModifiers();
if (!Modifier.isAbstract(mods) && !Modifier.isNative(mods)) {
concreteMethods.put(methods[i].getName() + methods[i].getSignature(), methods[i]);
}
}
decorateENCBindCalls();
decorateNewThreadCalls();
if (isAbstractSbbClassDecorated) {
try {
String deployDir = component.getDeploymentDir().getAbsolutePath();
sbbAbstractClass.writeFile(deployDir);
sbbAbstractClass.detach();
// the file on disk is now in sync with the latest in-memory version
if (logger.isDebugEnabled()) {
logger.debug("Modified Abstract Class "
+ sbbAbstractClass.getName()
+ " generated in the following path "
+ deployDir);
}
//} catch (NotFoundException e) {
// String s = "Error writing modified abstract sbb class";
// logger.error(s,e);
// throw new DeploymentException (s,e);
} catch (Throwable e) {
throw new SLEEException ( e.getMessage(), e);
} finally {
sbbAbstractClass.defrost();
}
return true;
}
else {
return false;
}
} | java | {
"resource": ""
} |
q177217 | SbbLocalObjectInterceptor.invokeAndReturnvoid | test | public void invokeAndReturnvoid(SbbConcrete proxy, String methodName,
Object[] args, Class<?>[] argTypes) throws Exception {
invokeAndReturnObject(proxy, methodName, args, argTypes);
} | java | {
"resource": ""
} |
q177218 | SbbActivityContextInterfaceImpl.getRealFieldName | test | private String getRealFieldName(String fieldName) {
String realFieldName = sbbComponent.getDescriptor()
.getActivityContextAttributeAliases().get(fieldName);
if (realFieldName == null) {
// not there then it has no alias, lets set one based on sbb id
realFieldName = sbbComponent.getSbbID().toString() + "."
+ fieldName;
final Map<String, String> aliases = sbbComponent.getDescriptor()
.getActivityContextAttributeAliases();
synchronized (aliases) {
aliases.put(fieldName, realFieldName);
}
}
return realFieldName;
} | java | {
"resource": ""
} |
q177219 | SbbActivityContextInterfaceImpl.setFieldValue | test | public void setFieldValue(String fieldName, Object value) {
String realFieldName = getRealFieldName(fieldName);
aciImpl.getActivityContext().setDataAttribute(realFieldName, value);
} | java | {
"resource": ""
} |
q177220 | SbbActivityContextInterfaceImpl.getFieldValue | test | public Object getFieldValue(String fieldName, Class<?> returnType) {
String realFieldName = getRealFieldName(fieldName);
Object value = aciImpl.getActivityContext().getDataAttribute(
realFieldName);
if (value == null) {
if (returnType.isPrimitive()) {
if (returnType.equals(Integer.TYPE)) {
return Integer.valueOf(0);
} else if (returnType.equals(Boolean.TYPE)) {
return Boolean.FALSE;
} else if (returnType.equals(Long.TYPE)) {
return Long.valueOf(0);
} else if (returnType.equals(Double.TYPE)) {
return Double.valueOf(0);
} else if (returnType.equals(Float.TYPE)) {
return Float.valueOf(0);
}
}
}
return value;
} | java | {
"resource": ""
} |
q177221 | ProfileObjectImpl.setProfileContext | test | public void setProfileContext(ProfileContextImpl profileContext) {
if(logger.isTraceEnabled()) {
logger.trace("[setProfileContext] "+this);
}
if (profileContext == null) {
throw new NullPointerException("Passed context must not be null.");
}
if (state != ProfileObjectState.DOES_NOT_EXIST) {
throw new IllegalStateException("Wrong state: " + this.state + ",on profile set context operation, for profile table: "
+ this.profileTable.getProfileTableName() + " with specification: " + this.profileTable.getProfileSpecificationComponent().getProfileSpecificationID());
}
this.profileContext = profileContext;
this.profileContext.setProfileObject(this);
if (profileConcreteClassInfo.isInvokeSetProfileContext()) {
final ClassLoader oldClassLoader = SleeContainerUtils.getCurrentThreadClassLoader();
try {
final ClassLoader cl = this.profileTable.getProfileSpecificationComponent().getClassLoader();
if (System.getSecurityManager()!=null) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
Thread.currentThread().setContextClassLoader(cl);
return null;
}
});
}
else {
Thread.currentThread().setContextClassLoader(cl);
}
try {
if (isSlee11) {
try {
profileConcrete.setProfileContext(profileContext);
}
catch (RuntimeException e) {
runtimeExceptionOnProfileInvocation(e);
}
}
}
catch (Exception e) {
if (logger.isDebugEnabled())
logger.debug("Exception encountered while setting profile context for profile table: "
+ this.profileTable.getProfileTableName() + " with specification: " + this.profileTable.getProfileSpecificationComponent().getProfileSpecificationID(), e);
}
}
finally {
if (System.getSecurityManager()!=null) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
Thread.currentThread().setContextClassLoader(oldClassLoader);
return null;
}
});
}
else {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
}
}
state = ProfileObjectState.POOLED;
} | java | {
"resource": ""
} |
q177222 | ProfileObjectImpl.profileInitialize | test | private void profileInitialize(String profileName) {
if(logger.isTraceEnabled()) {
logger.trace("[profileInitialize] "+this+" , profileName = "+profileName);
}
if (this.state != ProfileObjectState.POOLED) {
throw new SLEEException(this.toString());
}
if (profileName == null) {
// default profile creation
// create instance of entity
profileEntity = profileEntityFramework.getProfileEntityFactory().newInstance(profileTable.getProfileTableName(), null);
// change state
this.state = ProfileObjectState.PROFILE_INITIALIZATION;
// invoke life cycle method on profile
if (profileConcreteClassInfo.isInvokeProfileInitialize()) {
try {
profileConcrete.profileInitialize();
}
catch (RuntimeException e) {
runtimeExceptionOnProfileInvocation(e);
}
}
}
else {
// load the default profile entity
if (logger.isTraceEnabled()) {
logger.trace("Copying state from default profile on object "+this);
}
profileEntity = cloneEntity(profileTable.getDefaultProfileEntity());
profileEntity.setProfileName(profileName);
}
// mark entity as dirty and for creation
profileEntity.create();
profileEntity.setDirty(true);
} | java | {
"resource": ""
} |
q177223 | ProfileObjectImpl.unsetProfileContext | test | public void unsetProfileContext() {
if(logger.isTraceEnabled()) {
logger.trace("[unsetProfileContext] "+this);
}
if (state == ProfileObjectState.POOLED && profileConcreteClassInfo.isInvokeUnsetProfileContext()) {
final ClassLoader oldClassLoader = SleeContainerUtils.getCurrentThreadClassLoader();
try {
final ClassLoader cl = profileTable.getProfileSpecificationComponent().getClassLoader();
if (System.getSecurityManager()!=null) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
Thread.currentThread().setContextClassLoader(cl);
return null;
}
});
}
else {
Thread.currentThread().setContextClassLoader(cl);
}
if (isSlee11) {
try {
profileConcrete.unsetProfileContext();
}
catch (RuntimeException e) {
runtimeExceptionOnProfileInvocation(e);
}
}
profileContext.setProfileObject(null);
state = ProfileObjectState.DOES_NOT_EXIST;
}
finally {
if (System.getSecurityManager()!=null) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
Thread.currentThread().setContextClassLoader(oldClassLoader);
return null;
}
});
}
else {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
}
}
} | java | {
"resource": ""
} |
q177224 | ProfileObjectImpl.getProfileLocalObject | test | public ProfileLocalObject getProfileLocalObject() {
final Class<?> profileLocalObjectConcreteClass = profileTable.getProfileSpecificationComponent().getProfileLocalObjectConcreteClass();
ProfileLocalObject profileLocalObject = null;
if (profileLocalObjectConcreteClass == null) {
profileLocalObject = new ProfileLocalObjectImpl(this);
}
else {
try {
profileLocalObject = (ProfileLocalObject) profileLocalObjectConcreteClass.getConstructor(ProfileObjectImpl.class).newInstance(this);
} catch (Throwable e) {
throw new SLEEException(e.getMessage(),e);
}
}
return profileLocalObject;
} | java | {
"resource": ""
} |
q177225 | ProfileObjectImpl.fireAddOrUpdatedEventIfNeeded | test | public void fireAddOrUpdatedEventIfNeeded() {
if (state == ProfileObjectState.READY) {
if (profileEntity.isDirty()) {
// check the table fires events and the object is not assigned to a default profile
if (profileTable.doesFireEvents() && profileEntity.getProfileName() != null && profileTable.getSleeContainer().getSleeState() == SleeState.RUNNING) {
// Fire a Profile Added or Updated Event
ActivityContext ac = profileTable.getActivityContext();
AbstractProfileEvent event = null;
if (profileEntity.isCreate()) {
if (persisted) {
event = new ProfileAddedEventImpl(profileEntity,profileTable.getProfileManagement());
persisted = false;
if (logger.isTraceEnabled()) {
logger.trace("firing profile added event for profile named "+profileEntity);
}
}
else {
return;
}
}
else {
event = new ProfileUpdatedEventImpl(profileEntitySnapshot,profileEntity,profileTable.getProfileManagement());
if (logger.isTraceEnabled()) {
logger.trace("firing profile updated event for profile named "+profileEntity);
}
}
ac.fireEvent(event.getEventTypeID(), event,
event.getProfileAddress(), null, null,null,null);
}
}
}
} | java | {
"resource": ""
} |
q177226 | ProfileObjectImpl.getProfileCmpSlee10Wrapper | test | public AbstractProfileCmpSlee10Wrapper getProfileCmpSlee10Wrapper() {
if (profileCmpSlee10Wrapper == null) {
try {
profileCmpSlee10Wrapper = (AbstractProfileCmpSlee10Wrapper) profileTable.getProfileSpecificationComponent().getProfileCmpSlee10WrapperClass().getConstructor(ProfileObjectImpl.class).newInstance(this);
} catch (Throwable e) {
throw new SLEEException(e.getMessage(),e);
}
}
return profileCmpSlee10Wrapper;
} | java | {
"resource": ""
} |
q177227 | ClassGeneratorUtils.createClass | test | public static CtClass createClass(String className, String[] interfaces) throws Exception
{
if(className == null)
{
throw new NullPointerException("Class name cannot be null");
}
CtClass clazz = classPool.makeClass(className);
if(interfaces != null && interfaces.length > 0)
{
clazz.setInterfaces( classPool.get( interfaces ) );
}
return clazz;
} | java | {
"resource": ""
} |
q177228 | ClassGeneratorUtils.createInheritanceLink | test | public static void createInheritanceLink(CtClass concreteClass, String superClassName)
{
if(superClassName != null && superClassName.length() >= 0)
{
try
{
concreteClass.setSuperclass(classPool.get(superClassName));
}
catch ( CannotCompileException e ) {
e.printStackTrace();
}
catch ( NotFoundException e ) {
e.printStackTrace();
}
}
} | java | {
"resource": ""
} |
q177229 | ClassGeneratorUtils.addAnnotation | test | public static void addAnnotation(String annotation, LinkedHashMap<String, Object> memberValues, Object toAnnotate)
{
if(toAnnotate instanceof CtClass)
{
CtClass classToAnnotate = (CtClass) toAnnotate;
ClassFile cf = classToAnnotate.getClassFile();
ConstPool cp = cf.getConstPool();
AnnotationsAttribute attr = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
if(attr == null)
{
attr = new AnnotationsAttribute(cp, AnnotationsAttribute.visibleTag);
}
Annotation a = new Annotation(annotation, cp);
if(memberValues != null)
{
addMemberValuesToAnnotation(a, cp, memberValues);
}
attr.addAnnotation( a );
cf.addAttribute( attr );
}
else if(toAnnotate instanceof CtMethod)
{
CtMethod methodToAnnotate = (CtMethod) toAnnotate;
MethodInfo mi = methodToAnnotate.getMethodInfo();
ConstPool cp = mi.getConstPool();
AnnotationsAttribute attr = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
if(attr == null)
{
attr = new AnnotationsAttribute(cp, AnnotationsAttribute.visibleTag);
}
Annotation a = new Annotation(annotation, cp);
if(memberValues != null)
{
addMemberValuesToAnnotation(a, cp, memberValues);
}
attr.addAnnotation( a );
mi.addAttribute( attr );
}
else if(toAnnotate instanceof CtField)
{
CtField fieldToAnnotate = (CtField) toAnnotate;
FieldInfo fi = fieldToAnnotate.getFieldInfo();
ConstPool cp = fi.getConstPool();
AnnotationsAttribute attr = (AnnotationsAttribute) fi.getAttribute(AnnotationsAttribute.visibleTag);
if(attr == null)
{
attr = new AnnotationsAttribute(cp, AnnotationsAttribute.visibleTag);
}
Annotation a = new Annotation(annotation, cp);
if(memberValues != null)
{
addMemberValuesToAnnotation(a, cp, memberValues);
}
attr.addAnnotation( a );
fi.addAttribute( attr );
}
else
{
throw new UnsupportedOperationException("Unknown object type: " + toAnnotate.getClass());
}
} | java | {
"resource": ""
} |
q177230 | ClassGeneratorUtils.addMemberValuesToAnnotation | test | private static void addMemberValuesToAnnotation(Annotation annotation, ConstPool cp, LinkedHashMap<String, Object> memberValues)
{
// Get the member value object
for(String mvName : memberValues.keySet())
{
Object mvValue = memberValues.get(mvName);
MemberValue mv = getMemberValue(mvValue, cp);
annotation.addMemberValue( mvName, mv );
}
} | java | {
"resource": ""
} |
q177231 | AbstractActivityContextInterfaceFactory.getACI | test | protected ActivityContextInterface getACI(Object activity)
throws NullPointerException, UnrecognizedActivityException,
FactoryException {
if (activity == null) {
throw new NullPointerException("null activity object");
}
ActivityHandle handle = null;
for (ResourceAdaptorEntity raEntity : sleeContainer
.getResourceManagement().getResourceAdaptorEntitiesPerType(resourceAdaptorTypeID)) {
handle = raEntity.getResourceAdaptorObject().getActivityHandle(
activity);
if (handle != null) {
ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl(raEntity, handle);
ActivityContext ac = sleeContainer.getActivityContextFactory()
.getActivityContext(ach);
if (ac != null) {
return ac.getActivityContextInterface();
}
break;
}
}
throw new UnrecognizedActivityException(activity.toString());
} | java | {
"resource": ""
} |
q177232 | AbstractSleeComponent.getClassPool | test | public ClassPool getClassPool() {
if (classPool == null) {
if (classLoader == null) {
throw new IllegalStateException("can't init javassit classpool, there is no class loader set for the component");
}
classPool = new ClassPool();
// add class path for domain and dependencies
classPool.appendClassPath(new LoaderClassPath(classLoaderDomain));
for(ClassLoader domainDependencies : classLoaderDomain.getAllDependencies()) {
classPool.appendClassPath(new LoaderClassPath(domainDependencies));
}
// add class path also for slee
classPool.appendClassPath(new LoaderClassPath(classLoaderDomain.getParent()));
}
return classPool;
} | java | {
"resource": ""
} |
q177233 | AbstractSleeComponent.setDeployableUnit | test | public void setDeployableUnit(DeployableUnit deployableUnit)
throws AlreadyDeployedException {
if (this.deployableUnit != null) {
throw new IllegalStateException(
"deployable unit already set. du = " + this.deployableUnit);
}
this.deployableUnit = deployableUnit;
if (!addToDeployableUnit()) {
throw new AlreadyDeployedException(
"unable to install du having multiple components with id "
+ getComponentID());
}
} | java | {
"resource": ""
} |
q177234 | AbstractSleeComponent.undeployed | test | public void undeployed() {
classLoader = null;
if (classLoaderDomain != null) {
classLoaderDomain.clear();
classLoaderDomain = null;
}
if (classPool != null) {
classPool.clean();
classPool = null;
}
if (permissions != null) {
permissions.clear();
permissions = null;
}
} | java | {
"resource": ""
} |
q177235 | SleeEndpointStartActivityNotTransactedExecutor.execute | test | void execute(final ActivityHandle handle, final int activityFlags, boolean suspendActivity)
throws SLEEException {
final SleeTransaction tx = super.suspendTransaction();
ActivityContextHandle ach = null;
try {
ach = sleeEndpoint._startActivity(handle, activityFlags, suspendActivity ? tx : null);
} finally {
if (tx != null) {
super.resumeTransaction(tx);
// the activity was started out of the tx but it will be suspended, if the flags request the unreferenced callback then
// we can load the ac now, which will schedule a check for references in the end of the tx, this ensures that the callback is received if no events are fired or
// events are fired but not handled, that is, no reference is ever ever created
if (ach != null && ActivityFlags.hasRequestSleeActivityGCCallback(activityFlags)) {
acFactory.getActivityContext(ach);
}
}
}
} | java | {
"resource": ""
} |
q177236 | ClassUtils.checkInterfaces | test | public static Class checkInterfaces(Class classOrInterfaceWithInterfaces, String interfaceSearched) {
Class returnValue = null;
if (classOrInterfaceWithInterfaces.getName().compareTo(interfaceSearched) == 0) {
return classOrInterfaceWithInterfaces;
}
// we do check only on get interfaces
for (Class iface : classOrInterfaceWithInterfaces.getInterfaces()) {
if (iface.getName().compareTo(interfaceSearched) == 0) {
returnValue = iface;
} else {
returnValue = checkInterfaces(iface, interfaceSearched);
}
if (returnValue != null)
break;
}
if (!classOrInterfaceWithInterfaces.isInterface() && returnValue == null) {
Class superClass = classOrInterfaceWithInterfaces.getSuperclass();
if (superClass != null) {
returnValue = checkInterfaces(superClass, interfaceSearched);
}
}
return returnValue;
} | java | {
"resource": ""
} |
q177237 | ClassUtils.getAllInterfacesMethods | test | public static Map<String, Method> getAllInterfacesMethods(Class xInterfaceClass, Set<String> ignore) {
HashMap<String, Method> abstractMethods = new HashMap<String, Method>();
Method[] methods = null;
Class[] superInterfaces;
superInterfaces = xInterfaceClass.getInterfaces();
for (Class superInterface : superInterfaces) {
if (!ignore.contains(superInterface.getName()))
abstractMethods.putAll(getAllInterfacesMethods(superInterface, ignore));
}
methods = xInterfaceClass.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
abstractMethods.put(getMethodKey(methods[i]), methods[i]);
}
return abstractMethods;
} | java | {
"resource": ""
} |
q177238 | SleeDeployerEntityResolver.resolveEntity | test | public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
{
URL resourceURL = resources.get(publicId);
if(resourceURL != null) {
InputStream resourceStream = resourceURL.openStream();
InputSource is = new InputSource(resourceStream);
is.setPublicId(publicId);
is.setSystemId(resourceURL.toExternalForm());
return is;
}
return null;
} | java | {
"resource": ""
} |
q177239 | TraceMBeanImpl.checkTracerName | test | public static void checkTracerName(String tracerName, NotificationSource notificationSource) throws IllegalArgumentException {
if (tracerName.compareTo("") == 0) {
// This is root
return;
}
// String[] splitName = tracerName.split("\\.");
StringTokenizer stringTokenizer = new StringTokenizer(tracerName, ".", true);
int fqdnPartIndex = 0;
// if(splitName.length==0)
// {
// throw new IllegalArgumentException("Passed tracer:" + tracerName +
// ", name for source: " + notificationSource + ", is illegal");
// }
String lastToken = null;
while (stringTokenizer.hasMoreTokens()) {
String token = stringTokenizer.nextToken();
if (lastToken == null) {
// this is start
lastToken = token;
}
if (lastToken.compareTo(token) == 0 && token.compareTo(".") == 0) {
throw new IllegalArgumentException("Passed tracer:" + tracerName + ", name for source: " + notificationSource + ", is illegal");
}
if (token.compareTo(".") != 0) {
for (int charIndex = 0; charIndex < token.length(); charIndex++) {
Character c = token.charAt(charIndex);
if (Character.isLetter(c) || Character.isDigit(c)) {
// Its ok?
} else {
throw new IllegalArgumentException("Passed tracer:" + tracerName + " Token[" + token + "], name for source: " + notificationSource
+ ", is illegal, contains illegal character: " + charIndex);
}
}
fqdnPartIndex++;
}
lastToken = token;
}
if (lastToken.compareTo(".") == 0) {
throw new IllegalArgumentException("Passed tracer:" + tracerName + ", name for source: " + notificationSource + ", is illegal");
}
} | java | {
"resource": ""
} |
q177240 | ProfileQueryHandler.handle | test | public static Collection<ProfileLocalObject> handle(
ProfileTableImpl profileTable, String queryName, Object[] arguments)
throws NullPointerException, TransactionRequiredLocalException, SLEEException,
UnrecognizedQueryNameException, AttributeTypeMismatchException,
InvalidArgumentException {
return profileTable.getProfilesByStaticQuery(queryName, arguments);
} | java | {
"resource": ""
} |
q177241 | DeployableUnitBuilderImpl.checkDependencies | test | private void checkDependencies(SleeComponent sleeComponent,
DeployableUnitImpl deployableUnit) throws DependencyException {
for (ComponentID componentID : sleeComponent.getDependenciesSet()) {
if (componentID instanceof EventTypeID) {
if (deployableUnit.getDeployableUnitRepository()
.getComponentByID((EventTypeID) componentID) == null) {
throw new DependencyException(
"Component "
+ sleeComponent.getComponentID()
+ " depends on "
+ componentID
+ " which is not available in the component repository or in the deployable unit");
}
} else if (componentID instanceof LibraryID) {
if (deployableUnit.getDeployableUnitRepository()
.getComponentByID((LibraryID) componentID) == null) {
throw new DependencyException(
"Component "
+ sleeComponent.getComponentID()
+ " depends on "
+ componentID
+ " which is not available in the component repository or in the deployable unit");
}
} else if (componentID instanceof ProfileSpecificationID) {
if (deployableUnit.getDeployableUnitRepository()
.getComponentByID((ProfileSpecificationID) componentID) == null) {
throw new DependencyException(
"Component "
+ sleeComponent.getComponentID()
+ " depends on "
+ componentID
+ " which is not available in the component repository or in the deployable unit");
}
} else if (componentID instanceof ResourceAdaptorID) {
if (deployableUnit.getDeployableUnitRepository()
.getComponentByID((ResourceAdaptorID) componentID) == null) {
throw new DependencyException(
"Component "
+ sleeComponent.getComponentID()
+ " depends on "
+ componentID
+ " which is not available in the component repository or in the deployable unit");
}
} else if (componentID instanceof ResourceAdaptorTypeID) {
if (deployableUnit.getDeployableUnitRepository()
.getComponentByID((ResourceAdaptorTypeID) componentID) == null) {
throw new DependencyException(
"Component "
+ sleeComponent.getComponentID()
+ " depends on "
+ componentID
+ " which is not available in the component repository or in the deployable unit");
}
} else if (componentID instanceof SbbID) {
if (deployableUnit.getDeployableUnitRepository()
.getComponentByID((SbbID) componentID) == null) {
throw new DependencyException(
"Component "
+ sleeComponent.getComponentID()
+ " depends on "
+ componentID
+ " which is not available in the component repository or in the deployable unit");
}
} else if (componentID instanceof ServiceID) {
throw new SLEEException(
"Component "
+ sleeComponent.getComponentID()
+ " depends on a service component "
+ componentID
+ " which is not available in the component repository or in the deployable unit");
}
}
} | java | {
"resource": ""
} |
q177242 | DeployableUnitBuilderImpl.createTempDUDeploymentDir | test | private File createTempDUDeploymentDir(File deploymentRoot,
DeployableUnitID deployableUnitID) {
try {
// first create a dummy file to gurantee uniqueness. I would have
// been nice if the File class had a createTempDir() method
// IVELIN -- do not use jarName here because windows cannot see the
// path (exceeds system limit)
File tempFile = File.createTempFile("restcomm-slee-du-", "",
deploymentRoot);
File tempDUDeploymentDir = new File(tempFile.getAbsolutePath()
+ "-contents");
if (!tempDUDeploymentDir.exists()) {
tempDUDeploymentDir.mkdirs();
} else {
throw new SLEEException(
"Dir "
+ tempDUDeploymentDir
+ " already exists, unable to create deployment dir for DU "
+ deployableUnitID);
}
tempFile.delete();
return tempDUDeploymentDir;
} catch (IOException e) {
throw new SLEEException("Failed to create deployment dir for DU "
+ deployableUnitID, e);
}
} | java | {
"resource": ""
} |
q177243 | JPAProfileEntityFramework.getEntityManager | test | @SuppressWarnings("unchecked")
private EntityManager getEntityManager() {
if (txDataKey == null) {
txDataKey = new StringBuilder("jpapef.em.").append(component.getProfileSpecificationID()).toString();
}
final TransactionContext txContext = sleeTransactionManager.getTransactionContext();
// look in tx
Map transactionContextData = txContext.getData();
EntityManager result = (EntityManager) transactionContextData
.get(txDataKey);
if (result == null) {
// create using factory
result = entityManagerFactory.createEntityManager();
// store in tx context data
transactionContextData.put(txDataKey, result);
// add a tx action to close it before tx commits
// FIXME: Do we need this after-rollback action here
/*
final EntityManager em = result;
TransactionalAction action = new TransactionalAction() {
public void execute() {
try {
em.close();
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
}
};
txContext.getAfterRollbackActions().add(action);
*/
}
return result;
} | java | {
"resource": ""
} |
q177244 | SleeManagementMBeanImpl.start | test | public void start() throws InvalidStateException, ManagementException {
try {
// request to change to STARTING
final SleeStateChangeRequest startingRequest = new SleeStateChangeRequest() {
@Override
public void stateChanged(SleeState oldState) {
if(logger.isDebugEnabled()) {
logger.debug(generateMessageWithLogo("starting"));
}
notifyStateChange(oldState, getNewState());
}
@Override
public void requestCompleted() {
// inner request, executed when the parent completes, to change to RUNNING
final SleeStateChangeRequest runningRequest = new SleeStateChangeRequest() {
private SleeState oldState;
@Override
public void stateChanged(SleeState oldState) {
logger.info(generateMessageWithLogo("started"));
this.oldState = oldState;
}
@Override
public void requestCompleted() {
notifyStateChange(oldState, getNewState());
}
@Override
public boolean isBlockingRequest() {
return true;
}
@Override
public SleeState getNewState() {
return SleeState.RUNNING;
}
};
try {
sleeContainer.setSleeState(runningRequest);
} catch (Throwable e) {
logger.error(
"Failed to set container in RUNNING state", e);
try {
stop(false);
} catch (Throwable f) {
logger.error(
"Failed to set container in STOPPED state, after failure to set in RUNNING state",
e);
}
}
}
@Override
public boolean isBlockingRequest() {
// should be false, but the tck doesn't like it
return true;
}
@Override
public SleeState getNewState() {
return SleeState.STARTING;
}
};
sleeContainer.setSleeState(startingRequest);
} catch (InvalidStateException ex) {
throw ex;
} catch (Exception ex) {
throw new ManagementException(ex.getMessage(), ex);
}
} | java | {
"resource": ""
} |
q177245 | Utility.switchSafelyClassLoader | test | public static ClassLoader switchSafelyClassLoader(final ClassLoader cl,final ProfileObject po)
{
ClassLoader _cl = null;
if(System.getSecurityManager()!=null)
{
_cl = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction(){
public Object run() {
return _switchSafelyClassLoader(cl,po);
}});
}else
{
_cl = _switchSafelyClassLoader(cl, po);
}
return _cl;
} | java | {
"resource": ""
} |
q177246 | Utility.makeSafeProxyCall | test | public static Object makeSafeProxyCall(final Object proxy,final String methodToCallname,final Class[] signature,final Object[] values) throws PrivilegedActionException
{
//Here we execute in sbb/profile or any other slee component domain
// so no security calls can be made
try {
//AccessControlContext acc = new AccessControlContext(new ProtectionDomain[]{proxy.getClass().getProtectionDomain()});
return AccessController.doPrivileged(new PrivilegedExceptionAction(){
public Object run() throws Exception {
final Method m = proxy.getClass().getMethod(methodToCallname, signature);
//Here we cross to org.mobicents domain, with all perms, once m.invoke is called, we go into proxy object domain, effective rightsd are cross section of All + proxy object domain permissions
//This is used when isolate security permissions is set to true;
return m.invoke(proxy, values);
//}},acc);
}});
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(PrivilegedActionException e)
{
e.printStackTrace();
}
return null;
} | java | {
"resource": ""
} |
q177247 | ProfileLocalObjectImpl.checkTransaction | test | protected void checkTransaction() throws IllegalStateException {
try {
if (!sleeContainer.getTransactionManager().getTransaction().equals(this.transaction)) {
throw new IllegalStateException();
}
} catch (SystemException e) {
throw new IllegalStateException();
}
} | java | {
"resource": ""
} |
q177248 | ActivityServiceImpl.toTTL | test | private static String toTTL(String lastAccess, long timeout) {
Long ttl = timeout - ((System.currentTimeMillis() - Long.parseLong(lastAccess)) / 1000);
return ttl.toString();
} | java | {
"resource": ""
} |
q177249 | AbstractProfileEvent.isProfileClassVisible | test | boolean isProfileClassVisible() {
try {
Thread.currentThread().getContextClassLoader().loadClass(profileAfterAction.getClass().getName());
return true;
} catch (Throwable e) {
return false;
}
} | java | {
"resource": ""
} |
q177250 | AbstractProfileEvent.getProfileObjectValidInCurrentTransaction | test | ProfileObjectImpl getProfileObjectValidInCurrentTransaction(ProfileEntity profileEntity) throws TransactionRequiredLocalException {
// check tx
final SleeTransactionManager txManager = profileManagement.getSleeContainer().getTransactionManager();
txManager.mandateTransaction();
// look for an assigned object in local map
if (txData == null) {
txData = new HashMap<ProfileEntity, ProfileObjectImpl>();
}
ProfileObjectImpl profileObject = (ProfileObjectImpl) txData.get(profileEntity);
if (profileObject == null) {
// get an object from the table
profileEntity.setReadOnly(true);
profileEntity.setDirty(false);
ProfileObjectPool pool = profileManagement.getObjectPoolManagement().getObjectPool(profileEntity.getTableName());
profileObject = pool.borrowObject();
profileObject.profileActivate(profileEntity);
ProfileTableTransactionView.passivateProfileObjectOnTxEnd(txManager, profileObject, pool);
txData.put(profileEntity, profileObject);
}
return profileObject;
} | java | {
"resource": ""
} |
q177251 | LogManagementMBeanUtils.getLoggerNames | test | public List<String> getLoggerNames(String regex) throws ManagementConsoleException {
try {
return (List<String>) this.mbeanServer.invoke(logMgmtMBeanName, "getLoggerNames", new Object[] { regex }, new String[] { "java.lang.String" });
}
catch (Exception e) {
e.printStackTrace();
throw new ManagementConsoleException(SleeManagementMBeanUtils.doMessage(e));
}
} | java | {
"resource": ""
} |
q177252 | LogManagementMBeanUtils.resetLoggerLevels | test | public void resetLoggerLevels() throws ManagementConsoleException {
try {
this.mbeanServer.invoke(logMgmtMBeanName, "resetLoggerLevels", null, null);
}
catch (Exception e) {
e.printStackTrace();
throw new ManagementConsoleException(SleeManagementMBeanUtils.doMessage(e));
}
} | java | {
"resource": ""
} |
q177253 | LogManagementMBeanUtils.clearLoggers | test | public void clearLoggers(String name) throws ManagementConsoleException {
try {
this.mbeanServer.invoke(logMgmtMBeanName, "clearLoggers", new Object[] { name }, new String[] { "java.lang.String" });
}
catch (Exception e) {
e.printStackTrace();
throw new ManagementConsoleException(SleeManagementMBeanUtils.doMessage(e));
}
} | java | {
"resource": ""
} |
q177254 | LogManagementMBeanUtils.addLogger | test | public boolean addLogger(String name, Level level) throws NullPointerException, ManagementConsoleException {
try {
return ((Boolean) this.mbeanServer.invoke(logMgmtMBeanName, "addLogger", new Object[] { name, level }, new String[] { "java.lang.String",
"java.util.logging.Level" })).booleanValue();
}
catch (Exception e) {
e.printStackTrace();
throw new ManagementConsoleException(SleeManagementMBeanUtils.doMessage(e));
}
} | java | {
"resource": ""
} |
q177255 | LogManagementMBeanUtils.addSocketHandler | test | public void addSocketHandler(String loggerName, Level handlerLevel, String handlerName, String formaterClassName, String filterClassName, String host,
int port) throws ManagementConsoleException {
try {
this.mbeanServer.invoke(logMgmtMBeanName, "addSocketHandler", new Object[] { loggerName, handlerLevel, handlerName, formaterClassName, filterClassName,
host, port }, new String[] { "java.lang.String", "java.util.logging.Level", "java.lang.String", "java.lang.String", "java.lang.String",
"java.lang.String", "int" });
}
catch (Exception e) {
e.printStackTrace();
throw new ManagementConsoleException(SleeManagementMBeanUtils.doMessage(e));
}
} | java | {
"resource": ""
} |
q177256 | LogManagementMBeanUtils.removeHandler | test | public boolean removeHandler(String loggerName, String handlerName) throws ManagementConsoleException {
try {
return ((Boolean) this.mbeanServer.invoke(logMgmtMBeanName, "removeHandler", new Object[] { loggerName, handlerName }, new String[] { "java.lang.String",
"java.lang.String" })).booleanValue();
}
catch (Exception e) {
e.printStackTrace();
throw new ManagementConsoleException(SleeManagementMBeanUtils.doMessage(e));
}
} | java | {
"resource": ""
} |
q177257 | TracerImpl.tracerNameToLog4JLoggerName | test | private String tracerNameToLog4JLoggerName(String tracerName, NotificationSource notificationSource) {
final StringBuilder sb = new StringBuilder("javax.slee.").append(notificationSource.toString());
if(!tracerName.equals(ROOT_TRACER_NAME)) {
sb.append('.').append(tracerName);
}
return sb.toString();
} | java | {
"resource": ""
} |
q177258 | TracerImpl.syncLevelWithLog4j | test | void syncLevelWithLog4j() {
// get the level from log4j, only the root one uses effective level
Level log4jLevel = parent == null ? logger.getEffectiveLevel() : logger.getLevel();
if (level == null) {
// set the level
assignLog4JLevel(log4jLevel);
}
else {
// set the level only if differs, otherwise we may loose levels not present in log4j
if (tracerToLog4JLevel(level) != log4jLevel) {
assignLog4JLevel(log4jLevel);
}
}
// the root must always have a level
if (parent == null && level == null) {
// defaults to INFO
logger.setLevel(Level.INFO);
level = TraceLevel.INFO;
}
// reset the flags
resetCacheFlags(false);
} | java | {
"resource": ""
} |
q177259 | TracerImpl.assignLog4JLevel | test | private void assignLog4JLevel(Level log4jLevel) {
if (log4jLevel == null) {
return;
}
if (log4jLevel == Level.DEBUG) {
level = TraceLevel.FINE;
}
else if (log4jLevel == Level.INFO) {
level = TraceLevel.INFO;
}
else if (log4jLevel == Level.WARN) {
level = TraceLevel.WARNING;
}
else if (log4jLevel == Level.ERROR) {
level = TraceLevel.SEVERE;
}
else if (log4jLevel == Level.TRACE) {
level = TraceLevel.FINEST;
}
else if (log4jLevel == Level.OFF) {
level = TraceLevel.OFF;
}
} | java | {
"resource": ""
} |
q177260 | TracerImpl.resetCacheFlags | test | void resetCacheFlags(boolean resetChilds) {
if (isTraceable(TraceLevel.FINEST)) {
finestEnabled = true;
finerEnabled = true;
fineEnabled = true;
configEnabled = true;
infoEnabled = true;
warningEnabled = true;
severeEnabled = true;
}
else {
finestEnabled = false;
if (isTraceable(TraceLevel.FINER)) {
finerEnabled = true;
fineEnabled = true;
configEnabled = true;
infoEnabled = true;
warningEnabled = true;
severeEnabled = true;
}
else {
finerEnabled = false;
if (isTraceable(TraceLevel.FINE)) {
fineEnabled = true;
configEnabled = true;
infoEnabled = true;
warningEnabled = true;
severeEnabled = true;
}
else {
fineEnabled = false;
if (isTraceable(TraceLevel.CONFIG)) {
configEnabled = true;
infoEnabled = true;
warningEnabled = true;
severeEnabled = true;
}
else {
if (isTraceable(TraceLevel.INFO)) {
infoEnabled = true;
warningEnabled = true;
severeEnabled = true;
}
else {
infoEnabled = false;
if (isTraceable(TraceLevel.WARNING)) {
warningEnabled = true;
severeEnabled = true;
}
else {
warningEnabled = false;
if (isTraceable(TraceLevel.SEVERE)) {
severeEnabled = true;
}
else {
severeEnabled = false;
}
}
}
}
}
}
}
if (resetChilds) {
// implicit change of level demands that we update reset flags on childs without level
for(TracerImpl child : childs) {
if (child.level == null) {
child.resetCacheFlags(true);
}
}
}
} | java | {
"resource": ""
} |
q177261 | TracerImpl.sendNotification | test | void sendNotification(javax.slee.facilities.TraceLevel level, String message, Throwable t) {
if (!isTraceable(level)) {
return;
}
traceMBean.sendNotification(new TraceNotification(notificationSource.getNotificationSource().getTraceNotificationType(), traceMBean, notificationSource.getNotificationSource(), getTracerName(), level, message, t, notificationSource.getNextSequence(), System.currentTimeMillis()));
} | java | {
"resource": ""
} |
q177262 | TracerImpl.checkTracerName | test | public static void checkTracerName(String tracerName, NotificationSource notificationSource) throws NullPointerException,InvalidArgumentException {
if (tracerName.equals("")) {
// This is root
return;
}
StringTokenizer stringTokenizer = new StringTokenizer(tracerName, ".", true);
String lastToken = null;
while (stringTokenizer.hasMoreTokens()) {
String token = stringTokenizer.nextToken();
if (lastToken == null) {
// this is start
lastToken = token;
}
if (lastToken.equals(token) && token.equals(".")) {
throw new InvalidArgumentException("Passed tracer:" + tracerName + ", name for source: " + notificationSource + ", is illegal");
}
lastToken = token;
}
if (lastToken.equals(".")) {
throw new IllegalArgumentException("Passed tracer:" + tracerName + ", name for source: " + notificationSource + ", is illegal");
}
} | java | {
"resource": ""
} |
q177263 | VendorExtensionUtils.writeObject | test | public static void writeObject(ObjectOutputStream out, Object vendorData) throws IOException {
// write non-transient fields
out.defaultWriteObject();
// check if should we serialize vendor data?
if (vendorData != null) {
// serialize the vendor data
out.writeBoolean(true);
// write the vendor data in a marshalled object so deserialization can be deferred
out.writeObject(new MarshalledObject(vendorData));
}
else out.writeBoolean(false);
} | java | {
"resource": ""
} |
q177264 | VendorExtensionUtils.readObject | test | public static Object readObject(ObjectInputStream in, boolean vendorDataDeserializationEnabled) throws IOException, ClassNotFoundException {
// read non-transient fields
in.defaultReadObject();
// read any possible marshalled vendor data from the stream
MarshalledObject vendorData = in.readBoolean()
? (MarshalledObject)in.readObject()
: null;
// now figure out what to return
return (vendorData != null && vendorDataDeserializationEnabled) ? vendorData.get() : null;
} | java | {
"resource": ""
} |
q177265 | URLClassLoaderDomainImpl.addDirectDependency | test | public void addDirectDependency(URLClassLoaderDomainImpl domain) {
if (logger.isTraceEnabled())
logger.trace(toString() + " adding domain " + domain
+ " to direct dependencies");
directDependencies.add(domain);
} | java | {
"resource": ""
} |
q177266 | URLClassLoaderDomainImpl.getAllDependencies | test | public List<URLClassLoaderDomainImpl> getAllDependencies() {
List<URLClassLoaderDomainImpl> result = new ArrayList<URLClassLoaderDomainImpl>();
this.getAllDependencies(result);
return result;
} | java | {
"resource": ""
} |
q177267 | URLClassLoaderDomainImpl.findClassLocally | test | protected Class<?> findClassLocally(String name)
throws ClassNotFoundException {
if (logger.isTraceEnabled()) {
logger.trace(toString() + " findClassLocally: " + name);
}
final boolean acquiredLock = acquireGlobalLock();
try {
return findClassLocallyLocked(name);
} finally {
if (acquiredLock) {
releaseGlobalLock();
}
}
} | java | {
"resource": ""
} |
q177268 | URLClassLoaderDomainImpl.findResourceLocally | test | protected URL findResourceLocally(String name) {
if (logger.isTraceEnabled())
logger.trace(toString() + " findResourceLocally: " + name);
return super.findResource(name);
} | java | {
"resource": ""
} |
q177269 | URLClassLoaderDomainImpl.findResourcesLocally | test | protected Enumeration<URL> findResourcesLocally(String name)
throws IOException {
if (logger.isTraceEnabled())
logger.trace(toString() + " findResourcesLocally: " + name);
return super.findResources(name);
} | java | {
"resource": ""
} |
q177270 | ProfileProvisioningMBeanImpl.createAndRegisterProfileMBean | test | private AbstractProfileMBeanImpl createAndRegisterProfileMBean(String profileName, ProfileTableImpl profileTable) throws ManagementException {
if (logger.isDebugEnabled()) {
logger.debug("createAndRegisterProfileMBean( profileTable = "+profileTable+" , profileName = "+profileName+" )");
}
try {
ProfileSpecificationComponent component = profileTable.getProfileSpecificationComponent();
Constructor<?> constructor = component.getProfileMBeanConcreteImplClass().getConstructor(Class.class, String.class, ProfileTableImpl.class);
final AbstractProfileMBeanImpl profileMBean = (AbstractProfileMBeanImpl) constructor.newInstance(component.getProfileMBeanConcreteInterfaceClass(), profileName, profileTable);
profileMBean.register();
// add a rollback action to unregister the mbean
TransactionalAction rollbackAction = new TransactionalAction() {
public void execute() {
try {
profileMBean.unregister();
} catch (Throwable e) {
logger.error(e.getMessage(),e);
}
}
};
sleeTransactionManagement.getTransactionContext().getAfterRollbackActions().add(rollbackAction);
return profileMBean;
} catch (Throwable e) {
throw new ManagementException(e.getMessage(),e);
}
} | java | {
"resource": ""
} |
q177271 | SleeEndpointOperationNotTransactedExecutor.resumeTransaction | test | void resumeTransaction(SleeTransaction transaction) throws SLEEException {
if (transaction != null) {
try {
txManager.resume(transaction);
} catch (Throwable e) {
throw new SLEEException(e.getMessage(),e);
}
}
} | java | {
"resource": ""
} |
q177272 | ServiceComponentImpl.getSbbIDs | test | public Set<SbbID> getSbbIDs(ComponentRepository componentRepository) {
Set<SbbID> result = new HashSet<SbbID>();
buildSbbTree(descriptor.getRootSbbID(), result,
componentRepository);
return result;
} | java | {
"resource": ""
} |
q177273 | ServiceComponentImpl.getResourceAdaptorEntityLinks | test | public Set<String> getResourceAdaptorEntityLinks(ComponentRepository componentRepository) {
Set<String> result = new HashSet<String>();
for (SbbID sbbID : getSbbIDs(componentRepository)) {
SbbComponent sbbComponent = componentRepository.getComponentByID(sbbID);
for (ResourceAdaptorTypeBindingDescriptor raTypeBinding : sbbComponent.getDescriptor().getResourceAdaptorTypeBindings()) {
for (ResourceAdaptorEntityBindingDescriptor raEntityBinding : raTypeBinding.getResourceAdaptorEntityBinding()) {
result.add(raEntityBinding.getResourceAdaptorEntityLink());
}
}
}
return result;
} | java | {
"resource": ""
} |
q177274 | SleeContainer.initSlee | test | public void initSlee() throws InvalidStateException {
if (sleeState != null) {
throw new InvalidStateException("slee in "+sleeState+" state");
}
// slee init
beforeModulesInitialization();
for (Iterator<SleeContainerModule> i = modules.iterator(); i
.hasNext();) {
i.next().sleeInitialization();
}
afterModulesInitialization();
sleeState = SleeState.STOPPED;
} | java | {
"resource": ""
} |
q177275 | SleeContainer.shutdownSlee | test | public void shutdownSlee() throws InvalidStateException {
if (sleeState != SleeState.STOPPED) {
throw new InvalidStateException("slee in "+sleeState+" state");
}
// slee shutdown
beforeModulesShutdown();
for (Iterator<SleeContainerModule> i = modules
.descendingIterator(); i.hasNext();) {
i.next().sleeShutdown();
}
afterModulesShutdown();
sleeState = null;
} | java | {
"resource": ""
} |
q177276 | SleeContainer.validateStateTransition | test | private void validateStateTransition(SleeState oldState, SleeState newState)
throws InvalidStateException {
if (oldState == SleeState.STOPPED) {
if (newState == SleeState.STARTING) {
return;
}
} else if (oldState == SleeState.STARTING) {
if (newState == SleeState.RUNNING || newState == SleeState.STOPPING) {
return;
}
} else if (oldState == SleeState.RUNNING) {
if (newState == SleeState.STOPPING) {
return;
}
} else if (oldState == SleeState.STOPPING) {
if (newState == SleeState.STOPPED) {
return;
}
}
throw new InvalidStateException("illegal slee state transition: " + oldState + " -> "+ newState);
} | java | {
"resource": ""
} |
q177277 | ConcreteProfileGenerator.generateNamedUsageParameterGetter | test | private void generateNamedUsageParameterGetter(CtClass profileConcreteClass) {
String methodName = "getUsageParameterSet";
for (CtMethod ctMethod : profileConcreteClass.getMethods()) {
if (ctMethod.getName().equals(methodName)) {
try {
// copy method, we can't just add body becase it is in super
// class and does not sees profileObject field
CtMethod ctMethodCopy = CtNewMethod.copy(ctMethod, profileConcreteClass, null);
// create the method body
String methodBody = "{ return ($r)"
+ ClassGeneratorUtils.MANAGEMENT_HANDLER
+ ".getUsageParameterSet(profileObject,$1); }";
if (logger.isTraceEnabled())
logger.trace("Implemented method " + methodName
+ " , body = " + methodBody);
ctMethodCopy.setBody(methodBody);
profileConcreteClass.addMethod(ctMethodCopy);
} catch (CannotCompileException e) {
throw new SLEEException(e.getMessage(), e);
}
}
}
} | java | {
"resource": ""
} |
q177278 | UpdateQuery.set | test | public UpdateQuery set(String fieldName, Object value) {
String updatedFieldName = "update_" + fieldName;
values.append(fieldName).append(" = :").append(updatedFieldName).append(", ");
query.setArgument(updatedFieldName, value);
return this;
} | java | {
"resource": ""
} |
q177279 | PolyJDBCBuilder.build | test | public PolyJDBC build() {
TransactionManager manager;
if (dataSource != null) {
manager = new DataSourceTransactionManager(dataSource);
} else {
manager = new ExternalTransactionManager(connectionProvider);
}
return new DefaultPolyJDBC(dialect, schemaName, new ColumnTypeMapper(customMappings), manager);
} | java | {
"resource": ""
} |
q177280 | InsertQuery.value | test | public InsertQuery value(String fieldName, Object value) {
valueNames.append(fieldName).append(", ");
values.append(":").append(fieldName).append(", ");
setArgument(fieldName, value);
return this;
} | java | {
"resource": ""
} |
q177281 | TransactionRunner.run | test | public <T> T run(TransactionWrapper<T> operation) {
QueryRunner runner = null;
try {
runner = queryRunnerFactory.create();
T result = operation.perform(runner);
runner.commit();
return result;
} catch (Throwable throwable) {
TheCloser.rollback(runner);
throw new TransactionInterruptedException(throwable);
} finally {
TheCloser.close(runner);
}
} | java | {
"resource": ""
} |
q177282 | RegionRequest.fromString | test | @JsonCreator
public static RegionRequest fromString(String str) throws ResolvingException {
if (str.equals("full")) {
return new RegionRequest();
}
if (str.equals("square")) {
return new RegionRequest(true);
}
Matcher matcher = PARSE_PAT.matcher(str);
if (!matcher.matches()) {
throw new ResolvingException("Bad format: " + str);
}
if (matcher.group(1) == null) {
return new RegionRequest(
Integer.valueOf(matcher.group(2)),
Integer.valueOf(matcher.group(3)),
Integer.valueOf(matcher.group(4)),
Integer.valueOf(matcher.group(5)));
} else {
return new RegionRequest(
new BigDecimal(matcher.group(2)),
new BigDecimal(matcher.group(3)),
new BigDecimal(matcher.group(4)),
new BigDecimal(matcher.group(5)));
}
} | java | {
"resource": ""
} |
q177283 | RegionRequest.getRegion | test | public Rectangle2D getRegion() {
if (isRelative()) {
return new Rectangle2D.Double(
relativeBox.x.doubleValue(), relativeBox.y.doubleValue(),
relativeBox.w.doubleValue(), relativeBox.h.doubleValue());
} else {
return absoluteBox;
}
} | java | {
"resource": ""
} |
q177284 | RegionRequest.resolve | test | public Rectangle resolve(Dimension imageDims) throws ResolvingException {
if (square) {
if (imageDims.width > imageDims.height) {
return new Rectangle(
(imageDims.width - imageDims.height) / 2,
0,
imageDims.height, imageDims.height);
} else if (imageDims.height > imageDims.width) {
return new Rectangle(
0,
(imageDims.height - imageDims.width) / 2,
imageDims.width, imageDims.width);
}
}
if (absoluteBox == null && relativeBox == null) {
return new Rectangle(0, 0, imageDims.width, imageDims.height);
}
Rectangle rect;
if (isRelative()) {
rect = new Rectangle(
(int) Math.round(relativeBox.x.doubleValue() / 100. * imageDims.getWidth()),
(int) Math.round(relativeBox.y.doubleValue() / 100. * imageDims.getHeight()),
(int) Math.round(relativeBox.w.doubleValue() / 100. * imageDims.getWidth()),
(int) Math.round(relativeBox.h.doubleValue() / 100. * imageDims.getHeight()));
} else {
rect = absoluteBox;
}
if (rect.x >= imageDims.width || rect.y >= imageDims.height) {
throw new ResolvingException("X and Y must be smaller than the native width/height");
}
if (rect.x + rect.width > imageDims.width) {
rect.width = imageDims.width - rect.x;
}
if (rect.y + rect.height > imageDims.height) {
rect.height = imageDims.height - rect.y;
}
return rect;
} | java | {
"resource": ""
} |
q177285 | ResourceDeserializer.getOnType | test | private String getOnType(DeserializationContext ctxt) {
// Easiest way: The parser has already constructed an annotation object with a motivation.
// This is highly dependendant on the order of keys in the JSON, i.e. if "on" is the first key in the annotation
// object, this won't work.
Object curVal = ctxt.getParser().getCurrentValue();
boolean isPaintingAnno = (curVal != null && curVal instanceof Annotation
&& ((Annotation) curVal).getMotivation() != null
&& ((Annotation) curVal).getMotivation().equals(Motivation.PAINTING));
if (isPaintingAnno) {
return "sc:Canvas";
}
// More reliable way: Walk up the parsing context until we hit a IIIF resource that we can deduce the type from
// Usually this shouldn't be more than two levels up
JsonStreamContext parent = ctxt.getParser().getParsingContext().getParent();
while (parent != null && (parent.getCurrentValue() == null || !(parent.getCurrentValue() instanceof Resource))) {
parent = parent.getParent();
}
if (parent != null) {
Resource parentObj = (Resource) parent.getCurrentValue();
return parentObj.getType();
}
return null;
} | java | {
"resource": ""
} |
q177286 | Resource.setViewingHints | test | public void setViewingHints(List<ViewingHint> viewingHints) throws IllegalArgumentException {
for (ViewingHint hint : viewingHints) {
boolean supportsHint = (hint.getType() == ViewingHint.Type.OTHER
|| this.getSupportedViewingHintTypes().contains(hint.getType()));
if (!supportsHint) {
throw new IllegalArgumentException(String.format(
"Resources of type '%s' do not support the '%s' viewing hint.",
this.getType(), hint.toString()));
}
}
this.viewingHints = viewingHints;
} | java | {
"resource": ""
} |
q177287 | Resource.addViewingHint | test | public Resource addViewingHint(ViewingHint first, ViewingHint... rest) throws IllegalArgumentException {
List<ViewingHint> hints = this.viewingHints;
if (hints == null) {
hints = new ArrayList<>();
}
hints.addAll(Lists.asList(first, rest));
this.setViewingHints(hints);
return this;
} | java | {
"resource": ""
} |
q177288 | Resource.setRenderings | test | public void setRenderings(List<OtherContent> renderings) throws IllegalArgumentException {
renderings.forEach(this::verifyRendering);
this.renderings = renderings;
} | java | {
"resource": ""
} |
q177289 | Resource.addRendering | test | public Resource addRendering(OtherContent first, OtherContent... rest) {
if (renderings == null) {
this.renderings = new ArrayList<>();
}
List<OtherContent> renderingsToAdd = Lists.asList(first, rest);
renderingsToAdd.forEach(this::verifyRendering);
this.renderings.addAll(renderingsToAdd);
return this;
} | java | {
"resource": ""
} |
q177290 | ImageApiProfile.merge | test | public static ImageApiProfile merge(List<Profile> profiles) {
return profiles.stream()
.filter(ImageApiProfile.class::isInstance)
.map(ImageApiProfile.class::cast)
.reduce(new ImageApiProfile(), ImageApiProfile::merge);
} | java | {
"resource": ""
} |
q177291 | ImageApiProfile.merge | test | public ImageApiProfile merge(ImageApiProfile other) {
ImageApiProfile merged = new ImageApiProfile();
streamNotNull(this.features).forEach(merged::addFeature);
streamNotNull(other.features).forEach(merged::addFeature);
streamNotNull(this.formats).forEach(merged::addFormat);
streamNotNull(other.formats).forEach(merged::addFormat);
streamNotNull(this.qualities).forEach(merged::addQuality);
streamNotNull(other.qualities).forEach(merged::addQuality);
if (this.maxWidth != null && other.maxWidth == null) {
merged.maxWidth = this.maxWidth;
} else if (this.maxWidth == null && other.maxWidth != null) {
merged.maxWidth = other.maxWidth;
} else if (this.maxWidth != null) {
merged.maxWidth = Math.min(this.maxWidth, other.maxWidth);
}
if (this.maxHeight != null && other.maxHeight == null) {
merged.maxHeight = this.maxHeight;
} else if (this.maxHeight == null && other.maxHeight != null) {
merged.maxHeight = other.maxHeight;
} else if (this.maxHeight != null) {
merged.maxHeight = Math.min(this.maxHeight, other.maxHeight);
}
if (this.maxArea != null && other.maxArea == null) {
merged.maxArea = this.maxArea;
} else if (this.maxArea == null && other.maxArea != null) {
merged.maxArea = other.maxArea;
} else if (this.maxArea != null) {
merged.maxArea = Math.min(this.maxArea, other.maxArea);
}
return merged;
} | java | {
"resource": ""
} |
q177292 | RotationRequest.fromString | test | @JsonCreator
public static RotationRequest fromString(String str) throws ResolvingException {
Matcher matcher = PATTERN.matcher(str);
if (!matcher.matches()) {
throw new ResolvingException("Bad format: " + str);
}
return new RotationRequest(
new BigDecimal(matcher.group(2)),
!(matcher.group(1) == null));
} | java | {
"resource": ""
} |
q177293 | SizeRequest.fromString | test | @JsonCreator
public static SizeRequest fromString(String str) throws ResolvingException {
if (str.equals("full")) {
return new SizeRequest();
}
if (str.equals("max")) {
return new SizeRequest(true);
}
Matcher matcher = PARSE_PAT.matcher(str);
if (!matcher.matches()) {
throw new ResolvingException("Bad format: " + str);
}
if (matcher.group(1) != null) {
if (matcher.group(1).equals("!")) {
return new SizeRequest(
Integer.valueOf(matcher.group(2)),
Integer.valueOf(matcher.group(3)),
true);
} else if (matcher.group(1).equals("pct:")) {
return new SizeRequest(new BigDecimal(matcher.group(4)));
}
}
Integer width = null;
Integer height = null;
if (matcher.group(2) != null) {
width = Integer.parseInt(matcher.group(2));
}
if (matcher.group(3) != null) {
height = Integer.parseInt(matcher.group(3));
}
return new SizeRequest(width, height);
} | java | {
"resource": ""
} |
q177294 | AndroidDeviceStore.initializeAdbConnection | test | protected void initializeAdbConnection() {
// Get a device bridge instance. Initialize, create and restart.
try {
AndroidDebugBridge.init(true);
} catch (IllegalStateException e) {
// When we keep the adb connection alive the AndroidDebugBridge may
// have been already
// initialized at this point and it generates an exception. Do not
// print it.
if (!shouldKeepAdbAlive) {
logger.error(
"The IllegalStateException is not a show "
+ "stopper. It has been handled. This is just debug spew. Please proceed.",
e);
throw new NestedException("ADB init failed", e);
}
}
bridge = AndroidDebugBridge.getBridge();
if (bridge == null) {
bridge = AndroidDebugBridge.createBridge(AndroidSdk.adb()
.getAbsolutePath(), false);
}
long timeout = System.currentTimeMillis() + 60000;
while (!bridge.hasInitialDeviceList()
&& System.currentTimeMillis() < timeout) {
try {
Thread.sleep(50);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
// Add the existing devices to the list of devices we are tracking.
IDevice[] devices = bridge.getDevices();
logger.info("initialDeviceList size {}", devices.length);
for (int i = 0; i < devices.length; i++) {
logger.info("devices state: {},{} ", devices[i].getName(),
devices[i].getState());
connectedDevices.put(devices[i], new DefaultHardwareDevice(
devices[i]));
}
bridge.addDeviceChangeListener(new DeviceChangeListener(connectedDevices));
} | java | {
"resource": ""
} |
q177295 | AbstractDevice.getDump | test | public String getDump() {
pushAutomator2Device();
runtest();
String path = pullDump2PC();
String xml = "";
try {
FileInputStream fileInputStream = new FileInputStream(path);
@SuppressWarnings("resource")
BufferedReader in = new BufferedReader(
new InputStreamReader(fileInputStream));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = in.readLine()) != null) {
buffer.append(line);
}
xml = buffer.toString();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return xml;
} | java | {
"resource": ""
} |
q177296 | AbstractDevice.handlePopBox | test | public boolean handlePopBox(String deviceBrand) {
pushHandleGps2Device();
CommandLine exeCommand = null;
if (deviceBrand.contains("HTC")) {
exeCommand = adbCommand("shell", "uiautomator", "runtest",
"/data/local/tmp/handlePopBox.jar", "-c", "com.test.device.gps.HTCGPSTest");
} else if (deviceBrand.contains("Meizu")) {
exeCommand = adbCommand("shell", "uiautomator", "runtest",
"/data/local/tmp/handlePopBox.jar", "-c", "com.test.device.gps.MeizuGPSTest");
}
String output = executeCommandQuietly(exeCommand);
log.debug("run test {}", output);
try {
// give it a second to recover from the activity start
Thread.sleep(1000);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
return output.contains("OK");
} | java | {
"resource": ""
} |
q177297 | AbstractDevice.pushHandleGps2Device | test | private boolean pushHandleGps2Device() {
InputStream io = AbstractDevice.class.getResourceAsStream("handlePopBox.jar");
File dest = new File(FileUtils.getTempDirectory(), "handlePopBox.jar");
try {
FileUtils.copyInputStreamToFile(io, dest);
} catch (IOException e) {
e.printStackTrace();
}
CommandLine pushcommand = adbCommand("push ", dest.getAbsolutePath(), "/data/local/tmp/");
String outputPush = executeCommandQuietly(pushcommand);
log.debug("Push automator.jar to device {}", outputPush);
try {
// give it a second to recover from the activity start
Thread.sleep(1000);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
return outputPush.contains("KB/s");
} | java | {
"resource": ""
} |
q177298 | AbstractDevice.cleanTemp | test | public void cleanTemp() {
CommandLine dumpcommand = adbCommand("shell", "rm", "-r",
"/data/local/tmp/local/tmp/dump.xml");
executeCommandQuietly(dumpcommand);
try {
// give it a second to recover from the activity start
Thread.sleep(1000);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
CommandLine qiancommand = adbCommand("shell", "rm", "-r",
"/data/local/tmp/local/tmp/qian.xml");
String output = executeCommandQuietly(qiancommand);
log.debug("Delete file qian.xml: {}", output);
try {
// give it a second to recover from the activity start
Thread.sleep(1000);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
CommandLine command = adbCommand("shell", "rm", "-r",
"/data/local/tmp/uidump.xml");
executeCommandQuietly(command);
try {
// give it a second to recover from the activity start
Thread.sleep(1000);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
} | java | {
"resource": ""
} |
q177299 | AbstractDevice.pullDump2PC | test | public String pullDump2PC() {
String serial = device.getSerialNumber();
File dest = new File(FileUtils.getTempDirectory(), serial
+ ".xml");
String path = dest.getPath();
log.debug("pull dump file to pc's path {}", path);
CommandLine commandpull = adbCommand("pull", "/data/local/tmp/local/tmp/qian.xml", path);
String out = executeCommandQuietly(commandpull);
log.debug("pull dump file to pc's result {}", out);
return path;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.