id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
4,001
context.getApplicationContext().sendBroadcast(intent); } } @Nullable public static Location getCachedLocation(Context context) { <BUG>if (BuildConfig.DEBUG) { Log.v(LOGTAG, "Fetching cached location", new Exception()); }</BUG> Location location = null;
DebugLog.v(LOGTAG, "Fetching cached location", new Exception());
4,002
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBannerImage(fileBody); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
if (deleteImage) { Utils.deleteMedia(context, imageUri);
4,003
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBackgroundImage(fileBody, tile); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
twitter.updateProfileBannerImage(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
4,004
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); return twitter.updateProfileImage(fileBody); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
twitter.updateProfileBannerImage(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
4,005
import org.mariotaku.twidere.receiver.NotificationReceiver; import org.mariotaku.twidere.service.LengthyOperationsService; import org.mariotaku.twidere.util.ActivityTracker; import org.mariotaku.twidere.util.AsyncTwitterWrapper; import org.mariotaku.twidere.util.DataStoreFunctionsKt; <BUG>import org.mariotaku.twidere.util.DataStoreUtils; import org.mariotaku.twidere.util.ImagePreloader;</BUG> import org.mariotaku.twidere.util.InternalTwitterContentUtils; import org.mariotaku.twidere.util.JsonSerializer; import org.mariotaku.twidere.util.NotificationManagerWrapper;
import org.mariotaku.twidere.util.DebugLog; import org.mariotaku.twidere.util.ImagePreloader;
4,006
final List<InetAddress> addresses = mDns.lookup(host); for (InetAddress address : addresses) { c.addRow(new String[]{host, address.getHostAddress()}); } } catch (final IOException ignore) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, ignore); }</BUG> }
DebugLog.w(LOGTAG, null, ignore);
4,007
for (Location location : twitter.getAvailableTrends()) { map.put(location); } return map.pack(); } catch (final MicroBlogException e) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, e); }</BUG> }
DebugLog.w(LOGTAG, null, e);
4,008
import android.content.Context; import android.content.SharedPreferences; import android.location.Location; import android.os.AsyncTask; import android.support.annotation.NonNull; <BUG>import android.util.Log; import org.mariotaku.twidere.BuildConfig; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.util.JsonSerializer;</BUG> import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.DebugLog; import org.mariotaku.twidere.util.JsonSerializer;
4,009
} public static LatLng getCachedLatLng(@NonNull final Context context) { final Context appContext = context.getApplicationContext(); final SharedPreferences prefs = DependencyHolder.Companion.get(context).getPreferences(); if (!prefs.getBoolean(KEY_USAGE_STATISTICS, false)) return null; <BUG>if (BuildConfig.DEBUG) { Log.d(HotMobiLogger.LOGTAG, "getting cached location"); }</BUG> final Location location = Utils.getCachedLocation(appContext);
DebugLog.d(HotMobiLogger.LOGTAG, "getting cached location", null);
4,010
public int destroySavedSearchAsync(final UserKey accountKey, final long searchId) { final DestroySavedSearchTask task = new DestroySavedSearchTask(accountKey, searchId); return asyncTaskManager.add(task, true); } public int destroyStatusAsync(final UserKey accountKey, final String statusId) { <BUG>final DestroyStatusTask task = new DestroyStatusTask(context,accountKey, statusId); </BUG> return asyncTaskManager.add(task, true); } public int destroyUserListAsync(final UserKey accountKey, final String listId) {
final DestroyStatusTask task = new DestroyStatusTask(context, accountKey, statusId);
4,011
@Override public void afterExecute(Bus handler, SingleResponse<Relationship> result) { if (result.hasData()) { handler.post(new FriendshipUpdatedEvent(accountKey, userKey, result.getData())); } else if (result.hasException()) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, "Unable to update friendship", result.getException()); }</BUG> }
public UserKey[] getAccountKeys() { return DataStoreUtils.getActivatedAccountKeys(context);
4,012
MicroBlog microBlog = MicroBlogAPIFactory.getInstance(context, accountId); if (!Utils.isOfficialCredentials(context, accountId)) continue; try { microBlog.setActivitiesAboutMeUnread(cursor); } catch (MicroBlogException e) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, e); }</BUG> }
DebugLog.w(LOGTAG, null, e);
4,013
} else if (actions.size() > 1) { Long purgeStart = System.currentTimeMillis(); List<IndexAction> itemActions = Lists.newArrayList(); List<IndexAction> embeddedActions = Lists.newArrayList(); for (IndexAction action : actions) { <BUG>if(action.getClass().isAssignableFrom(EmbeddedIndexAction.class)){ </BUG> embeddedActions.add(action); } else { itemActions.add(action);
if (action.getClass().isAssignableFrom(EmbeddedIndexAction.class)) {
4,014
embeddedTime = System.currentTimeMillis(); for (IndexAction action : embeddedActions) { action.setLatch(embeddedLatch); this.offer(action, 1000, TimeUnit.SECONDS); types.add(action.getPayloadClass().getSimpleName()); <BUG>ecount ++; }</BUG> embeddedLatch.await(1500, TimeUnit.MILLISECONDS); embeddedTime = System.currentTimeMillis() - embeddedTime; Set<String> refreshedIndexes = new HashSet<String>();
ecount++; }
4,015
embeddedTime = System.currentTimeMillis() - embeddedTime; Set<String> refreshedIndexes = new HashSet<String>(); refreshTime = System.currentTimeMillis(); for (IndexAction action : actions) { if (action.getIndex() != null && <BUG>!refreshedIndexes.contains(action.getIndex().getIndexName())){ </BUG> refreshedIndexes.add(action.getIndex().getIndexName()); action.getIndex().refresh(); refreshes.add(action.getIndex().getIndexName());
!refreshedIndexes.contains(action.getIndex().getIndexName())) {
4,016
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; <BUG>import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List;</BUG> public final class PatchUtils {
import java.text.DateFormat; import java.util.Date; import java.util.List;
4,017
package org.jboss.as.patching.runner; <BUG>import org.jboss.as.boot.DirectoryStructure; import org.jboss.as.patching.LocalPatchInfo;</BUG> import org.jboss.as.patching.PatchInfo; import org.jboss.as.patching.PatchLogger; import org.jboss.as.patching.PatchMessages;
import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp; import org.jboss.as.patching.CommonAttributes; import org.jboss.as.patching.LocalPatchInfo;
4,018
private static final String PATH_DELIMITER = "/"; public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT; enum Element { ADDED_BUNDLE("added-bundle"), ADDED_MISC_CONTENT("added-misc-content"), <BUG>ADDED_MODULE("added-module"), BUNDLES("bundles"),</BUG> CUMULATIVE("cumulative"), DESCRIPTION("description"), MISC_FILES("misc-files"),
APPLIES_TO_VERSION("applies-to-version"), BUNDLES("bundles"),
4,019
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { <BUG>case APPLIES_TO_VERSION: builder.addAppliesTo(value); break;</BUG> case RESULTING_VERSION: if(type == Patch.PatchType.CUMULATIVE) {
[DELETED]
4,020
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); <BUG>writer.writeAttribute(Attribute.PATH.name, path.toString()); if(type != ModificationType.REMOVE) {</BUG> writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash())); } if(type != ModificationType.ADD) {
if (item.isDirectory()) { writer.writeAttribute(Attribute.DIRECTORY.name, "true"); if(type != ModificationType.REMOVE) {
4,021
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; <BUG>import org.jboss.logging.annotations.MessageBundle; import java.io.IOException;</BUG> import java.util.List; @MessageBundle(projectCode = "JBAS") public interface PatchMessages {
import org.jboss.logging.annotations.Cause; import java.io.IOException;
4,022
customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString()); customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName); customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString()); customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName); customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString()); <BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName); }</BUG> public void init() { try { LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName); customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName); }
4,023
package br.univali.portugol.nucleo.execucao; import br.univali.portugol.nucleo.asa.No; public final class PontoParada { <BUG>private final No no; public PontoParada(No no)</BUG> { this.no = no; }
private boolean ativo = false; public PontoParada(No no)
4,024
} @Override public boolean ehParavel(Depurador.Estado estado) { if(getCondicao() != null){ <BUG>return super.ehParavel(estado) || (getCondicao().temPontoDeParada() && estado == Depurador.Estado.BREAK_POINT); }</BUG> return super.ehParavel(estado); } public void setBlocos(List<NoBloco> blocos)
return super.ehParavel(estado) || getCondicao().ehParavel(estado);
4,025
import com.google.common.base.Converter; import com.google.common.collect.ImmutableMap; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.graph.Triple; import org.fcrepo.kernel.api.FedoraTypes; <BUG>import org.fcrepo.kernel.api.models.NonRdfSourceDescription; import org.fcrepo.kernel.api.models.FedoraBinary;</BUG> import org.fcrepo.kernel.api.models.FedoraResource; import org.fcrepo.kernel.api.exception.AccessDeniedException; import org.fcrepo.kernel.api.exception.ConstraintViolationException;
[DELETED]
4,026
.or(UncheckedPredicate.uncheck(p -> p.getName().equals("#"))); private static final Converter<FedoraResource, FedoraResource> datastreamToBinary = new Converter<FedoraResource, FedoraResource>() { @Override protected FedoraResource doForward(final FedoraResource fedoraResource) { <BUG>if (fedoraResource instanceof NonRdfSourceDescription) { return ((NonRdfSourceDescription) fedoraResource).getDescribedResource(); } return fedoraResource;</BUG> }
[DELETED]
4,027
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Resource; import org.fcrepo.http.api.FedoraVersioning; import org.fcrepo.http.api.repository.FedoraRepositoryTransactions; import org.fcrepo.http.commons.api.rdf.UriAwareResourceModelFactory; <BUG>import org.fcrepo.kernel.api.models.NonRdfSource; import org.fcrepo.kernel.api.models.NonRdfSourceDescription;</BUG> import org.fcrepo.kernel.api.models.FedoraBinary; import org.fcrepo.kernel.api.models.FedoraResource; import org.fcrepo.kernel.api.identifiers.IdentifierConverter;
[DELETED]
4,028
if (resource.hasType(FEDORA_REPOSITORY_ROOT)) { addRepositoryStatements(uriInfo, model, s); } else { addNodeStatements(resource, uriInfo, model, s); } <BUG>if (resource instanceof NonRdfSourceDescription) { final NonRdfSource describedResource = ((NonRdfSourceDescription) resource).getDescribedResource(); if (describedResource instanceof FedoraBinary) { addContentStatements(idTranslator, (FedoraBinary)describedResource, model); } } else if (resource instanceof FedoraBinary) { addContentStatements(idTranslator, (FedoraBinary)resource, model);</BUG> }
if (resource.getDescribedResource() instanceof FedoraBinary) { addContentStatements(idTranslator, (FedoraBinary)resource.getDescribedResource(), model);
4,029
session.logout(); } @Test public void testGetFederatedDatastream() throws RepositoryException { final Session session = repo.login(); <BUG>final NonRdfSourceDescription nonRdfSourceDescription = binaryService.findOrCreate(session, testFilePath()).getDescription(); assertNotNull(nonRdfSourceDescription); final Node node = getJcrNode(nonRdfSourceDescription); final NodeType[] mixins = node.getMixinNodeTypes();</BUG> assertEquals(2, mixins.length);
final FedoraResource description = binaryService.findOrCreate(session, testFilePath()).getDescription(); assertNotNull(description); final Node node = getJcrNode(description); final NodeType[] mixins = node.getMixinNodeTypes();
4,030
resource().isNew() ? new DefaultRdfStream(asNode(resource())) : getResourceTriples()) { LOGGER.info("PATCH for '{}'", externalPath); patchResourcewithSparql(resource(), requestBody, resourceTriples); } session.save(); <BUG>if (resource() instanceof FedoraBinary) { final NonRdfSourceDescription description = ((FedoraBinary)resource()).getDescription(); addCacheControlHeaders(servletResponse, description, session); } else { addCacheControlHeaders(servletResponse, resource(), session); }</BUG> return noContent().build();
addCacheControlHeaders(servletResponse, resource().getDescription(), session);
4,031
import org.fcrepo.kernel.api.identifiers.IdentifierConverter; import org.fcrepo.kernel.api.RdfStream; import org.fcrepo.kernel.api.services.policy.StoragePolicyDecisionPoint; import java.io.InputStream; import java.net.URI; <BUG>public interface FedoraBinary extends NonRdfSource { </BUG> InputStream getContent(); void setContent(InputStream content, String contentType, URI checksum, String originalFileName,
public interface FedoraBinary extends FedoraResource {
4,032
when(mockWorkspace.getNamespaceRegistry()).thenReturn(mockNamespaceRegistry); when(mockNamespaceRegistry.getPrefixes()).thenReturn(new String[]{}); when(mockNamespaceService.getNamespaces(any(Session.class))).thenReturn(emptyMap()); when(mockHttpConfiguration.putRequiresIfMatch()).thenReturn(false); when(mockContainer.getEtagValue()).thenReturn(""); <BUG>when(mockContainer.getPath()).thenReturn(path); when(mockNonRdfSourceDescription.getEtagValue()).thenReturn("");</BUG> when(mockNonRdfSourceDescription.getPath()).thenReturn(binaryDescriptionPath); when(mockNonRdfSourceDescription.getDescribedResource()).thenReturn(mockBinary); when(mockBinary.getEtagValue()).thenReturn("");
when(mockContainer.getDescription()).thenReturn(mockContainer); when(mockContainer.getDescribedResource()).thenReturn(mockContainer); when(mockNonRdfSourceDescription.getEtagValue()).thenReturn("");
4,033
of(Triple.create(createURI(invocationOnMock.getMock().toString()), createURI("called"), createURI(invocationOnMock.getArguments()[1].toString())))); doReturn(mockResource).when(testObj).resource(); when(mockResource.getPath()).thenReturn(path); <BUG>when(mockResource.getEtagValue()).thenReturn(""); when(mockResource.getTriples(eq(idTranslator), anySetOf(TripleCategory.class))).thenAnswer(answer);</BUG> when(mockResource.getTriples(eq(idTranslator), any(TripleCategory.class))).thenAnswer(answer); return mockResource; }
when(mockResource.getDescription()).thenReturn(mockResource); when(mockResource.getDescribedResource()).thenReturn(mockResource); when(mockResource.getTriples(eq(idTranslator), anySetOf(TripleCategory.class))).thenAnswer(answer);
4,034
import static org.modeshape.jcr.api.JcrConstants.JCR_CONTENT; import static org.slf4j.LoggerFactory.getLogger; import javax.jcr.Node; import javax.jcr.RepositoryException; import org.fcrepo.kernel.api.exception.RepositoryRuntimeException; <BUG>import org.fcrepo.kernel.api.models.NonRdfSource; </BUG> import org.fcrepo.kernel.api.models.NonRdfSourceDescription; import org.slf4j.Logger; public class NonRdfSourceDescriptionImpl extends FedoraResourceImpl implements NonRdfSourceDescription {
import org.fcrepo.kernel.api.models.FedoraResource;
4,035
private static final Logger LOGGER = getLogger(NonRdfSourceDescriptionImpl.class); public NonRdfSourceDescriptionImpl(final Node n) { super(n); } @Override <BUG>public NonRdfSource getDescribedResource() { </BUG> return new FedoraBinaryImpl(getContentNode()); } private Node getContentNode() {
public FedoraResource getDescribedResource() {
4,036
servletResponse.addHeader("Content-Length", String.valueOf(binary.getContentSize())); servletResponse.addHeader("Accept-Ranges", "bytes"); servletResponse.addHeader("Content-Disposition", contentDisposition.toString()); } servletResponse.addHeader("Link", "<" + LDP_NAMESPACE + "Resource>;rel=\"type\""); <BUG>if (resource instanceof NonRdfSource) { </BUG> servletResponse.addHeader("Link", "<" + LDP_NAMESPACE + "NonRDFSource>;rel=\"type\""); } else if (resource instanceof Container) { servletResponse.addHeader("Link", "<" + CONTAINER.getURI() + ">;rel=\"type\"");
if (resource instanceof FedoraBinary) {
4,037
date = binary.getDescription().getLastModifiedDate(); </BUG> } else { <BUG>etag = new EntityTag(resource.getEtagValue(), true); date = resource.getLastModifiedDate(); </BUG> } if (!etag.getValue().isEmpty()) {
if (txId != null) { return; final EntityTag etag; final Date date; if (resource instanceof FedoraBinary) { etag = new EntityTag(resource.getDescription().getEtagValue()); date = resource.getDescription().getLastModifiedDate(); etag = new EntityTag(resource.getDescribedResource().getEtagValue(), true); date = resource.getDescribedResource().getLastModifiedDate();
4,038
resource.replaceProperties(translator(), inputModel, resourceTriples); } protected void patchResourcewithSparql(final FedoraResource resource, final String requestBody, final RdfStream resourceTriples) { <BUG>if (resource instanceof NonRdfSourceDescription) { ((NonRdfSourceDescription) resource).getDescribedResource() .updateProperties(translator(), requestBody, resourceTriples); } else { resource.updateProperties(translator(), requestBody, resourceTriples); }</BUG> }
resource.getDescribedResource().updateProperties(translator(), requestBody, resourceTriples);
4,039
final Node node = getNode(path); final boolean metadata = values.containsKey("path") && values.get("path").endsWith("/" + FCR_METADATA); final FedoraResource fedoraResource = nodeConverter.convert(node); if (!metadata && fedoraResource instanceof NonRdfSourceDescription) { <BUG>return ((NonRdfSourceDescription)fedoraResource).getDescribedResource(); }</BUG> return fedoraResource; } throw new IdentifierConversionException("Asked to translate a resource " + resource
return fedoraResource.getDescribedResource();
4,040
} catch (final RepositoryException e) { LOGGER.warn("Count not decorate {} with FedoraBinary properties: {}", node, e); } } @Override <BUG>public NonRdfSourceDescription getDescription() { try {</BUG> return new NonRdfSourceDescriptionImpl(getNode().getParent()); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e);
public FedoraResource getDescription() { try {
4,041
throw new InvalidChecksumException("Checksum Mismatch of " + uriChecksumString + " and " + checksum); } decorateContentNode(contentNode); touch(); <BUG>((NonRdfSourceDescriptionImpl)getDescription()).touch(); </BUG> LOGGER.debug("Created data property at path: {}", dataProperty.getPath()); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e);
((FedoraResourceImpl) getDescription()).touch();
4,042
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
4,043
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();
4,044
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
4,045
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
4,046
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
4,047
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
4,048
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
4,049
} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_memo); <BUG>ChinaPhoneHelper.setStatusBar(this,true); </BUG> topicId = getIntent().getLongExtra("topicId", -1); if (topicId == -1) { finish();
ChinaPhoneHelper.setStatusBar(this, true);
4,050
MemoEntry.COLUMN_REF_TOPIC__ID + " = ?" , new String[]{String.valueOf(topicId)}); } public Cursor selectMemo(long topicId) { Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null, <BUG>MemoEntry._ID + " DESC", null); </BUG> if (c != null) { c.moveToFirst(); }
MemoEntry.COLUMN_ORDER + " ASC", null);
4,051
MemoEntry._ID + " = ?", new String[]{String.valueOf(memoId)}); } public long updateMemoContent(long memoId, String memoContent) { ContentValues values = new ContentValues(); <BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent); return db.update(</BUG> MemoEntry.TABLE_NAME, values, MemoEntry._ID + " = ?",
return db.update(
4,052
import android.widget.RelativeLayout; import android.widget.TextView; import com.kiminonawa.mydiary.R; import com.kiminonawa.mydiary.db.DBManager; import com.kiminonawa.mydiary.shared.EditMode; <BUG>import com.kiminonawa.mydiary.shared.ThemeManager; import java.util.List; public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode { </BUG> private List<MemoEntity> memoList;
import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter; public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
4,053
private DBManager dbManager; private boolean isEditMode = false; private EditMemoDialogFragment.MemoCallback callback; private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; <BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) { this.mActivity = activity;</BUG> this.topicId = topicId; this.memoList = memoList;
public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) { super(recyclerView); this.mActivity = activity;
4,054
this.memoList = memoList; this.dbManager = dbManager; this.callback = callback; } @Override <BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { </BUG> View view; if (isEditMode) { if (viewType == TYPE_HEADER) {
public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
4,055
editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment"); } }); } } <BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private View rootView; private TextView TV_memo_item_content;</BUG> private ImageView IV_memo_item_delete;
protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private ImageView IV_memo_item_dot; private TextView TV_memo_item_content;
4,056
package com.liferay.portlet.documentlibrary.service.permission; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.repository.model.Folder; <BUG>import com.liferay.portal.kernel.staging.permission.StagingPermissionUtil; import com.liferay.portal.security.auth.PrincipalException;</BUG> import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.security.permission.PermissionChecker; import com.liferay.portal.util.PortletKeys;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.security.auth.PrincipalException;
4,057
dlFolder.getFolderId(), PortletKeys.DOCUMENT_LIBRARY, actionId); if (hasPermission != null) { return hasPermission.booleanValue(); } long folderId = dlFolder.getFolderId(); <BUG>if (actionId.equals(ActionKeys.VIEW)) { while (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { try { dlFolder = DLFolderLocalServiceUtil.getFolder(folderId); folderId = dlFolder.getParentFolderId();</BUG> if (!permissionChecker.hasOwnerPermission(
if (PropsValues.PERMISSIONS_VIEW_DYNAMIC_INHERITANCE) { DLFolder originalFolder = dlFolder; while (folderId !=
4,058
package com.liferay.portlet.messageboards.service.permission; import com.liferay.portal.kernel.exception.PortalException; <BUG>import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.security.auth.PrincipalException;</BUG> import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.security.permission.PermissionChecker; import com.liferay.portal.util.PropsValues;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.security.auth.PrincipalException;
4,059
JDD.Deref(varColRangeDDs[i]); }</BUG> JDD.Deref(range); <BUG>if (modelType == ModelType.MDP) { for (i = 0; i < ddSynchVars.length; i++) { JDD.Deref(ddSynchVars[i]); } for (i = 0; i < ddSchedVars.length; i++) { JDD.Deref(ddSchedVars[i]); } for (i = 0; i < ddChoiceVars.length; i++) { JDD.Deref(ddChoiceVars[i]); }</BUG> }
for (int l = 0; l < numLabels; l++) { model.addLabelDD(modelGen.getLabelName(l), labelsArray[l]); JDD.Deref(moduleIdentities[0]); JDD.Deref(moduleRangeDDs[0]); JDD.DerefArray(varIdentities, numVars); JDD.DerefArray(varRangeDDs, numVars); JDD.DerefArray(varColRangeDDs, numVars); JDD.DerefArray(ddSynchVars, ddSynchVars.length); JDD.DerefArray(ddSchedVars, ddSchedVars.length); JDD.DerefArray(ddChoiceVars, ddChoiceVars.length);
4,060
int i; range = JDD.Constant(1); varRangeDDs = new JDDNode[numVars]; varColRangeDDs = new JDDNode[numVars]; for (i = 0; i < numVars; i++) { <BUG>JDD.Ref(varIdentities[i]); varRangeDDs[i] = JDD.SumAbstract(varIdentities[i], varDDColVars[i]); JDD.Ref(varIdentities[i]); varColRangeDDs[i] = JDD.SumAbstract(varIdentities[i], varDDRowVars[i]); JDD.Ref(varRangeDDs[i]); range = JDD.Apply(JDD.TIMES, range, varRangeDDs[i]); </BUG> }
varRangeDDs[i] = JDD.SumAbstract(varIdentities[i].copy(), varDDColVars[i]); varColRangeDDs[i] = JDD.SumAbstract(varIdentities[i].copy(), varDDRowVars[i]); range = JDD.Apply(JDD.TIMES, range, varRangeDDs[i].copy());
4,061
JDD.Ref(varRangeDDs[i]); range = JDD.Apply(JDD.TIMES, range, varRangeDDs[i]); </BUG> } moduleRangeDDs = new JDDNode[1]; <BUG>JDD.Ref(moduleIdentities[0]); moduleRangeDDs[0] = JDD.SumAbstract(moduleIdentities[0], moduleDDColVars[0]); </BUG> } private void buildTransAndRewards() throws PrismException
int i; range = JDD.Constant(1); varRangeDDs = new JDDNode[numVars]; varColRangeDDs = new JDDNode[numVars]; for (i = 0; i < numVars; i++) { varRangeDDs[i] = JDD.SumAbstract(varIdentities[i].copy(), varDDColVars[i]); varColRangeDDs[i] = JDD.SumAbstract(varIdentities[i].copy(), varDDRowVars[i]); range = JDD.Apply(JDD.TIMES, range, varRangeDDs[i].copy()); moduleRangeDDs[0] = JDD.SumAbstract(moduleIdentities[0].copy(), moduleDDColVars[0]);
4,062
tmp = transPerAction.get(k); } else { tmp = JDD.Constant(0); transPerAction.add(tmp); } <BUG>JDD.Ref(elem); tmp = JDD.Apply(JDD.PLUS, tmp, JDD.Apply(JDD.TIMES, JDD.Constant(d), elem)); </BUG> transPerAction.set(k, tmp); }
tmp = JDD.Apply(JDD.PLUS, tmp, JDD.Apply(JDD.TIMES, JDD.Constant(d), elem.copy()));
4,063
tmp = JDD.Apply(JDD.PLUS, tmp, JDD.Apply(JDD.TIMES, JDD.Constant(d), elem)); </BUG> transPerAction.set(k, tmp); } else { <BUG>JDD.Ref(elem); tmp = JDD.ThereExists(elem, allDDColVars); </BUG> transActions = JDD.Apply(JDD.MAX, transActions, JDD.Apply(JDD.TIMES, JDD.Constant(j), tmp)); }
tmp = transPerAction.get(k); } else { tmp = JDD.Constant(0); transPerAction.add(tmp); tmp = JDD.Apply(JDD.PLUS, tmp, JDD.Apply(JDD.TIMES, JDD.Constant(d), elem.copy())); tmp = JDD.ThereExists(elem.copy(), allDDColVars);
4,064
private final GetOffsetForPartitionFunction getOffset = new GetOffsetForPartitionFunction(); private final PartitionToLeaderFunction getLeader = new PartitionToLeaderFunction(); private final Function<Partition, Partition> passThru = Functions.getPassThru(); private final LaunchFetchTaskProcedure launchFetchTask = new LaunchFetchTaskProcedure(); private final Object lifecycleMonitor = new Object(); <BUG>private final KafkaTemplate kafkaTemplate; private Partition[] partitions; private String[] topics;</BUG> public boolean autoStartup = true; private Executor fetchTaskExecutor;
private final String[] topics;
4,065
public KafkaMessageListenerContainer(ConnectionFactory connectionFactory, Partition... partitions) { Assert.notNull(connectionFactory, "A connection factory must be supplied"); Assert.notEmpty(partitions, "A list of partitions must be provided"); Assert.noNullElements(partitions, "The list of partitions cannot contain null elements"); this.kafkaTemplate = new KafkaTemplate(connectionFactory); <BUG>this.partitions = partitions; }</BUG> public KafkaMessageListenerContainer(final ConnectionFactory connectionFactory, String... topics) { Assert.notNull(connectionFactory, "A connection factory must be supplied"); Assert.notNull(topics, "A list of topics must be provided");
this.topics = null; }
4,066
Assert.notNull(connectionFactory, "A connection factory must be supplied"); Assert.notNull(topics, "A list of topics must be provided"); Assert.noNullElements(topics, "The list of topics cannot contain null elements"); this.kafkaTemplate = new KafkaTemplate(connectionFactory); this.topics = topics; <BUG>} private static Partition[] getPartitionsForTopics(final ConnectionFactory connectionFactory, String[] topics) { MutableList<Partition> partitionList = flatCollect(topics, new GetPartitionsForTopic(connectionFactory)); return partitionList.toArray(new Partition[partitionList.size()]);</BUG> }
Assert.notEmpty(partitions, "A list of partitions must be provided"); Assert.noNullElements(partitions, "The list of partitions cannot contain null elements"); this.partitions = partitions; this.topics = null; public KafkaMessageListenerContainer(final ConnectionFactory connectionFactory, String... topics) {
4,067
public boolean isRunning() { return this.running; } @Override public int getPhase() { <BUG>return 0; }</BUG> public class FetchTask implements Runnable { private BrokerAddress brokerAddress; public FetchTask(BrokerAddress brokerAddress) {
private static Partition[] getPartitionsForTopics(final ConnectionFactory connectionFactory, String[] topics) { MutableList<Partition> partitionList = flatCollect(topics, new GetPartitionsForTopic(connectionFactory)); return partitionList.toArray(new Partition[partitionList.size()]);
4,068
package org.springframework.integration.kafka.core; import java.util.List; public class BrokerAddressListConfiguration extends AbstractConfiguration { private final List<BrokerAddress> brokerAddresses; <BUG>public BrokerAddressListConfiguration(List<BrokerAddress> brokerAddresses) { this.brokerAddresses = brokerAddresses; </BUG> }
import java.util.Arrays; public BrokerAddressListConfiguration(BrokerAddress... brokerAddresses) { this.brokerAddresses = Arrays.asList(brokerAddresses);
4,069
import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; public class KafkaNamespaceHandler extends AbstractIntegrationNamespaceHandler { @Override public void init() { registerBeanDefinitionParser("zookeeper-connect", new ZookeeperConnectParser()); <BUG>registerBeanDefinitionParser("inbound-channel-adapter", new KafkaInboundChannelAdapterParser()); registerBeanDefinitionParser("outbound-channel-adapter", new KafkaOutboundChannelAdapterParser()); registerBeanDefinitionParser("producer-context", new KafkaProducerContextParser()); registerBeanDefinitionParser("consumer-context", new KafkaConsumerContextParser()); }</BUG> }
registerBeanDefinitionParser("inbound-channel-adapter", new KafkaInboundChannelAdapterParser()); registerBeanDefinitionParser("outbound-channel-adapter", new KafkaOutboundChannelAdapterParser()); registerBeanDefinitionParser("producer-context", new KafkaProducerContextParser()); registerBeanDefinitionParser("consumer-context", new KafkaConsumerContextParser()); registerBeanDefinitionParser("message-driven-channel-adapter", new KafkaMessageDrivenChannelAdapterParser());
4,070
roots.add(modelRoot); } Set<SModelDescriptor> models = new HashSet<SModelDescriptor>(); SModelRepository.getInstance().readModelDescriptors(roots, models, myProject); for (SModelDescriptor model : models) { <BUG>if (model.getFQName().equals(generator.getTemplatesModel().getName())) return model; } getMessageView().add(new Message(MessageKind.WARNING, "Couldn't find templates model " + generator.getTemplatesModel().getName())); return null;</BUG> }
if (model.getFQName().equals(generator.getTemplatesModel())) return model; getMessageView().add(new Message(MessageKind.WARNING, "Couldn't find templates model " + generator.getTemplatesModel())); return null;
4,071
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.Progressable; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AFileSystem extends FileSystem {</BUG> private URI uri; private Path workingDir; private AmazonS3Client s3;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
4,072
public void initialize(URI name, Configuration conf) throws IOException { super.initialize(name, conf); uri = URI.create(name.getScheme() + "://" + name.getAuthority()); workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri, this.getWorkingDirectory()); <BUG>String accessKey = conf.get(ACCESS_KEY, null); String secretKey = conf.get(SECRET_KEY, null); </BUG> String userInfo = name.getUserInfo();
String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null)); String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
4,073
} else { accessKey = userInfo; } } AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( <BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey), new InstanceProfileCredentialsProvider(), new S3AAnonymousAWSCredentialsProvider() );</BUG> bucket = name.getHost();
new BasicAWSCredentialsProvider(accessKey, secretKey), new AnonymousAWSCredentialsProvider()
4,074
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)); </BUG> s3 = new AmazonS3Client(credentials, awsConf); <BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS); partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (partSize < 5 * 1024 * 1024) {
new InstanceProfileCredentialsProvider(), new AnonymousAWSCredentialsProvider() bucket = name.getHost(); ClientConfiguration awsConf = new ClientConfiguration(); awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS))); awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP); awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES))); awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT))); maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS)); partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE)); partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
4,075
cannedACL = null; } if (!s3.doesBucketExist(bucket)) { throw new IOException("Bucket " + bucket + " does not exist"); } <BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART); long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE); </BUG> if (purgeExistingMultipart) {
boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART)); long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
4,076
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AOutputStream extends OutputStream {</BUG> private OutputStream backupStream; private File backupFile; private boolean closed;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
4,077
this.client = client; this.progress = progress; this.fs = fs; this.cannedACL = cannedACL; this.statistics = statistics; <BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (conf.get(BUFFER_DIR, null) != null) {
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
4,078
import com.intellij.openapi.fileEditor.FileEditorLocation; import com.intellij.openapi.fileEditor.FileEditorState; import com.intellij.openapi.fileEditor.FileEditorStateLevel; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.UserDataHolderBase; <BUG>import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager;</BUG> import org.intellij.images.editor.ImageEditor; import org.intellij.images.editor.ImageFileEditor; import org.intellij.images.editor.ImageZoomModel;
[DELETED]
4,079
import java.io.Serializable; final class ImageFileEditorImpl extends UserDataHolderBase implements ImageFileEditor { @NonNls private static final String NAME = "ImageFileEditor"; private final ImageEditor imageEditor; <BUG>ImageFileEditorImpl(@NotNull Project project, @NotNull VirtualFile file) { imageEditor = ImageEditorManagerImpl.createImageEditor(project, file); VirtualFileManager.getInstance().addVirtualFileListener(imageEditor);</BUG> Options options = OptionsManager.getInstance().getOptions();
ImageFileEditorImpl(@NotNull Project project, @NotNull ImageContentProvider contentProvider) { imageEditor = ImageEditorManagerImpl.createImageEditor(project, contentProvider);
4,080
public boolean accept(@NotNull Project project, @NotNull VirtualFile file) { return typeManager.isImage(file); } @NotNull public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) { <BUG>return new ImageFileEditorImpl(project, file); }</BUG> public void disposeEditor(@NotNull FileEditor editor) { Disposer.dispose(editor); }
ImageContentProvider contentProvider = new VirtualFileImageContentProvider(file); ImageFileEditorImpl editor = new ImageFileEditorImpl(project, contentProvider); Disposer.register(editor, contentProvider); return editor;
4,081
package org.intellij.images.editor; import com.intellij.openapi.Disposable; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; <BUG>import com.intellij.openapi.vfs.VirtualFileListener; import org.intellij.images.ui.ImageComponentDecorator; import javax.swing.*; public interface ImageEditor extends Disposable, VirtualFileListener, ImageComponentDecorator { VirtualFile getFile(); Project getProject();</BUG> ImageDocument getDocument();
import org.jetbrains.annotations.Nullable; public interface ImageEditor extends Disposable, ImageComponentDecorator { @Nullable long getFileLength(); Project getProject();
4,082
if (PlatformDataKeys.PROJECT.is(dataId)) { return editor.getProject(); } else if (PlatformDataKeys.VIRTUAL_FILE.is(dataId)) { return editor.getFile(); } else if (PlatformDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) { <BUG>return new VirtualFile[]{editor.getFile()}; } else if (LangDataKeys.PSI_FILE.is(dataId)) {</BUG> return getData(LangDataKeys.PSI_ELEMENT.getName()); } else if (LangDataKeys.PSI_ELEMENT.is(dataId)) { VirtualFile file = editor.getFile();
final VirtualFile file = editor.getFile(); return file != null ? new VirtualFile[]{file} : null; } else if (LangDataKeys.PSI_FILE.is(dataId)) {
4,083
return editorUI; } public JComponent getContentComponent() { return editorUI.getImageComponent(); } <BUG>@NotNull public VirtualFile getFile() { return file; }</BUG> @NotNull
@Nullable return contentProvider.getVirtualFile(); public long getFileLength() { return contentProvider.getFileLength();
4,084
import org.jetbrains.annotations.NotNull; final class ImageEditorManagerImpl { private ImageEditorManagerImpl() { } @NotNull <BUG>public static ImageEditor createImageEditor(@NotNull Project project, @NotNull VirtualFile file) { return new ImageEditorImpl(project, file); </BUG> }
public static ImageEditor createImageEditor(@NotNull Project project, @NotNull ImageContentProvider contentProvider) { return new ImageEditorImpl(project, contentProvider);
4,085
private static boolean ourDebugMode; private Disposer() { } @NotNull public static Disposable newDisposable() { <BUG>return new Disposable() { public void dispose() {</BUG> } }; }
@Override public void dispose() {
4,086
assert parent != child : " Cannot register to itself"; ourTree.register(parent, child); if (key != null) { assert get(key) == null; ourKeyDisposables.put(key, child); <BUG>register(child, new Disposable() { public void dispose() {</BUG> ourKeyDisposables.remove(key); } });
@Override public void dispose() {
4,087
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import com.intellij.util.NotNullFunction; public class NotNullLazyKey<T,H extends UserDataHolder> extends Key<T>{ private final NotNullFunction<H,T> myFunction; <BUG>private NotNullLazyKey(@NonNls String name, final NotNullFunction<H, T> function) { </BUG> super(name); myFunction = function; }
private NotNullLazyKey(@NotNull @NonNls String name, @NotNull NotNullFunction<H, T> function) {
4,088
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> { private final T myDefaultImplementation; <BUG>private final /* non static!!! */ Key<T> IN_LANGUAGE_CACHE = new Key<T>("EXTENSIONS_IN_LANGUAGE"); public LanguageExtension(@NonNls final String epName) {</BUG> this(epName, null); } public LanguageExtension(@NonNls final String epName, @Nullable final T defaultImplementation) {
private final /* non static!!! */ Key<T> IN_LANGUAGE_CACHE; public LanguageExtension(@NonNls final String epName) {
4,089
op.composite(); op.opaque("none"); op.addImage(framedDeviceScreen); cmd.run(op); } <BUG>public List<TestResults> creatResultsSet () throws Exception { List<TestResults> testResultList=new ArrayList<TestResults>(); </BUG> File dir = new File(System.getProperty("user.dir") + "/target/screenshot");
public static List<TestResults> creatResultsSet() throws Exception { List<TestResults> testResultList = new ArrayList<TestResults>();
4,090
mainObj.add(jsonObject); file1.write(mainObj.toString()); file1.flush(); file1.close(); } <BUG>public static void createAnimatedGif(List<File> testScreenshots, File animatedGif) throws IOException { AnimatedGifEncoder encoder = new AnimatedGifEncoder();</BUG> encoder.start(animatedGif.getAbsolutePath()); encoder.setDelay(1500 /* 1.5 seconds */); encoder.setQuality(3 /* highest */);
public static void createAnimatedGif(List<File> testScreenshots, File animatedGif) AnimatedGifEncoder encoder = new AnimatedGifEncoder();
4,091
public String deviceModel; public File scrFile = null; private Map<Long, ExtentTest> parentContext = new HashMap<Long, ExtentTest>(); private static ArrayList<String> devices = new ArrayList<String>(); public static Properties prop = new Properties(); <BUG>private static IOSDeviceConfiguration iosDevice = new IOSDeviceConfiguration(); private static AndroidDeviceConfiguration androidDevice = new AndroidDeviceConfiguration(); private static ConcurrentHashMap<String, Boolean> deviceMapping = </BUG> new ConcurrentHashMap<String, Boolean>();
public static IOSDeviceConfiguration iosDevice = new IOSDeviceConfiguration(); public static AndroidDeviceConfiguration androidDevice = new AndroidDeviceConfiguration(); public static ConcurrentHashMap<String, Boolean> deviceMapping =
4,092
.replaceAll("\\W", "_") + "__" + methodName + ".txt"); log_file_writer = new PrintWriter(logFile); } } public void endLogTestResults(ITestResult result) throws IOException, InterruptedException { <BUG>final String classNameCur=result.getName().split(" ")[2].substring(1); </BUG> final Package[] packages = Package.getPackages(); String className = null; for (final Package p : packages) {
final String classNameCur = result.getName().split(" ")[2].substring(1);
4,093
try { Class.forName(tentative); } catch (final ClassNotFoundException e) { continue; } <BUG>className=tentative; </BUG> break; } if (result.isSuccess()) {
className = tentative;
4,094
+ device_udid.replaceAll("\\W", "_") + "__" + result.getMethod() .getMethodName() + ".txt" + ">AdbLogs</a>"); System.out.println(driver.getSessionId() + ": Saving device log - Done."); } } <BUG>if (result.getStatus() == ITestResult.FAILURE) {</BUG> ExtentTestManager.getTest() .log(LogStatus.FAIL, result.getMethod().getMethodName(), result.getThrowable());
if (result.getStatus() == ITestResult.FAILURE) {
4,095
return androidWebCapabilities; } public synchronized DesiredCapabilities iosNative() { DesiredCapabilities iOSCapabilities = new DesiredCapabilities(); System.out.println("Setting iOS Desired Capabilities:"); <BUG>iOSCapabilities.setCapability("platformVersion", "9.0"); iOSCapabilities.setCapability("app", prop.getProperty("IOS_APP_PATH")); iOSCapabilities.setCapability("bundleId", prop.getProperty("BUNDLE_ID")); iOSCapabilities.setCapability("autoAcceptAlerts", true); iOSCapabilities.setCapability("deviceName", "iPhone"); return iOSCapabilities;</BUG> }
iOSCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.0"); iOSCapabilities.setCapability(MobileCapabilityType.APP, prop.getProperty("IOS_APP_PATH")); iOSCapabilities .setCapability(IOSMobileCapabilityType.BUNDLE_ID, prop.getProperty("BUNDLE_ID")); iOSCapabilities.setCapability(IOSMobileCapabilityType.AUTO_ACCEPT_ALERTS, true); iOSCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone"); iOSCapabilities.setCapability(MobileCapabilityType.UDID, device_udid); return iOSCapabilities;
4,096
public void captureScreenshot(String methodName, String device, String className) throws IOException, InterruptedException { scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(scrFile, new File( System.getProperty("user.dir") + "/target/screenshot/" + device + "/" + device_udid <BUG>.replaceAll("\\W", "_") + "/" + className+ "/"+ methodName +"/" + deviceModel + "_"+methodName+"_failed"+".png")); Thread.sleep(3000);</BUG> } public void logger(String message) {
.replaceAll("\\W", "_") + "/" + className + "/" + methodName + "/" + deviceModel + "_" + methodName + "_failed" + ".png")); Thread.sleep(3000);
4,097
package com.appium.utils; import java.util.List; <BUG>public class TestCases {</BUG> private String testCase; List<Testmethods> testMethod;
public class TestCases {
4,098
int port = getPort(); AppiumServiceBuilder builder = new AppiumServiceBuilder().withAppiumJS(new File(prop.getProperty("APPIUM_JS_PATH"))) .withArgument(GeneralServerFlag.LOG_LEVEL, "info").withLogFile(new File( System.getProperty("user.dir") + "/target/appiumlogs/" + deviceID + "__" <BUG>+ "sampletest.txt")).withArgument(GeneralServerFlag.UIID, deviceID) .withArgument(GeneralServerFlag.TEMP_DIRECTORY,</BUG> new File(String.valueOf(classPathRoot)).getAbsolutePath() + "/target/" + "tmp_" + port).withArgument(GeneralServerFlag.SESSION_OVERRIDE).usingPort(port); ;
+ "sampletest.txt")) .withArgument(GeneralServerFlag.TEMP_DIRECTORY,
4,099
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
4,100
} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_memo); <BUG>ChinaPhoneHelper.setStatusBar(this,true); </BUG> topicId = getIntent().getLongExtra("topicId", -1); if (topicId == -1) { finish();
ChinaPhoneHelper.setStatusBar(this, true);