id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
17,901
List<Block> blocks = new ArrayList<>(strData.size()); for (String rlp : strData) { blocks.add(new Block(decode(rlp))); } return blocks; <BUG>} @AfterClass public static void cleanup() { SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);</BUG> }
[DELETED]
17,902
import org.ethereum.net.eth.handler.EthHandler; import org.ethereum.net.eth.message.*; import org.ethereum.net.message.Message; import org.ethereum.net.p2p.DisconnectMessage; import org.ethereum.net.rlpx.Node; <BUG>import org.ethereum.net.server.Channel; import org.junit.*;</BUG> import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope;
import org.ethereum.util.blockchain.StandaloneBlockchain; import org.junit.*;
17,903
import org.ethereum.config.blockchain.FrontierConfig; import org.ethereum.core.*; import org.ethereum.core.genesis.GenesisLoader; import org.ethereum.crypto.ECKey; import org.ethereum.db.PruneManager; <BUG>import org.ethereum.util.ByteUtil; import org.junit.AfterClass;</BUG> import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass;
import org.ethereum.util.blockchain.StandaloneBlockchain; import org.junit.AfterClass;
17,904
@InjectMocks @Resource BlockchainImpl blockchain = ImportLightTest.createBlockchain(GenesisLoader.loadGenesis( getClass().getResourceAsStream("/genesis/genesis-light.json"))); @BeforeClass <BUG>public static void setup() { SystemProperties.getDefault().setBlockchainConfig(new FrontierConfig(new FrontierConfig.FrontierConstants() { @Override public BigInteger getMINIMUM_DIFFICULTY() { return BigInteger.ONE; } }));</BUG> }
SystemProperties.getDefault().setBlockchainConfig(StandaloneBlockchain.getEasyMiningConfig());
17,905
package org.ethereum.samples; <BUG>import org.ethereum.config.SystemProperties; import org.ethereum.config.blockchain.FrontierConfig;</BUG> import org.ethereum.util.blockchain.SolidityContract; import org.ethereum.util.blockchain.StandaloneBlockchain; import java.math.BigInteger;
[DELETED]
17,906
" function clear() {" + " result = 0;" + " }" + "}"; public static void main(String[] args) throws Exception { <BUG>SystemProperties.getDefault().setBlockchainConfig(new FrontierConfig(new FrontierConfig.FrontierConstants() { @Override public BigInteger getMINIMUM_DIFFICULTY() { return BigInteger.ONE; } }));</BUG> StandaloneBlockchain bc = new StandaloneBlockchain().withAutoblock(true);
[DELETED]
17,907
public static final String ADAL_ID_PLATFORM = "x-client-SKU"; public static final String ADAL_ID_VERSION = "x-client-Ver"; public static final String ADAL_ID_CPU = "x-client-CPU"; public static final String ADAL_ID_OS_VER = "x-client-OS"; public static final String ADAL_ID_DM = "x-client-DM"; <BUG>public static final String ADAL_ID_PLATFORM_VALUE = "Android"; }</BUG> public static final class Broker { public static final int BROKER_REQUEST_ID = 1177; public static final String BROKER_REQUEST = "com.microsoft.aadbroker.adal.broker.request";
public static final String REQUEST_ID_HEADER = "x-ms-request-id"; }
17,908
Telemetry.getInstance().stopEvent(mAuthRequest.getTelemetryRequestId(), mUIEvent, EventStrings.UI_EVENT); } } class CustomWebViewClient extends BasicWebViewClient { public CustomWebViewClient() { <BUG>super(AuthenticationActivity.this, mRedirectUrl, mQueryParameters, mAuthRequest); </BUG> } public void processRedirectUrl(final WebView view, String url) { if (!isBrokerRequest(getIntent())) {
super(AuthenticationActivity.this, mRedirectUrl, mQueryParameters, mAuthRequest, mUIEvent);
17,909
private static final String TAG = "BasicWebViewClient"; public static final String BLANK_PAGE = "about:blank"; private final String mRedirect; private final AuthenticationRequest mRequest; private final String mQueryParam; <BUG>private final Context mCallingContext; public BasicWebViewClient(final Context appContext, final String redirect, final String queryParam, final AuthenticationRequest request) { </BUG> mCallingContext = appContext;
private final UIEvent mUIEvent; final String queryParam, final AuthenticationRequest request, UIEvent uiEvent) {
17,910
public abstract void setPKeyAuthStatus(boolean status); public abstract void postRunnable(Runnable item); @Override public void onReceivedHttpAuthRequest(WebView view, final HttpAuthHandler handler, String host, String realm) { <BUG>Logger.i(TAG, "onReceivedHttpAuthRequest for host:" + host, ""); HttpAuthDialog authDialog = new HttpAuthDialog(mCallingContext, host, realm);</BUG> authDialog.setOkListener(new HttpAuthDialog.OkListener() { public void onOk(String host, String realm, String username, String password) { Logger.i(TAG, "onReceivedHttpAuthRequest: handler proceed" + host, "");
if (mUIEvent != null) { mUIEvent.setNTLM(true); } HttpAuthDialog authDialog = new HttpAuthDialog(mCallingContext, host, realm);
17,911
private boolean mValidateAuthority; private boolean mIsAuthorityValidated; private ITokenCacheStore mTokenCacheStore; private IBrokerProxy mBrokerProxy = null; private boolean mExtendedLifetimeEnabled = false; <BUG>private static final SparseArray<AuthenticationRequestState> mDelegateMap = new SparseArray<>(); </BUG> private UUID mRequestCorrelationId = null; public AuthenticationContext(Context appContext, String authority, boolean validateAuthority) { PRNGFixes.apply();
private static final SparseArray<AuthenticationRequestState> DELEGATE_MAP = new SparseArray<>();
17,912
authenticationResult.set(result); latch.countDown(); } @Override public void onError(Exception exc) { <BUG>apiEvent.setWasApiCallSuccessful(false); </BUG> apiEvent.setCorrelationId(request.getCorrelationId().toString()); apiEvent.stopTelemetryAndFlush(); exception.set(exc);
apiEvent.setWasApiCallSuccessful(false, exc);
17,913
final SettableFuture<AuthenticationResult> futureTask = new SettableFuture<AuthenticationResult>(); createAcquireTokenRequest(apiEvent).acquireToken(null, false, request, new AuthenticationCallback<AuthenticationResult>() { @Override public void onSuccess(AuthenticationResult result) { <BUG>apiEvent.setWasApiCallSuccessful(true); </BUG> apiEvent.setCorrelationId(request.getCorrelationId().toString()); apiEvent.setIdToken(result.getIdToken()); apiEvent.stopTelemetryAndFlush();
apiEvent.setWasApiCallSuccessful(true, null);
17,914
if (callback != null) { callback.onSuccess(result); } futureTask.set(result); } <BUG>@Override public void onError(Exception exc) { apiEvent.setWasApiCallSuccessful(false); </BUG> apiEvent.setCorrelationId(request.getCorrelationId().toString());
@SuppressWarnings("unchecked") apiEvent.setWasApiCallSuccessful(false, exc);
17,915
return; } AuthenticationRequestState waitingRequest; final Bundle extras = data.getExtras(); final int requestId = extras.getInt(AuthenticationConstants.Browser.REQUEST_ID); <BUG>synchronized (mDelegateMap) { waitingRequest = mDelegateMap.get(requestId); </BUG> } if (waitingRequest != null) {
synchronized (DELEGATE_MAP) { waitingRequest = DELEGATE_MAP.get(requestId);
17,916
return mIsAuthorityValidated; } AuthenticationRequestState getWaitingRequest(final int requestId) throws AuthenticationException { Logger.v(TAG, "Get waiting request: " + requestId); AuthenticationRequestState request; <BUG>synchronized (mDelegateMap) { request = mDelegateMap.get(requestId); }</BUG> if (request == null) { Logger.e(TAG, "Request callback is not available for requestId:" + requestId,
synchronized (DELEGATE_MAP) { request = DELEGATE_MAP.get(requestId);
17,917
if (requestState == null) { return; } Logger.v(TAG, "Put waiting request: " + requestId + getCorrelationInfoFromWaitingRequest(requestState)); <BUG>synchronized (mDelegateMap) { mDelegateMap.put(requestId, requestState); </BUG> } }
synchronized (DELEGATE_MAP) { DELEGATE_MAP.put(requestId, requestState);
17,918
Logger.v(TAG, "Running task in thread:" + android.os.Process.myTid()); try { validateAcquireTokenRequest(authRequest); performAcquireTokenRequest(callbackHandle, activity, useDialog, authRequest); } catch (final AuthenticationException authenticationException) { <BUG>mAPIEvent.setWasApiCallSuccessful(false); </BUG> mAPIEvent.setCorrelationId(authRequest.getCorrelationId().toString()); mAPIEvent.stopTelemetryAndFlush(); callbackHandle.onError(authenticationException);
mAPIEvent.setWasApiCallSuccessful(false, authenticationException);
17,919
</BUG> mAPIEvent.setIdToken(authResult.getIdToken()); callbackHandle.onSuccess(authResult); } catch (final AuthenticationException authenticationException) { <BUG>mAPIEvent.setWasApiCallSuccessful(false); </BUG> callbackHandle.onError(authenticationException); } finally { mAPIEvent.setCorrelationId(authenticationRequest.getCorrelationId().toString()); mAPIEvent.stopTelemetryAndFlush();
validateAcquireTokenRequest(authenticationRequest); final AcquireTokenSilentHandler acquireTokenSilentHandler = new AcquireTokenSilentHandler(mContext, authenticationRequest, mTokenCacheAccessor); final AuthenticationResult authResult = acquireTokenSilentHandler.acquireTokenWithRefreshToken(refreshToken); mAPIEvent.setWasApiCallSuccessful(true, null); mAPIEvent.setWasApiCallSuccessful(false, authenticationException);
17,920
final boolean useDialog, final AuthenticationRequest authenticationRequest) throws AuthenticationException { final AuthenticationResult authenticationResultFromSilentRequest = tryAcquireTokenSilent(authenticationRequest); if (isAccessTokenReturned(authenticationResultFromSilentRequest)) { <BUG>mAPIEvent.setWasApiCallSuccessful(true); </BUG> mAPIEvent.setCorrelationId(authenticationRequest.getCorrelationId().toString()); mAPIEvent.setIdToken(authenticationResultFromSilentRequest.getIdToken()); mAPIEvent.stopTelemetryAndFlush();
mAPIEvent.setWasApiCallSuccessful(true, null);
17,921
final int requestId, final AuthenticationException exc) { try { if (waitingRequest != null && waitingRequest.getDelegate() != null) { Logger.v(TAG, "Sending error to callback" + mAuthContext.getCorrelationInfoFromWaitingRequest(waitingRequest)); <BUG>waitingRequest.getAPIEvent().setWasApiCallSuccessful(false); </BUG> waitingRequest.getAPIEvent().setCorrelationId( waitingRequest.getRequest().getCorrelationId().toString()); waitingRequest.getAPIEvent().stopTelemetryAndFlush();
waitingRequest.getAPIEvent().setWasApiCallSuccessful(false, exc);
17,922
final HttpEvent httpEvent = startHttpEvent(); final URL authority = StringExtensions.getUrl(getTokenEndpoint()); if (authority == null) { stopHttpEvent(httpEvent); throw new AuthenticationException(ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_URL); <BUG>} try {</BUG> mWebRequestHandler.setRequestCorrelationId(mRequest.getCorrelationId()); ClientMetrics.INSTANCE.beginClientMetricsRecord(authority, mRequest.getCorrelationId(), headers);
httpEvent.setHttpPath(authority); try {
17,923
.get(AuthenticationConstants.Broker.CHALLENGE_REQUEST_HEADER).get(0); Logger.v(TAG, "Device certificate challenge request:" + challengeHeader); if (!StringExtensions.isNullOrBlank(challengeHeader)) { if (StringExtensions.hasPrefixInHeader(challengeHeader, AuthenticationConstants.Broker.CHALLENGE_RESPONSE_TYPE)) { <BUG>final HttpEvent challengeHttpEvent = startHttpEvent(); Logger.v(TAG, "Received pkeyAuth device challenge.");</BUG> ChallengeResponseBuilder certHandler = new ChallengeResponseBuilder( mJWSBuilder); Logger.v(TAG, "Processing device challenge");
challengeHttpEvent.setHttpPath(authority); Logger.v(TAG, "Received pkeyAuth device challenge.");
17,924
switch (statusCode) { case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_BAD_REQUEST: case HttpURLConnection.HTTP_UNAUTHORIZED: try { <BUG>result = parseJsonResponse(webResponse.getBody()); </BUG> } catch (final JSONException jsonException) { throw new AuthenticationException(ADALError.SERVER_INVALID_JSON_RESPONSE, "Can't parse server response " + webResponse.getBody(), jsonException); }
result = parseJsonResponse(webResponse.getBody(), httpEvent);
17,925
package org.trimou.engine.config; import java.util.Collections; import java.util.Set; public interface ConfigurationAware { <BUG>public void init(Configuration configuration); default Set<ConfigurationKey> getConfigurationKeys() {</BUG> return Collections.emptySet(); }
default void init(Configuration configuration) {
17,926
Checker.checkArgumentNotNull(localeSupport); checkNotBuilt(); this.localeSupport = localeSupport; return this; } <BUG>public MustacheEngineBuilder registerCallback(EngineBuiltCallback callback) { Checker.checkArgumentNotNull(callback);</BUG> checkNotBuilt(); this.engineReadyCallbacks.add(callback); return this;
public MustacheEngineBuilder registerCallback( Checker.checkArgumentNotNull(callback);
17,927
return registerHelper(name, helper, false); } public MustacheEngineBuilder registerHelper(String name, Helper helper, boolean overwrite) { Checker.checkArgumentsNotNull(name, helper); <BUG>checkNotBuilt(); registerBuiltinHelpersIfNecessary(); Object prev = this.helpers.put(name, helper); if (!overwrite && prev != null) {</BUG> throw new IllegalArgumentException(
if (!overwrite && helpers.containsKey(name)) {
17,928
Checker.checkArgumentNotNull(executorService); checkNotBuilt(); this.executorService = executorService; return this; } <BUG>public MustacheEngineBuilder setLiteralSupport(LiteralSupport literalSupport) { Checker.checkArgumentNotNull(literalSupport);</BUG> checkNotBuilt(); this.literalSupport = literalSupport; return this;
public MustacheEngineBuilder setLiteralSupport( Checker.checkArgumentNotNull(literalSupport);
17,929
import org.trimou.engine.interpolation.ThrowingExceptionMissingValueHandler; import org.trimou.engine.listener.MustacheListener; import org.trimou.engine.locale.DefaultLocaleSupport; import org.trimou.engine.locale.LocaleSupport; import org.trimou.engine.locator.TemplateLocator; <BUG>import org.trimou.engine.priority.HighPriorityComparator; </BUG> import org.trimou.engine.resolver.Resolver; import org.trimou.engine.text.DefaultTextSupport; import org.trimou.engine.text.TextSupport;
import org.trimou.engine.priority.Priorities;
17,930
: Collections.<ConfigurationAware> emptySet()); components.addAll(mustacheListeners); components.addAll(helpers.values()); components.add(literalSupport); this.properties = initializeProperties(builder, <BUG>getConfigurationKeysToProcess(components)); if (getBooleanPropertyValue(EngineConfigurationKey.NO_VALUE_INDICATES_PROBLEM)) { LOGGER.warn(</BUG> "{}.{} is deprecated, use appropriate MissingValueHandler instance instead", EngineConfigurationKey.class.getSimpleName(),
if (getBooleanPropertyValue( LOGGER.warn(
17,931
EngineConfigurationKey.class.getSimpleName(), EngineConfigurationKey.NO_VALUE_INDICATES_PROBLEM); this.missingValueHandler = new ThrowingExceptionMissingValueHandler(); } else { this.missingValueHandler = missingValueHandler; <BUG>} if (!getBooleanPropertyValue(EngineConfigurationKey.HANDLEBARS_SUPPORT_ENABLED)) { this.helpers = Collections.emptyMap();</BUG> } else { this.helpers = helpers;
if (!getBooleanPropertyValue( this.helpers = Collections.emptyMap();
17,932
private List<Resolver> initResolvers(MustacheEngineBuilder builder) { Set<Resolver> builderResolvers = builder.buildResolvers(); List<Resolver> resolvers = new ArrayList<Resolver>(); if (!builderResolvers.isEmpty()) { resolvers.addAll(builderResolvers); <BUG>Collections.sort(resolvers, new HighPriorityComparator()); }</BUG> return resolvers; } private Map<String, Object> initializeProperties(
Collections.sort(resolvers, Priorities.higherFirst());
17,933
return builder.getKeySplitter() != null ? builder.getKeySplitter() : new DotKeySplitter(); } private MissingValueHandler initMissingValueHandler( MustacheEngineBuilder builder) { <BUG>return builder.getMissingValueHandler() != null ? builder .getMissingValueHandler() : new NoOpMissingValueHandler(); }</BUG> private List<TemplateLocator> initTemplateLocators( MustacheEngineBuilder builder) {
return builder.getMissingValueHandler() != null ? builder.getMissingValueHandler()
17,934
Set<TemplateLocator> builderTemplateLocators = builder .buildTemplateLocators(); if (!builderTemplateLocators.isEmpty()) { List<TemplateLocator> locators = new ArrayList<TemplateLocator>( builder.buildTemplateLocators()); <BUG>Collections.sort(locators, new HighPriorityComparator()); return ImmutableList.copyOf(locators);</BUG> } else { return null; }
Collections.sort(locators, Priorities.higherFirst()); return ImmutableList.copyOf(locators);
17,935
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
17,936
} @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);
17,937
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);
17,938
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(
17,939
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 {
17,940
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;
17,941
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) {
17,942
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;
17,943
public void testPlistConstructor() { URL entityUrl = null; try { entityUrl = new java.net.URL(model.pathURL()+"/Company.plist"); } catch (java.net.MalformedURLException e) { throw new IllegalArgumentException(e.getMessage()); } <BUG>NSDictionary plist = NSPropertyListSerialization.dictionaryWithPathURL(entityUrl); </BUG> Assert.assertNotNull(new ERXEntity(plist, model)); } public void testAnyAttributeNamed() {
NSDictionary plist = (NSDictionary)NSPropertyListSerialization.propertyListWithPathURL(entityUrl);
17,944
public void testHasExternalName() { URL entityUrl = null; try { entityUrl = new java.net.URL(model.pathURL()+"/Company.plist"); } catch (java.net.MalformedURLException e) { throw new IllegalArgumentException(e.getMessage()); } <BUG>NSDictionary plist = NSPropertyListSerialization.dictionaryWithPathURL(entityUrl); </BUG> ERXEntity erxentity = new ERXEntity(plist, model); Assert.assertTrue(erxentity.hasExternalName()); }
NSDictionary plist = (NSDictionary)NSPropertyListSerialization.propertyListWithPathURL(entityUrl);
17,945
Assert.assertNotNull(desc); URL entityUrl = null; try { entityUrl = new java.net.URL(model.pathURL()+"/Employee.plist"); } catch (java.net.MalformedURLException e) { throw new IllegalArgumentException(e.getMessage()); } <BUG>NSDictionary plist = NSPropertyListSerialization.dictionaryWithPathURL(entityUrl); </BUG> ERXEntity entity2 = new ERXEntity(plist, model); entity2.setClassDescription(desc); Assert.assertTrue(ERExtensionsTest.equalsForEOAccessObjects(desc, entity2.classDescriptionForInstances()));
NSDictionary plist = (NSDictionary)NSPropertyListSerialization.propertyListWithPathURL(entityUrl);
17,946
NSTimeZone tz = null; NSTimestamp ts1, ts2; NSTimestampFormatter formatter = null; StringBuffer dt = null; java.text.FieldPosition fp = new java.text.FieldPosition(0); <BUG>NSDictionary data = NSPropertyListSerialization.dictionaryWithPathURL(ERXFileUtilities.pathURLForResourceNamed("dates.plist", null, null)); </BUG> Enumeration dsts = ((NSArray)data.objectForKey("daylightSavingTimeTransitions")).objectEnumerator(); while (dsts.hasMoreElements()) { NSDictionary dst = (NSDictionary)dsts.nextElement();
NSDictionary data = (NSDictionary)NSPropertyListSerialization.propertyListWithPathURL(ERXFileUtilities.pathURLForResourceNamed("dates.plist", null, null));
17,947
Assert.assertEquals(WED, (new NSTimestamp(2009, MAY, 6, 0, 0, 0, NSTimeZone.getGMT())).dayOfWeek()); Assert.assertEquals(FRI, (new NSTimestamp(2079, DEC, 1, 0, 0, 0, NSTimeZone.getGMT())).dayOfWeek()); } @SuppressWarnings("deprecation") public void testFirstDaysOfYears() { <BUG>NSDictionary data = NSPropertyListSerialization.dictionaryWithPathURL(ERXFileUtilities.pathURLForResourceNamed("dates.plist", null, null)); </BUG> NSDictionary daysDict = (NSDictionary)data.objectForKey("firstDayForYears"); Enumeration days = daysDict.allKeys().objectEnumerator(); while (days.hasMoreElements()) {
NSDictionary data = (NSDictionary)NSPropertyListSerialization.propertyListWithPathURL(ERXFileUtilities.pathURLForResourceNamed("dates.plist", null, null));
17,948
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]
17,949
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);
17,950
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());
17,951
.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);
17,952
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());
17,953
} } 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);
17,954
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();
17,955
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());
17,956
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());
17,957
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());
17,958
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());
17,959
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();
17,960
} 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, {
17,961
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());
17,962
} 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, {
17,963
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, {
17,964
.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());
17,965
.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());
17,966
.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());
17,967
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());
17,968
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());
17,969
<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;
17,970
import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.Handler; <BUG>import android.support.v4.app.NavUtils; import android.support.v7.app.AppCompatActivity;</BUG> import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.ContextMenu;
import android.support.v4.view.MenuItemCompat; import android.support.v7.app.AppCompatActivity;
17,971
import android.database.ContentObserver; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.os.Handler; <BUG>import android.support.v4.app.NavUtils; import android.support.v7.app.AppCompatActivity;</BUG> import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.ContextMenu;
import android.support.v4.view.MenuItemCompat; import android.support.v7.app.AppCompatActivity;
17,972
import android.os.Handler; import android.os.Looper; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.preference.PreferenceManager; <BUG>import android.support.design.widget.FloatingActionButton; import android.support.v7.widget.Toolbar;</BUG> import android.util.Log; import android.view.ContextMenu; import android.view.KeyEvent;
import android.support.v4.view.MenuItemCompat; import android.support.v7.widget.Toolbar;
17,973
mAltitude.setOnCheckedChangeListener(mCheckedChangeListener); mDistance.setOnCheckedChangeListener(mCheckedChangeListener); mCompass.setOnCheckedChangeListener(mCheckedChangeListener); mLocation.setOnCheckedChangeListener(mCheckedChangeListener); builder.setTitle(R.string.dialog_layer_title).setIcon(android.R.drawable.ic_dialog_map).setPositiveButton <BUG>(R.string.btn_okay, null).setView(view); </BUG> dialog = builder.create(); return dialog; case DIALOG_NOTRACK:
(android.R.string.ok, null).setView(view);
17,974
.setRef("http://referringsite.com/referringpage.htm") .setPublisher(Publisher.newBuilder() .setId("pub12345") .setName("Publisher A")) .setContent(Content.newBuilder() <BUG>.addAllKeywords(asList("keyword a", "keyword b", "keyword c")))) </BUG> .setDevice(Device.newBuilder() .setIp("64.124.253.1") .setUa("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.16)")
.setKeywords("keyword a,keyword b,keyword c")))
17,975
user.setGender(gender); } break; } case "keywords": <BUG>user.addAllKeywords(readCsvString(par)); </BUG> break; case "customdata": user.setCustomdata(par.getText());
user.setKeywords(readCsvString(par));
17,976
.setUser(User.newBuilder() .setId("user1") .setBuyeruid("Picard") .setYob(1973) .setGender(Gender.MALE) <BUG>.addAllKeywords(asList("boldly", "going")) .setCustomdata("data1")</BUG> .setGeo(Geo.newBuilder().setZip("12345")) .addData(Data.newBuilder() .setId("data1")
.setKeywords("boldly,going") .setCustomdata("data1")
17,977
.setSeries("Dr. Who") .setSeason("S4") .setUrl("http://who.com") .addCat(ContentCategory.IAB10_2) .setVideoquality(VideoQuality.PROFESSIONAL) <BUG>.addAllKeywords(asList("sci-fi", "aliens")) .setContentrating("R")</BUG> .setUserrating("Awesome!") .setContext(ContentContext.OTHER) .setLivestream(false)
.setKeywords("sci-fi,aliens") .setContentrating("R")
17,978
.setLen(240) .setQagmediarating(QAGMediaRating.MATURE) .setEmbeddable(false) .setLanguage("en") .setExtension(TestExt.testContent, test1)) <BUG>.addAllKeywords(asList("news", "politics")) .setExtension(TestExt.testSite, test1);</BUG> } static App.Builder newApp() { return App.newBuilder()
.setKeywords("news,politics") .setExtension(TestExt.testSite, test1);
17,979
.setBundle("com.cnn.app") .setPrivacypolicy(true) .setPaid(false) .setPublisher(Publisher.newBuilder().setId("pub9")) .setContent(Content.newBuilder().setId("cont9")) <BUG>.addAllKeywords(asList("news", "politics")) .setStoreurl("http://appstore.com/cnn")</BUG> .setExtension(TestExt.testApp, test1); } static BidResponse.Builder newBidResponse(boolean admNative) {
.setKeywords("news,politics") .setStoreurl("http://appstore.com/cnn")
17,980
writePublisher(app.getPublisher(), gen); } if (app.hasContent()) { gen.writeFieldName("content"); writeContent(app.getContent(), gen); <BUG>} writeCsvString("keywords", app.getKeywordsList(), gen); }</BUG> public final void writeContent(Content content, JsonGenerator gen) throws IOException {
if (app.hasKeywords()) { gen.writeStringField("keywords", app.getKeywords());
17,981
package org.glowroot.agent.config; import com.google.common.collect.ImmutableList; <BUG>import org.immutables.value.Value; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;</BUG> @Value.Immutable public abstract class UiConfig { @Value.Default
import org.glowroot.common.config.ConfigDefaults; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
17,982
class RepoAdminImpl implements RepoAdmin { private final DataSource dataSource; private final List<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; private final ConfigRepository configRepository; <BUG>private final AgentDao agentDao; </BUG> private final GaugeValueDao gaugeValueDao; private final GaugeNameDao gaugeNameDao; private final TransactionTypeDao transactionTypeDao;
private final EnvironmentDao agentDao;
17,983
private final TransactionTypeDao transactionTypeDao; private final FullQueryTextDao fullQueryTextDao; private final TraceAttributeNameDao traceAttributeNameDao; RepoAdminImpl(DataSource dataSource, List<CappedDatabase> rollupCappedDatabases, CappedDatabase traceCappedDatabase, ConfigRepository configRepository, <BUG>AgentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao, </BUG> TransactionTypeDao transactionTypeDao, FullQueryTextDao fullQueryTextDao, TraceAttributeNameDao traceAttributeNameDao) { this.dataSource = dataSource;
EnvironmentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao,
17,984
this.fullQueryTextDao = fullQueryTextDao; this.traceAttributeNameDao = traceAttributeNameDao; } @Override public void deleteAllData() throws Exception { <BUG>Environment environment = agentDao.readEnvironment(""); dataSource.deleteAll();</BUG> agentDao.reinitAfterDeletingDatabase(); gaugeValueDao.reinitAfterDeletingDatabase(); gaugeNameDao.invalidateCache();
Environment environment = agentDao.read(""); dataSource.deleteAll();
17,985
public class SimpleRepoModule { private static final long SNAPSHOT_REAPER_PERIOD_MINUTES = 5; private final DataSource dataSource; private final ImmutableList<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; <BUG>private final AgentDao agentDao; private final TransactionTypeDao transactionTypeDao;</BUG> private final AggregateDao aggregateDao; private final TraceAttributeNameDao traceAttributeNameDao; private final TraceDao traceDao;
private final EnvironmentDao environmentDao; private final TransactionTypeDao transactionTypeDao;
17,986
rollupCappedDatabases.add(new CappedDatabase(file, sizeKb, ticker)); } this.rollupCappedDatabases = ImmutableList.copyOf(rollupCappedDatabases); traceCappedDatabase = new CappedDatabase(new File(dataDir, "trace-detail.capped.db"), storageConfig.traceCappedDatabaseSizeMb() * 1024, ticker); <BUG>agentDao = new AgentDao(dataSource); </BUG> transactionTypeDao = new TransactionTypeDao(dataSource); rollupLevelService = new RollupLevelService(configRepository, clock); FullQueryTextDao fullQueryTextDao = new FullQueryTextDao(dataSource);
environmentDao = new EnvironmentDao(dataSource);
17,987
traceDao = new TraceDao(dataSource, traceCappedDatabase, transactionTypeDao, fullQueryTextDao, traceAttributeNameDao); GaugeNameDao gaugeNameDao = new GaugeNameDao(dataSource); gaugeValueDao = new GaugeValueDao(dataSource, gaugeNameDao, clock); repoAdmin = new RepoAdminImpl(dataSource, rollupCappedDatabases, traceCappedDatabase, <BUG>configRepository, agentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao, </BUG> fullQueryTextDao, traceAttributeNameDao); if (backgroundExecutor == null) { reaperRunnable = null;
configRepository, environmentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao,
17,988
new TraceCappedDatabaseStats(traceCappedDatabase), "org.glowroot:type=TraceCappedDatabase"); platformMBeanServerLifecycle.lazyRegisterMBean(new H2DatabaseStats(dataSource), "org.glowroot:type=H2Database"); } <BUG>public AgentDao getAgentDao() { return agentDao; </BUG> } public TransactionTypeRepository getTransactionTypeRepository() {
public EnvironmentDao getEnvironmentDao() { return environmentDao;
17,989
package org.glowroot.agent.embedded.init; import java.io.Closeable; import java.io.File; <BUG>import java.lang.instrument.Instrumentation; import java.util.Map;</BUG> import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService;
import java.util.List; import java.util.Map;
17,990
import java.util.concurrent.ScheduledExecutorService; import javax.annotation.Nullable; import com.google.common.base.MoreObjects; import com.google.common.base.Stopwatch; import com.google.common.base.Supplier; <BUG>import com.google.common.base.Ticker; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;</BUG> import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.glowroot.agent.collector.Collector.AgentConfigUpdater;
import com.google.common.collect.ImmutableList; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
17,991
import org.glowroot.agent.init.EnvironmentCreator; import org.glowroot.agent.init.GlowrootThinAgentInit; import org.glowroot.agent.init.JRebelWorkaround; import org.glowroot.agent.util.LazyPlatformMBeanServer; import org.glowroot.common.live.LiveAggregateRepository.LiveAggregateRepositoryNop; <BUG>import org.glowroot.common.live.LiveTraceRepository.LiveTraceRepositoryNop; import org.glowroot.common.repo.ConfigRepository; import org.glowroot.common.util.Clock;</BUG> import org.glowroot.common.util.OnlyUsedByTests; import org.glowroot.ui.CreateUiModuleBuilder;
import org.glowroot.common.repo.AgentRepository; import org.glowroot.common.repo.ImmutableAgentRollup; import org.glowroot.common.util.Clock;
17,992
SimpleRepoModule simpleRepoModule = new SimpleRepoModule(dataSource, dataDir, clock, ticker, configRepository, backgroundExecutor); simpleRepoModule.registerMBeans(new PlatformMBeanServerLifecycleImpl( agentModule.getLazyPlatformMBeanServer())); CollectorImpl collectorImpl = new CollectorImpl( <BUG>simpleRepoModule.getAgentDao(), simpleRepoModule.getAggregateDao(), simpleRepoModule.getTraceDao(),</BUG> simpleRepoModule.getGaugeValueDao()); collectorProxy.setInstance(collectorImpl); collectorImpl.init(baseDir, EnvironmentCreator.create(glowrootVersion),
simpleRepoModule.getEnvironmentDao(), simpleRepoModule.getTraceDao(),
17,993
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(agentModule.getLiveJvmService()) <BUG>.configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(simpleRepoModule.getAgentDao()) </BUG> .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
.agentRepository(new AgentRepositoryImpl()) .environmentRepository(simpleRepoModule.getEnvironmentDao())
17,994
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(null) <BUG>.configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(simpleRepoModule.getAgentDao()) </BUG> .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
.liveJvmService(agentModule.getLiveJvmService()) .agentRepository(new AgentRepositoryImpl()) .environmentRepository(simpleRepoModule.getEnvironmentDao())
17,995
} @Override public void lazyRegisterMBean(Object object, String name) { lazyPlatformMBeanServer.lazyRegisterMBean(object, name); } <BUG>} } </BUG>
void initEmbeddedServer() throws Exception { if (simpleRepoModule == null) { return;
17,996
List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); for (GaugeConfig loopConfig : configs) { if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException(); } <BUG>} String version = Versions.getVersion(gaugeConfig); for (GaugeConfig loopConfig : configs) { if (Versions.getVersion(loopConfig.toProto()).equals(version)) { throw new IllegalStateException("This exact gauge already exists"); } } configs.add(GaugeConfig.create(gaugeConfig));</BUG> configService.updateGaugeConfigs(configs);
[DELETED]
17,997
configService.updateGaugeConfigs(configs); } } @Override public void updateGaugeConfig(String agentId, AgentConfig.GaugeConfig gaugeConfig, <BUG>String priorVersion) throws Exception { synchronized (writeLock) {</BUG> List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
GaugeConfig config = GaugeConfig.create(gaugeConfig); synchronized (writeLock) {
17,998
boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) { GaugeConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { <BUG>i.set(GaugeConfig.create(gaugeConfig)); found = true; break;</BUG> } else if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException();
i.set(config);
17,999
boolean found = false; for (ListIterator<PluginConfig> i = configs.listIterator(); i.hasNext();) { PluginConfig loopPluginConfig = i.next(); if (pluginId.equals(loopPluginConfig.id())) { String loopVersion = Versions.getVersion(loopPluginConfig.toProto()); <BUG>checkVersionsEqual(loopVersion, priorVersion); PluginDescriptor pluginDescriptor = getPluginDescriptor(pluginId); i.set(PluginConfig.create(pluginDescriptor, properties));</BUG> found = true; break;
for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) { GaugeConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(version)) { i.remove();
18,000
boolean found = false; for (ListIterator<InstrumentationConfig> i = configs.listIterator(); i.hasNext();) { InstrumentationConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { <BUG>i.set(InstrumentationConfig.create(instrumentationConfig)); found = true; break; }</BUG> }
i.set(config); } else if (loopConfig.equals(config)) { throw new IllegalStateException("This exact instrumentation already exists");