id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
13,401
import javax.jms.MessageListener; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; @MessageDriven(activationConfig = { <BUG>@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/test") </BUG> }) public class ReplyingMDB implements MessageListener { @Resource(lookup = "java:/JmsXA")
@ActivationConfigProperty(propertyName = "destination", propertyValue = "java:jboss/queue/test")
13,402
import java.net.URI; import java.util.Calendar; import java.util.Date; import java.util.Formatter; import java.util.List; <BUG>import javax.ws.rs.core.UriBuilder; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.util.URIUtil;</BUG> import org.suigeneris.jrcs.rcs.Version; import org.xwiki.rest.Relations;
[DELETED]
13,403
if (home != null) { space.setHome(home.getPrefixedFullName()); space.setXwikiRelativeUrl(home.getURL("view")); space.setXwikiAbsoluteUrl(home.getExternalURL("view")); } <BUG>String pagesUri = UriBuilder.fromUri(baseUri).path(PagesResource.class).build(wikiName, spaceName).toString(); </BUG> Link pagesLink = objectFactory.createLink(); pagesLink.setHref(pagesUri); pagesLink.setRel(Relations.PAGES);
String pagesUri = uri(baseUri, PagesResource.class, wikiName, spaceName);
13,404
Link pagesLink = objectFactory.createLink(); pagesLink.setHref(pagesUri); pagesLink.setRel(Relations.PAGES); space.getLinks().add(pagesLink); if (home != null) { <BUG>String homeUri = UriBuilder.fromUri(baseUri).path(PageResource.class).build(wikiName, spaceName, home.getName()) .toString();</BUG> Link homeLink = objectFactory.createLink();
String homeUri = uri(baseUri, PageResource.class, wikiName, spaceName, home.getName());
13,405
.toString();</BUG> Link homeLink = objectFactory.createLink(); homeLink.setHref(homeUri); homeLink.setRel(Relations.HOME); space.getLinks().add(homeLink); <BUG>} String searchUri = UriBuilder.fromUri(baseUri).path(SpaceSearchResource.class).build(wikiName, spaceName).toString();</BUG> Link searchLink = objectFactory.createLink(); searchLink.setHref(searchUri);
Link pagesLink = objectFactory.createLink(); pagesLink.setHref(pagesUri); pagesLink.setRel(Relations.PAGES); space.getLinks().add(pagesLink); if (home != null) { String homeUri = uri(baseUri, PageResource.class, wikiName, spaceName, home.getName()); String searchUri = uri(baseUri, SpaceSearchResource.class, wikiName, spaceName);
13,406
if (!languages.isEmpty()) { if (!doc.getDefaultLanguage().equals("")) { translations.setDefault(doc.getDefaultLanguage()); Translation translation = objectFactory.createTranslation(); translation.setLanguage(doc.getDefaultLanguage()); <BUG>String pageTranslationUri = UriBuilder.fromUri(baseUri).path(PageResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri);
uri(baseUri, PageResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
13,407
} } for (String language : languages) { Translation translation = objectFactory.createTranslation(); translation.setLanguage(language); <BUG>String pageTranslationUri = UriBuilder.fromUri(baseUri).path(PageTranslationResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), language).toString();</BUG> Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri);
uri(baseUri, PageTranslationResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), language);
13,408
Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri); pageTranslationLink.setRel(Relations.PAGE); translation.getLinks().add(pageTranslationLink); String historyUri = <BUG>UriBuilder.fromUri(baseUri).path(PageTranslationHistoryResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), language).toString(); Link historyLink = objectFactory.createLink();</BUG> historyLink.setHref(historyUri); historyLink.setRel(Relations.HISTORY);
uri(baseUri, PageTranslationHistoryResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), language); Link historyLink = objectFactory.createLink();
13,409
pageSummary.setParent(doc.getParent()); if (parent != null && !parent.isNew()) { pageSummary.setParentId(parent.getPrefixedFullName()); } else { pageSummary.setParentId(""); <BUG>} String spaceUri = UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG> Link spaceLink = objectFactory.createLink(); spaceLink.setHref(spaceUri);
String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace());
13,410
UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG> Link spaceLink = objectFactory.createLink(); spaceLink.setHref(spaceUri); spaceLink.setRel(Relations.SPACE); pageSummary.getLinks().add(spaceLink); <BUG>if (parent != null) { String parentUri = UriBuilder.fromUri(baseUri).path(PageResource.class) .build(parent.getWiki(), parent.getSpace(), parent.getName()).toString();</BUG> Link parentLink = objectFactory.createLink();
pageSummary.setParent(doc.getParent()); if (parent != null && !parent.isNew()) { pageSummary.setParentId(parent.getPrefixedFullName()); } else { pageSummary.setParentId(""); } String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace()); String parentUri = uri(baseUri, PageResource.class, parent.getWiki(), parent.getSpace(), parent.getName());
13,411
Link historyLink = objectFactory.createLink(); historyLink.setHref(historyUri); historyLink.setRel(Relations.HISTORY); pageSummary.getLinks().add(historyLink); if (!doc.getChildren().isEmpty()) { <BUG>String pageChildrenUri = UriBuilder.fromUri(baseUri).path(PageChildrenResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link pageChildrenLink = objectFactory.createLink(); pageChildrenLink.setHref(pageChildrenUri);
uri(baseUri, PageChildrenResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
13,412
objectsLink.setRel(Relations.OBJECTS); pageSummary.getLinks().add(objectsLink); } com.xpn.xwiki.api.Object tagsObject = doc.getObject("XWiki.TagClass", 0); if (tagsObject != null) { <BUG>if (tagsObject.getProperty("tags") != null) { String tagsUri = UriBuilder.fromUri(baseUri).path(PageTagsResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link tagsLink = objectFactory.createLink();
String tagsUri = uri(baseUri, PageTagsResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
13,413
tagsLink.setHref(tagsUri); tagsLink.setRel(Relations.TAGS); pageSummary.getLinks().add(tagsLink); } } <BUG>String syntaxesUri = UriBuilder.fromUri(baseUri).path(SyntaxesResource.class).build().toString(); Link syntaxesLink = objectFactory.createLink();</BUG> syntaxesLink.setHref(syntaxesUri); syntaxesLink.setRel(Relations.SYNTAXES); pageSummary.getLinks().add(syntaxesLink);
String syntaxesUri = uri(baseUri, SyntaxesResource.class); Link syntaxesLink = objectFactory.createLink();
13,414
} return historySummary; } private static void fillAttachment(Attachment attachment, ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Document doc = xwikiAttachment.getDocument(); attachment.setId(String.format("%s@%s", doc.getPrefixedFullName(), xwikiAttachment.getFilename()));
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
13,415
Calendar calendar = Calendar.getInstance(); calendar.setTime(xwikiAttachment.getDate()); attachment.setDate(calendar); attachment.setXwikiRelativeUrl(xwikiRelativeUrl); attachment.setXwikiAbsoluteUrl(xwikiAbsoluteUrl); <BUG>String pageUri = UriBuilder.fromUri(baseUri).path(PageResource.class).build(doc.getWiki(), doc.getSpace(), doc.getName()) .toString();</BUG> Link pageLink = objectFactory.createLink();
String pageUri = uri(baseUri, PageResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
13,416
} return attachmentUri; }</BUG> public static Attachment createAttachment(ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Attachment attachment = objectFactory.createAttachment(); fillAttachment(attachment, objectFactory, baseUri, xwikiAttachment, xwikiRelativeUrl, xwikiAbsoluteUrl,
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
13,417
attachmentLink.setRel(Relations.ATTACHMENT_DATA); attachment.getLinks().add(attachmentLink); return attachment; } public static Attachment createAttachmentAtVersion(ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Attachment attachment = new Attachment();
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
13,418
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> } else { <BUG>propertiesUri = UriBuilder .fromUri(baseUri) .path(ObjectPropertiesResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> }
fillObjectSummary(objectSummary, objectFactory, baseUri, doc, xwikiObject, xwikiApi, withPrettyNames); Link objectLink = getObjectLink(objectFactory, baseUri, doc, xwikiObject, useVersion, Relations.OBJECT); objectSummary.getLinks().add(objectLink); String propertiesUri; if (useVersion) { uri(baseUri, ObjectPropertiesAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()); uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
13,419
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber(), propertyClass.getName()) .toString();</BUG> } else { <BUG>propertyUri = UriBuilder .fromUri(baseUri) .path(ObjectPropertyResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber(), propertyClass.getName()).toString();</BUG> }
propertiesUri = uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
13,420
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> } else { <BUG>objectUri = UriBuilder .fromUri(baseUri) .path(ObjectResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> }
private static Link getObjectLink(ObjectFactory objectFactory, URI baseUri, Document doc, BaseObject xwikiObject, boolean useVersion, String relation) String objectUri; if (useVersion) { uri(baseUri, ObjectAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()); uri(baseUri, ObjectResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
13,421
Link propertyLink = objectFactory.createLink(); propertyLink.setHref(propertyUri); propertyLink.setRel(Relations.SELF); property.getLinks().add(propertyLink); clazz.getProperties().add(property); <BUG>} String classUri = UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG> Link classLink = objectFactory.createLink(); classLink.setHref(classUri);
String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName());
13,422
String classUri = UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG> Link classLink = objectFactory.createLink(); classLink.setHref(classUri); classLink.setRel(Relations.SELF); <BUG>clazz.getLinks().add(classLink); String propertiesUri = UriBuilder.fromUri(baseUri).path(ClassPropertiesResource.class).build(wikiName, xwikiClass.getName()) .toString();</BUG> Link propertyLink = objectFactory.createLink();
propertyLink.setHref(propertyUri); propertyLink.setRel(Relations.SELF); property.getLinks().add(propertyLink); clazz.getProperties().add(property); } String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName()); String propertiesUri = uri(baseUri, ClassPropertiesResource.class, wikiName, xwikiClass.getName());
13,423
<BUG>package org.xwiki.rest.internal; import org.apache.commons.lang3.StringUtils;</BUG> import org.xwiki.component.manager.ComponentManager; import org.xwiki.context.Execution; import org.xwiki.model.reference.EntityReferenceSerializer;
import java.net.URI; import javax.ws.rs.core.UriBuilder; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.util.URIUtil; import org.apache.commons.lang3.StringUtils;
13,424
import org.eclipse.emf.ecore.EReference; import org.eclipse.xtext.common.types.JvmFormalParameter; import org.eclipse.xtext.common.types.JvmSpecializedTypeReference; import org.eclipse.xtext.linking.lazy.LazyLinker; import org.eclipse.xtext.xbase.XAbstractFeatureCall; <BUG>import org.eclipse.xtext.xbase.XbasePackage; </BUG> import org.eclipse.xtext.xtype.XtypePackage; public class XbaseLazyLinker extends LazyLinker { @Override
import org.eclipse.xtext.xbase.XClosure;
13,425
} else if (obj instanceof JvmSpecializedTypeReference) { ((JvmSpecializedTypeReference) obj).setEquivalent(null); if (ref == XtypePackage.Literals.XFUNCTION_TYPE_REF__TYPE) { obj.eUnset(ref); } <BUG>} else if (obj instanceof JvmFormalParameter && obj.eContainingFeature() == XbasePackage.Literals.XCLOSURE__IMPLICIT_PARAMETER) { JvmFormalParameter parameter = (JvmFormalParameter) obj; parameter.setParameterType(null); </BUG> }
[DELETED]
13,426
import javax.annotation.CheckForNull; import org.sonar.api.BatchComponent; import org.sonar.api.CoreProperties; import org.sonar.api.batch.InstantiationStrategy; import org.sonar.api.config.Settings; <BUG>import org.sonar.api.utils.MessageException; @InstantiationStrategy(InstantiationStrategy.PER_BATCH)</BUG> public class GitHubPluginConfiguration implements BatchComponent { public static final int MAX_GLOBAL_ISSUES = 10; private Settings settings;
import static org.apache.commons.lang.StringUtils.isNotBlank; @InstantiationStrategy(InstantiationStrategy.PER_BATCH)
13,427
} public String repository() { if (settings.hasKey(GitHubPlugin.GITHUB_REPO)) { return repoFromProp(); } <BUG>if (settings.hasKey(CoreProperties.LINKS_SOURCES_DEV) || settings.hasKey(CoreProperties.LINKS_SOURCES)) { </BUG> return repoFromScmProps(); } throw MessageException.of("Unable to determine GitHub repository name for this project. Please provide it using property '" + GitHubPlugin.GITHUB_REPO
public int pullRequestNumber() { return settings.getInt(GitHubPlugin.GITHUB_PULL_REQUEST); if (isNotBlank(settings.getString(CoreProperties.LINKS_SOURCES_DEV)) || isNotBlank(settings.getString(CoreProperties.LINKS_SOURCES))) {
13,428
</BUG> String url = settings.getString(CoreProperties.LINKS_SOURCES_DEV); repo = extractRepoFromGitUrl(url); } <BUG>if (repo == null && settings.hasKey(CoreProperties.LINKS_SOURCES)) { </BUG> String url = settings.getString(CoreProperties.LINKS_SOURCES); repo = extractRepoFromGitUrl(url); } if (repo == null) {
throw MessageException.of("Unable to determine GitHub repository name for this project. Please provide it using property '" + GitHubPlugin.GITHUB_REPO + "' or configure property '" + CoreProperties.LINKS_SOURCES + "'."); private String repoFromScmProps() { String repo = null; if (isNotBlank(settings.getString(CoreProperties.LINKS_SOURCES_DEV))) { if (repo == null && isNotBlank(settings.getString(CoreProperties.LINKS_SOURCES))) {
13,429
import org.slf4j.LoggerFactory; import org.sonar.api.BatchComponent; import org.sonar.api.batch.InstantiationStrategy; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.InputPath; <BUG>import org.sonar.api.scan.filesystem.PathResolver; @InstantiationStrategy(InstantiationStrategy.PER_BATCH)</BUG> public class PullRequestFacade implements BatchComponent { private static final Logger LOG = LoggerFactory.getLogger(PullRequestFacade.class); @VisibleForTesting
import org.sonar.api.utils.MessageException; @InstantiationStrategy(InstantiationStrategy.PER_BATCH)
13,430
setPr(ghRepo.getPullRequest(pullRequestNumber)); LOG.info("Starting analysis of pull request: " + pr.getHtmlUrl()); myself = github.getMyself().getLogin(); loadExistingReviewComments(); patchPositionMappingByFile = mapPatchPositionsToLines(pr); <BUG>} catch (IOException e) { throw new IllegalStateException("Unable to perform GitHub WS operation", e); </BUG> } }
LOG.debug("Unable to perform GitHub WS operation", e); throw MessageException.of("Unable to perform GitHub WS operation: " + e.getMessage());
13,431
package com.commonsware.android.databind.basic; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; <BUG>import android.os.StrictMode; import de.greenrobot.event.EventBus; public class MainActivity extends Activity {</BUG> @Override
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; public class MainActivity extends Activity {
13,432
.add(android.R.id.content, new QuestionsFragment()).commit(); } } @Override <BUG>public void onResume() { super.onResume(); EventBus.getDefault().register(this);</BUG> }
[DELETED]
13,433
package com.commonsware.android.databind.basic; <BUG>import retrofit.Callback; import retrofit.http.GET; import retrofit.http.Path; import retrofit.http.Query; </BUG> public interface StackOverflowInterface {
import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query;
13,434
package com.commonsware.android.databind.basic; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; <BUG>import android.os.StrictMode; import de.greenrobot.event.EventBus; public class MainActivity extends Activity { @Override</BUG> protected void onCreate(Bundle savedInstanceState) {
public class MainActivity extends Activity implements QuestionsFragment.Contract { @Override
13,435
package com.commonsware.android.databind.basic; <BUG>import retrofit.Callback; import retrofit.http.GET; import retrofit.http.Query; </BUG> public interface StackOverflowInterface {
import retrofit2.Call; import retrofit2.Callback; import retrofit2.http.GET; import retrofit2.http.Query;
13,436
import android.os.Build; import android.support.v7.widget.RecyclerView; import android.view.MotionEvent; import android.view.View; import com.commonsware.android.databind.basic.databinding.RowBinding; <BUG>import de.greenrobot.event.EventBus; </BUG> public class QuestionController extends RecyclerView.ViewHolder implements View.OnTouchListener { private final RowBinding rowBinding;
import org.greenrobot.eventbus.EventBus;
13,437
questionMap.put(question.id, question); } setAdapter(new QuestionsAdapter(questions)); } @Override <BUG>public void failure(RetrofitError error) { onError(error); </BUG> } });
public void onFailure(Call<SOQuestions> call, Throwable t) { onError(t);
13,438
question.updateFromItem(item); } } } @Override <BUG>public void failure(RetrofitError error) { onError(error); </BUG> } });
public void onFailure(Call<SOQuestions> call, Throwable t) { onError(t);
13,439
onError(error); </BUG> } }); } <BUG>private void onError(RetrofitError error) { </BUG> Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_LONG).show(); Log.e(getClass().getSimpleName(),
question.updateFromItem(item); @Override public void onFailure(Call<SOQuestions> call, Throwable t) { onError(t); private void onError(Throwable error) {
13,440
import com.eucalyptus.bootstrap.Component; import com.eucalyptus.cluster.VmInstance; import com.eucalyptus.cluster.VmInstances; import com.eucalyptus.cluster.callback.AssignAddressCallback; import com.eucalyptus.cluster.callback.UnassignAddressCallback; <BUG>import com.eucalyptus.entities.EntityWrapper; import com.eucalyptus.util.HasName; import com.eucalyptus.util.LogUtil;</BUG> import com.eucalyptus.util.async.NOOP; import com.eucalyptus.util.async.RemoteCallback;
import com.eucalyptus.records.EventClass; import com.eucalyptus.records.EventRecord; import com.eucalyptus.records.EventType;
13,441
import com.eucalyptus.util.HasName; import com.eucalyptus.util.LogUtil;</BUG> import com.eucalyptus.util.async.NOOP; import com.eucalyptus.util.async.RemoteCallback; import edu.ucsb.eucalyptus.msgs.DescribeAddressesResponseItemType; <BUG>import com.eucalyptus.records.EventClass; import com.eucalyptus.records.EventRecord; import com.eucalyptus.records.EventType;</BUG> @Entity @PersistenceContext( name = "eucalyptus_general" )
[DELETED]
13,442
throw new NotEnoughResourcesAvailable( "Not enough resources available: addresses (try --addressing private)" ); } return addressList; } @Override <BUG>public void assignSystemAddress( VmInstance vm ) throws NotEnoughResourcesAvailable { Address addr = this.allocateSystemAddresses( vm.getPlacement( ), 1 ).get( 0 ); AddressCategory.assign( addr, vm ).dispatch( addr.getCluster( ) ); }</BUG> @Override
public void assignSystemAddress( final VmInstance vm ) throws NotEnoughResourcesAvailable { final Address addr = this.allocateSystemAddresses( vm.getPlacement( ), 1 ).get( 0 ); Callbacks.newClusterRequest( addr.assign( vm ).getCallback( ) ).then( new Callback.Success<BaseMessage>() { public void fire( BaseMessage response ) { vm.updatePublicAddress( addr.getName( ) ); }).dispatch( addr.getCluster( ) );
13,443
if ( address.isSystemOwned( ) ) { EventRecord.caller( SystemState.class, EventType.VM_TERMINATING, "SYSTEM_ADDRESS", address.toString( ) ).debug( ); Addresses.release( address ); } else { EventRecord.caller( SystemState.class, EventType.VM_TERMINATING, "USER_ADDRESS", address.toString( ) ).debug( ); <BUG>AddressCategory.unassign( address ).dispatch( address.getCluster( ) ); }</BUG> } catch ( IllegalStateException e ) {} catch ( Throwable e ) { LOG.debug( e, e ); }
Callbacks.newClusterRequest( address.unassign( ).getCallback( ) ).dispatch( address.getCluster( ) );
13,444
package com.eucalyptus.address; import org.apache.log4j.Logger; import com.eucalyptus.cluster.VmInstance; import com.eucalyptus.cluster.VmInstances; import com.eucalyptus.util.EucalyptusCloudException; <BUG>import com.eucalyptus.util.NotEnoughResourcesAvailable; import com.eucalyptus.util.async.Callbacks;</BUG> import com.eucalyptus.util.async.UnconditionalCallback; import edu.ucsb.eucalyptus.msgs.AllocateAddressResponseType; import edu.ucsb.eucalyptus.msgs.AllocateAddressType;
import com.eucalyptus.util.async.Callback; import com.eucalyptus.util.async.Callbacks;
13,445
final Address oldAddr = findVmExistingAddress( vm ); final boolean oldAddrSystem = oldAddr != null ? oldAddr.isSystemOwned( ) : false; reply.set_return( true ); final UnconditionalCallback assignTarget = new UnconditionalCallback( ) { public void fire( ) { <BUG>AddressCategory.assign( address, vm ).dispatch( address.getCluster( ) ); if ( oldVm != null ) {</BUG> Addresses.system( oldVm ); } }
Callbacks.newClusterRequest( address.assign( vm ).getCallback( ) ).then( new Callback.Success<BaseMessage>() { public void fire( BaseMessage response ) { vm.updatePublicAddress( address.getName( ) ); }).dispatch( address.getCluster( ) ); if ( oldVm != null ) {
13,446
} }; final UnconditionalCallback unassignBystander = new UnconditionalCallback( ) { public void fire( ) { if ( oldAddr != null ) { <BUG>AddressCategory.unassign( oldAddr ).then( assignTarget ).dispatch( oldAddr.getCluster( ) ); } else {</BUG> assignTarget.fire( ); } }
}).dispatch( address.getCluster( ) ); if ( oldVm != null ) { Addresses.system( oldVm );
13,447
assignTarget.fire( ); } } }; if ( address.isAssigned( ) ) { <BUG>Callbacks.newClusterRequest( address.unassign( ).getCallback( ) ).then( unassignBystander ).dispatch( oldAddr.getCluster( ) ); </BUG> } else { unassignBystander.fire( ); }
Callbacks.newClusterRequest( address.unassign( ).getCallback( ) ).then( unassignBystander ).dispatch( address.getCluster( ) );
13,448
if ( address.isSystemOwned( ) && !request.isAdministrator( ) ) { throw new EucalyptusCloudException( "Only administrators can unassign system owned addresses: " + address.toString( ) ); } else { try { if ( address.isSystemOwned( ) ) { <BUG>AddressCategory.unassign( address ).then( new UnconditionalCallback( ) { public void fire( ) {</BUG> try { Addresses.system( VmInstances.getInstance( ).lookup( vmId ) ); } catch ( Exception e ) {
Callbacks.newClusterRequest( address.unassign( ).getCallback( ) ).then( new UnconditionalCallback( ) { public void fire( ) {
13,449
LOG.debug( e, e ); } } } ).dispatch( address.getCluster( ) ); } else { <BUG>AddressCategory.unassign( address ).then( new UnconditionalCallback( ) { @Override</BUG> public void fire( ) { try { Addresses.system( VmInstances.getInstance( ).lookup( vmId ) );
Callbacks.newClusterRequest( address.unassign( ).getCallback( ) ).then( new UnconditionalCallback( ) { @Override
13,450
throw new NotEnoughResourcesAvailable( "Not enough resources available: addresses (try --addressing private)" ); } return addressList; } @Override <BUG>public void assignSystemAddress( VmInstance vm ) throws NotEnoughResourcesAvailable { Address addr = this.getNext( ); AddressCategory.assign( addr, vm ).dispatch( addr.getCluster( ) ); }</BUG> private Address getNext() throws NotEnoughResourcesAvailable {
public void assignSystemAddress( final VmInstance vm ) throws NotEnoughResourcesAvailable { final Address addr = this.allocateSystemAddresses( vm.getPlacement( ), 1 ).get( 0 ); Callbacks.newClusterRequest( addr.assign( vm ).getCallback( ) ).then( new Callback.Success<BaseMessage>() { public void fire( BaseMessage response ) { vm.updatePublicAddress( addr.getName( ) ); }).dispatch( addr.getCluster( ) );
13,451
if ( !addr.isAllocated( ) && !addr.isPending( ) ) { try { if ( !addr.isAssigned( ) && !addr.isPending( ) ) { addr.pendingAssignment( ); try { <BUG>addr.assign( vm.getInstanceId( ), vm.getPrivateAddress( ) ).clearPending( ); } catch ( Throwable e1 ) {</BUG> LOG.debug( e1, e1 ); } }
addr.assign( vm ).clearPending( ); } catch ( Throwable e1 ) {
13,452
} catch ( Throwable e1 ) { LOG.debug( e1, e1 ); } } else if ( !addr.isAssigned( ) ) { try { <BUG>addr.assign( vm.getInstanceId( ), vm.getPrivateAddress( ) ).clearPending( ); } catch ( Throwable e1 ) {</BUG> LOG.debug( e1, e1 ); } } else {
addr.assign( vm ).clearPending( );
13,453
pu.setPersistenceXMLSchemaVersion("2.0"); } final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); <BUG>if (reader.getAttributeNamespace(i) != null) { continue;</BUG> } final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) {
final String attributeNamespace = reader.getAttributeNamespace(i); if (attributeNamespace != null && !attributeNamespace.isEmpty()) { continue;
13,454
case PROPERTY: final int count = reader.getAttributeCount(); String name = null, value = null; for (int i = 0; i < count; i++) { final String attributeValue = reader.getAttributeValue(i); <BUG>if (reader.getAttributeNamespace(i) != null) { continue;</BUG> } final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) {
final String attributeNamespace = reader.getAttributeNamespace(i); if (attributeNamespace != null && !attributeNamespace.isEmpty()) { continue;
13,455
{ HashMap<String, Object> params = new HashMap(); String currentContext = getCurrentContextHandle( driver ); try { <BUG>switchToContext(driver, "NATIVE_APP"); params.put("property", "osVersion");</BUG> String osVerStr = (String) driver.executeScript("mobile:handset:info", params); int[] osVer = parseVersion( osVerStr ); params.clear();
public static void clearSafariIOSCache( RemoteWebDriver driver ) throws Exception params.put("property", "osVersion");
13,456
params.put("value", "//*[(@class='UIAButton' or @class='UIATableCell') and starts-with(@label,'Clear') and @isvisible='true']"); params.put("framework", "perfectoMobile"); driver.executeScript("mobile:application.element:click", params); } params.clear(); <BUG>params.put("name", "Settings"); driver.executeScript("mobile:application:close", params); </BUG> } finally
try { } catch (Exception e) {} params.put("automation", "simulated"); driver.executeScript("mobile:browser:open", params);
13,457
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;
13,458
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;
13,459
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"),
13,460
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]
13,461
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) {
13,462
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;
13,463
public boolean isDumbAware() { return true; } @Override public boolean isApplicable(AnActionEvent event, final Map<String, Object> _params) { <BUG>return SNodeOperations.isInstanceOf(((SNode) MapSequence.fromMap(_params).get("selectedNode")), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca66L, "jetbrains.mps.baseLanguage.structure.ClassConcept")) && ListSequence.fromList(((List<SNode>) BHReflection.invoke(SNodeOperations.cast(((SNode) MapSequence.fromMap(_params).get("selectedNode")), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca66L, "jetbrains.mps.baseLanguage.structure.ClassConcept")), SMethodTrimmedId.create("getMethodsToOverride", null, "4GM03FJm3zL")))).isNotEmpty(); </BUG> } @Override public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
return SNodeOperations.isInstanceOf(event.getData(MPSCommonDataKeys.NODE), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca66L, "jetbrains.mps.baseLanguage.structure.ClassConcept")) && ListSequence.fromList(((List<SNode>) BHReflection.invoke(SNodeOperations.cast(event.getData(MPSCommonDataKeys.NODE), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca66L, "jetbrains.mps.baseLanguage.structure.ClassConcept")), SMethodTrimmedId.create("getMethodsToOverride", null, "4GM03FJm3zL")))).isNotEmpty();
13,464
} } return true; } @Override <BUG>public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) { final Project project = ((IOperationContext) MapSequence.fromMap(_params).get("operationContext")).getProject(); new OverrideImplementMethodAction(project, ((SNode) MapSequence.fromMap(_params).get("selectedNode")), ((EditorContext) MapSequence.fromMap(_params).get("editorContext")), true).run();</BUG> } }
public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) { this.setEnabledState(event.getPresentation(), this.isApplicable(event, _params));
13,465
import jetbrains.mps.smodel.behaviour.BHReflection; import jetbrains.mps.core.aspects.behaviour.SMethodTrimmedId; import org.jetbrains.annotations.NotNull; import jetbrains.mps.ide.actions.MPSCommonDataKeys; import jetbrains.mps.ide.editor.MPSEditorDataKeys; <BUG>import jetbrains.mps.smodel.IOperationContext; import jetbrains.mps.project.Project; import jetbrains.mps.smodel.ModelAccess; </BUG> import jetbrains.mps.util.Computable;
import jetbrains.mps.project.MPSProject; import jetbrains.mps.smodel.ModelAccessHelper;
13,466
import jetbrains.mps.smodel.behaviour.BHReflection; import jetbrains.mps.core.aspects.behaviour.SMethodTrimmedId; import org.jetbrains.annotations.NotNull; import jetbrains.mps.ide.actions.MPSCommonDataKeys; import jetbrains.mps.ide.editor.MPSEditorDataKeys; <BUG>import jetbrains.mps.smodel.IOperationContext; import jetbrains.mps.project.Project; import jetbrains.mps.smodel.ModelAccess; </BUG> import jetbrains.mps.util.Computable;
import jetbrains.mps.project.MPSProject; import jetbrains.mps.smodel.ModelAccessHelper;
13,467
import jetbrains.mps.smodel.behaviour.BHReflection; import jetbrains.mps.core.aspects.behaviour.SMethodTrimmedId; import org.jetbrains.annotations.NotNull; import jetbrains.mps.ide.actions.MPSCommonDataKeys; import jetbrains.mps.ide.editor.MPSEditorDataKeys; <BUG>import jetbrains.mps.smodel.IOperationContext; import jetbrains.mps.project.Project; import jetbrains.mps.smodel.ModelAccess; </BUG> import jetbrains.mps.util.Computable;
import jetbrains.mps.project.MPSProject; import jetbrains.mps.smodel.ModelAccessHelper;
13,468
public ReportElement getBase() { return base; } @Override public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException { <BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false); </BUG> base.print(document, pageStream, pageNo, x, y, width); pageStream.close();
PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
13,469
public PdfTextStyle(String config) { Assert.hasText(config); String[] split = config.split(","); Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000"); fontSize = Integer.parseInt(split[0]); <BUG>font = resolveStandard14Name(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG> } public int getFontSize() { return fontSize;
font = getFont(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));
13,470
package cc.catalysts.boot.report.pdf.elements; import cc.catalysts.boot.report.pdf.config.PdfTextStyle; import cc.catalysts.boot.report.pdf.utils.ReportAlignType; import org.apache.pdfbox.pdmodel.PDPageContentStream; <BUG>import org.apache.pdfbox.pdmodel.font.PDFont; import org.slf4j.Logger;</BUG> import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import java.io.IOException;
import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.util.Matrix; import org.slf4j.Logger;
13,471
addTextSimple(stream, textConfig, textX, nextLineY, ""); return nextLineY; } try { <BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText); </BUG> float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]); if (!underline) { addTextSimple(stream, textConfig, x, nextLineY, split[0]); } else {
String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
13,472
public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { try { stream.setFont(textConfig.getFont(), textConfig.getFontSize()); stream.setNonStrokingColor(textConfig.getColor()); stream.beginText(); <BUG>stream.newLineAtOffset(textX, textY); stream.showText(text);</BUG> } catch (Exception e) { LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage()); }
stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY)); stream.showText(text);
13,473
public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { addTextSimple(stream, textConfig, textX, textY, text); try { float lineOffset = textConfig.getFontSize() / 8F; stream.setStrokingColor(textConfig.getColor()); <BUG>stream.setLineWidth(0.5F); stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset); </BUG> stream.stroke(); } catch (IOException e) {
stream.moveTo(textX, textY - lineOffset); stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
13,474
list.add(text.length()); return list; } public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) { String endPart = ""; <BUG>String shortenedText = text; List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {</BUG> String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0)); StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {
13,475
package cc.catalysts.boot.report.pdf.elements; import org.apache.pdfbox.pdmodel.PDDocument; <BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import java.io.IOException;</BUG> import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList;
import org.apache.pdfbox.pdmodel.PDPageContentStream; import java.io.IOException;
13,476
import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; <BUG>import javax.swing.SwingUtilities; import org.sleuthkit.autopsy.coreutils.FileUtil;</BUG> import org.sleuthkit.autopsy.coreutils.Logger; public class ReportPanel extends javax.swing.JPanel { private ReportPanelAction rpa;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.FileUtil;
13,477
private void initComponents() { reportScrollPane = new javax.swing.JScrollPane(); reportSummaryPanel = new javax.swing.JPanel(); closeButton = new javax.swing.JButton(); exportButton = new javax.swing.JButton(); <BUG>statusLabel = new javax.swing.JLabel(); reportScrollPane.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.reportScrollPane.border.title"))); // NOI18N</BUG> javax.swing.GroupLayout reportSummaryPanelLayout = new javax.swing.GroupLayout(reportSummaryPanel); reportSummaryPanel.setLayout(reportSummaryPanelLayout); reportSummaryPanelLayout.setHorizontalGroup(
LABEL_LOC = new javax.swing.JLabel(); reportScrollPane.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.reportScrollPane.border.title"))); // NOI18N
13,478
exportButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exportButtonActionPerformed(evt); } }); <BUG>org.openide.awt.Mnemonics.setLocalizedText(statusLabel, org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.statusLabel.text")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);</BUG> this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
org.openide.awt.Mnemonics.setLocalizedText(LABEL_LOC, org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.LABEL_LOC.text")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
13,479
.addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(reportScrollPane) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() <BUG>.addGap(0, 493, Short.MAX_VALUE) .addComponent(exportButton)</BUG> .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(closeButton)) .addComponent(statusLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(LABEL_LOC) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(exportButton)
13,480
public void setCloseButtonActionListener(ActionListener e) { closeButton.addActionListener(e); } public void setFinishedReportText() { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); <BUG>String reportText = "These reports were generated on " + dateFormat.format(new Date()) + "."; statusLabel.setText(reportText); final JPanel tempPanel = new JPanel(new GridBagLayout());</BUG> SwingUtilities.invokeLater(new Runnable() { GridBagConstraints c = new GridBagConstraints();
String loc = "Reports extracted to: " + Case.getCurrentCase().getCaseDirectory() + File.separator + "Reports"; LABEL_LOC.setText(loc); final JPanel tempPanel = new JPanel(new GridBagLayout());
13,481
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; <BUG>import java.util.Optional; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
13,482
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
13,483
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
13,484
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
13,485
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
13,486
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
13,487
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
13,488
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
} public static Cause getCause() { return instance().pluginCause; }
13,489
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
13,490
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
13,491
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
13,492
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
13,493
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
13,494
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
13,495
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
13,496
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\"");
13,497
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
public enum Type { REGION, WREGION, HANDLER
13,498
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "worldregion", "handler", "controller")
13,499
import co.cask.cdap.templates.etl.batch.sinks.KVTableSink; import co.cask.cdap.templates.etl.batch.sources.KVTableSource; import co.cask.cdap.templates.etl.common.Constants; import co.cask.cdap.templates.etl.common.DefaultStageConfigurer; import co.cask.cdap.templates.etl.common.config.ETLStage; <BUG>import co.cask.cdap.templates.etl.transforms.IdentityTransform; import com.google.common.base.Preconditions;</BUG> import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gson.Gson;
import co.cask.cdap.templates.etl.transforms.StructuredRecordToGenericRecordTransform; import com.google.common.base.Preconditions;
13,500
private final Map<String, String> transformClassMap; public ETLBatchTemplate() throws Exception { sourceClassMap = Maps.newHashMap(); sinkClassMap = Maps.newHashMap(); transformClassMap = Maps.newHashMap(); <BUG>initTable(Lists.<Class>newArrayList(KVTableSource.class, KVTableSink.class, IdentityTransform.class)); }</BUG> private void initTable(List<Class> classList) throws Exception { for (Class klass : classList) {
initTable(Lists.<Class>newArrayList(KVTableSource.class, KVTableSink.class, IdentityTransform.class, StructuredRecordToGenericRecordTransform.class)); }