auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateErrorEventCatching emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertErrorEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateErrorEventCatching emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertErrorEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
public Optional<ApplicationContainerContextFactory<ApplicationContainerContext>> getApplicationContainerContextFactory() { return Optional.ofNullable( (ApplicationContainerContextFactory<ApplicationContainerContext>) this.applicationContainerContextFactory); }

Target:
public Optional<ApplicationContainerContextFactory<ApplicationContainerContext>> getApplicationContainerContextFactory() { @SuppressWarnings("unchecked") Optional<ApplicationContainerContextFactory<ApplicationContainerContext>> factoryOptional = (Optional) this.applicationContainerContextFactoryOptional; return factoryOptional; }
Source:
private static <T> T loadFile(InputStream labelIn, TypeBase type) { try (InputStream in = labelIn) { return new ObjectMapper().readValue(in, type); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error during initialization!", e); } }

Target:
private static <T> T loadFile(InputStream labelIn, TypeBase type) { try (InputStream in = labelIn) { return new ObjectMapper().readValue(in, type); } catch (Exception e) { throw new RuntimeException("Error during initialization!", e); } }
Source:
MixpanelAPI(Context context, Future<SharedPreferences> referrerPreferences, String token) { mContext = context; mToken = token; mPeople = new PeopleImpl(); mMessages = getAnalyticsMessages(); mConfig = getConfig(); mPersistentIdentity = getPersistentIdentity(context, referrerPreferences, token); mUpdatesListener = new UpdatesListener(); mDecideUpdates = null; final String peopleId = mPersistentIdentity.getPeopleDistinctId(); if (null != peopleId) { mDecideUpdates = constructDecideUpdates(token, peopleId, mUpdatesListener); } registerMixpanelActivityLifecycleCallbacks(); if (null != mDecideUpdates) { mMessages.installDecideCheck(mDecideUpdates); } try { Class<?> clazz = Class.forName("android.support.v4.content.LocalBroadcastManager"); Method methodGetInstance = clazz.getMethod("getInstance", Context.class); Method methodRegisterReceiver = clazz.getMethod("registerReceiver", BroadcastReceiver.class, IntentFilter.class); Object localBroadcastManager = methodGetInstance.invoke(null, context); final MixpanelAPI instance = this; methodRegisterReceiver.invoke(localBroadcastManager, new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { JSONObject properties = new JSONObject(); Bundle args = intent.getBundleExtra("event_args"); if (args != null) { for (String key : args.keySet()) { try { properties.put(key, args.get(key)); } catch (JSONException e) { Log.d(LOGTAG, "failed to add key \"" + key + "\" to properties for tracking bolts event", e); } } } instance.track("$" + intent.getStringExtra("event_name"), properties); } }, new IntentFilter("com.parse.bolts.measurement_event")); } catch (Exception e) { Log.d(LOGTAG, "App Links tracking will not be enabled due to this exception.", e); } }

Target:
MixpanelAPI(Context context, Future<SharedPreferences> referrerPreferences, String token) { mContext = context; mToken = token; mPeople = new PeopleImpl(); mMessages = getAnalyticsMessages(); mConfig = getConfig(); mPersistentIdentity = getPersistentIdentity(context, referrerPreferences, token); mUpdatesListener = new UpdatesListener(); mDecideUpdates = null; final String peopleId = mPersistentIdentity.getPeopleDistinctId(); if (null != peopleId) { mDecideUpdates = constructDecideUpdates(token, peopleId, mUpdatesListener); } registerMixpanelActivityLifecycleCallbacks(); if (null != mDecideUpdates) { mMessages.installDecideCheck(mDecideUpdates); } }
Source:
public PathEntity(final Path path, final ContentType contentType, final String contentEncoding) { super(contentType, contentEncoding); this.path = Args.notNull(path, "File"); }

Target:
public PathEntity(final Path path, final ContentType contentType, final String contentEncoding) { super(contentType, contentEncoding); this.path = Args.notNull(path, "Path"); }
Source:
public static EnumerableSort create(RelNode child, RelCollation collation, RexNode offset, RexNode fetch) { final RelOptCluster cluster = child.getCluster(); final RelTraitSet traitSet = cluster.traitSetOf(EnumerableConvention.INSTANCE) .replace(collation); return new EnumerableSort(cluster, traitSet, child, (RelCollation) traitSet.getTrait(collation.getTraitDef()), offset, fetch); }

Target:
public static EnumerableSort create(RelNode child, RelCollation collation, RexNode offset, RexNode fetch) { final RelOptCluster cluster = child.getCluster(); final RelTraitSet traitSet = cluster.traitSetOf(EnumerableConvention.INSTANCE) .replace(collation); return new EnumerableSort(cluster, traitSet, child, collation, offset, fetch); }
Source:
public String getAgencyName(@NonNull Resources resources) { switch (getProcessType()) { case 1: return "Debit / Gate"; default: return "Credit / Top Up"; } }

Target:
public String getAgencyName(@NonNull Resources resources) { switch (getProcessType()) { case 1: return resources.getString(R.string.kmt_debit_desc); default: return resources.getString(R.string.kmt_credit_desc); } }
Source:
public JAXBContext getContext(Class<?> clazz) throws JAXBException { JAXBContext jaxbContext = this.jaxbContexts.get(clazz); if (jaxbContext == null) { jaxbContext = JAXBContext.newInstance(clazz); this.jaxbContexts.putIfAbsent(clazz, jaxbContext); } return jaxbContext; }

Target:
private JAXBContext getContext(Class<?> clazz) throws JAXBException { JAXBContext jaxbContext = this.jaxbContexts.get(clazz); if (jaxbContext == null) { jaxbContext = JAXBContext.newInstance(clazz); this.jaxbContexts.putIfAbsent(clazz, jaxbContext); } return jaxbContext; }
Source:
private void generateQRCode() { new AsyncTask<Void, Void, Pair<String, Bitmap>>() { @Override protected Pair<String, Bitmap> doInBackground(Void... voids) { try { String filePath = qrCodeGenerator.generateQRCode(includedKeys); BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap bitmap = FileUtils.getBitmap(filePath, options); return new Pair<>(filePath, bitmap); } catch (Exception ignored) { } return null; } @Override protected void onPostExecute(Pair<String, Bitmap> qrCode) { qrCodeFilePath.setValue(qrCode.first); qrCodeBitmap.setValue(qrCode.second); boolean serverPasswordSet = !generalSharedPreferences.getString(KEY_PASSWORD, "").isEmpty(); boolean adminPasswordSet = adminSharedPreferences.contains(KEY_ADMIN_PW); if (serverPasswordSet || adminPasswordSet) { if (serverPasswordSet && includedKeys.contains(KEY_PASSWORD) && adminPasswordSet && includedKeys.contains(KEY_ADMIN_PW)) { warning.setValue(R.string.qrcode_with_both_passwords); } else if (serverPasswordSet && includedKeys.contains(KEY_PASSWORD)) { warning.setValue(R.string.qrcode_with_server_password); } else if (adminPasswordSet && includedKeys.contains(KEY_ADMIN_PW)) { warning.setValue(R.string.qrcode_with_admin_password); } else { warning.setValue(R.string.qrcode_without_passwords); } } else { warning.setValue(null); } } }.execute(); }

Target:
private void generateQRCode() { scheduler.scheduleInBackground( () -> { try { String filePath = qrCodeGenerator.generateQRCode(includedKeys); BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap bitmap = FileUtils.getBitmap(filePath, options); return new Pair<>(filePath, bitmap); } catch (Exception ignored) { } return null; }, qrCode -> { qrCodeFilePath.setValue(qrCode.first); qrCodeBitmap.setValue(qrCode.second); boolean serverPasswordSet = !generalSharedPreferences.getString(KEY_PASSWORD, "").isEmpty(); boolean adminPasswordSet = adminSharedPreferences.contains(KEY_ADMIN_PW); if (serverPasswordSet || adminPasswordSet) { if (serverPasswordSet && includedKeys.contains(KEY_PASSWORD) && adminPasswordSet && includedKeys.contains(KEY_ADMIN_PW)) { warning.setValue(R.string.qrcode_with_both_passwords); } else if (serverPasswordSet && includedKeys.contains(KEY_PASSWORD)) { warning.setValue(R.string.qrcode_with_server_password); } else if (adminPasswordSet && includedKeys.contains(KEY_ADMIN_PW)) { warning.setValue(R.string.qrcode_with_admin_password); } else { warning.setValue(R.string.qrcode_without_passwords); } } else { warning.setValue(null); } } ); }
Source:
protected int rwAnyNode(IASTNode node, int indirection) { final IASTNode parent = node.getParent(); if (parent instanceof ICPPASTConstructorInitializer) { return rwInCtorInitializer(node, indirection, (ICPPASTConstructorInitializer) parent); } else if (parent instanceof IASTIdExpression) { IASTNode grandparent = parent.getParent(); if (grandparent instanceof ICPPASTArraySubscriptExpression) { return super.rwAnyNode(parent, 1); } else if (grandparent instanceof ICPPASTUnaryExpression && ((CPPASTUnaryExpression) grandparent).getOperator() == IASTUnaryExpression.op_star) { return WRITE; } } return super.rwAnyNode(node, indirection); }

Target:
protected int rwAnyNode(IASTNode node, int indirection) { final IASTNode parent = node.getParent(); if (parent instanceof ICPPASTConstructorInitializer) { return rwInCtorInitializer(node, indirection, (ICPPASTConstructorInitializer) parent); } return super.rwAnyNode(node, indirection); }
Source:
public MatchableDataTable getDataTable() throws SQLException { if (queryOrSymbol == null) { queryOrSymbol = args[0]; } if (isSymbolGetter(queryOrSymbol)) { return new MatchableDataTable(getFromSymbol()); } Log.log("Query: '%s'", queryOrSymbol); try (DbStatement st = dbEnvironment.createStatementWithBoundFixtureSymbols( FitNesseTestHost.getInstance(), queryOrSymbol)) { return new MatchableDataTable(new DataTable(st.executeQuery())); } }

Target:
public MatchableDataTable getDataTable() throws SQLException { if (queryOrSymbol == null) { queryOrSymbol = args[0]; } if (isSymbolGetter(queryOrSymbol)) { return new MatchableDataTable(getFromSymbol()); } Log.log("Query: '%s'", queryOrSymbol); return new MatchableDataTable(dbEnvironment.getQueryTable(queryOrSymbol)); }
Source:
public String render(AnalyzerResultFuture<? extends AnalyzerResult> renderable) { final StringBuilder resultString = new StringBuilder(); try { AnalyzerResult result = renderable.get(); Renderer<? super AnalyzerResult, ? extends CharSequence> renderer = _rendererFactory.getRenderer( result, TextRenderingFormat.class); if (renderer != null) { logger.debug("renderer.render({})", result); final CharSequence component = renderer.render(result); resultString.append(component); return resultString.toString(); } else { final String message = "No renderer found for result type " + result.getClass().getName(); logger.error(message); throw new IllegalStateException(message); } } catch (RuntimeException error) { String message = "Unable to fetch result"; logger.error(message, error); throw new IllegalStateException(message); } }

Target:
public String render(AnalyzerResultFuture<? extends AnalyzerResult> renderable) { final StringBuilder resultString = new StringBuilder(); try { AnalyzerResult result = renderable.get(); Renderer<? super AnalyzerResult, ? extends CharSequence> renderer = _rendererFactory.getRenderer( result, TextRenderingFormat.class); if (renderer != null) { logger.debug("renderer.render({})", result); final CharSequence component = renderer.render(result); resultString.append(component); return resultString.toString(); } else { final String message = "No renderer found for result type " + result.getClass().getName(); logger.error(message); throw new IllegalStateException(message); } } catch (RuntimeException error) { String message = "Unable to fetch result"; logger.error(message, error); throw new IllegalStateException(message, error); } }
Source:
private static final int findLocalizedModifier(String modifierName) { if (modifierName == null) return 0; if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.CTRL))) return SWT.CTRL; if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.SHIFT))) return SWT.SHIFT; if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.ALT))) return SWT.ALT; if (modifierName .equalsIgnoreCase(Action.findModifierString(SWT.COMMAND))) return SWT.COMMAND; return 0; }

Target:
private static final int findLocalizedModifier(String modifierName) { if (modifierName == null) { return 0; } if (modifierName .equalsIgnoreCase(Action.findModifierString(SWT.CTRL))) { return SWT.CTRL; } if (modifierName .equalsIgnoreCase(Action.findModifierString(SWT.SHIFT))) { return SWT.SHIFT; } if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.ALT))) { return SWT.ALT; } if (modifierName .equalsIgnoreCase(Action.findModifierString(SWT.COMMAND))) { return SWT.COMMAND; } return 0; }
Source:
public final synchronized int read(ByteBuffer dst) throws IOException { int read = read(dst, position); position += read; return read; }

Target:
public final synchronized int read(ByteBuffer dst) throws IOException { int read = read(dst, position); if (read > 0) { position += read; } return read; }
Source:
public void init() { Font.loadFont(FafClientApplication.class.getResourceAsStream("/font/dfc-icons.ttf"), 10); JavaFxUtil.fixTooltipDuration(); CountDownLatch runAndWaitLatch = new CountDownLatch(1); Platform.runLater(() -> { applicationContext = new SpringApplicationBuilder(FafClientApplication.class) .profiles(getAdditionalProfiles()) .bannerMode(Mode.OFF) .run(getParameters().getRaw().toArray(new String[0])); runAndWaitLatch.countDown(); }); try { runAndWaitLatch.await(); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public void init() { Font.loadFont(FafClientApplication.class.getResourceAsStream("/font/dfc-icons.ttf"), 10); JavaFxUtil.fixTooltipDuration(); CountDownLatch runAndWaitLatch = new CountDownLatch(1); Platform.runLater(() -> { applicationContext = new SpringApplicationBuilder(FafClientApplication.class) .profiles(getAdditionalProfiles()) .bannerMode(Mode.OFF) .run(getParameters().getRaw().toArray(new String[0])); runAndWaitLatch.countDown(); }); noCatch((NoCatchRunnable) runAndWaitLatch::await); }
Source:
public String execute(final TransactionContext context) { validateCodeSystem(context); final CodeSystem codeSystem = createCodeSystem(context); context.add(codeSystem); return codeSystem.getShortName(); }

Target:
public String execute(final TransactionContext context) { checkCodeSystem(context); final CodeSystem codeSystem = createCodeSystem(context); context.add(codeSystem); return codeSystem.getShortName(); }
Source:
public long getEntityOwnerId() { return Account.ACCOUNT_ID_SYSTEM; }

Target:
public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getAccountId(); }
Source:
KQueueDomainTransportFactory() { try { Class.forName("io.netty.channel.kqueue.KQueue"); } catch (ClassNotFoundException e) { throw new IllegalStateException("The kqueue transport is not available"); } if (!KQueue.isAvailable()) { throw new IllegalStateException("The kqueue transport is not supported"); } }

Target:
KQueueDomainTransportFactory() { ReflectionUtil.loadKQueueClass(); }
Source:
public static Module module() { return new CacheModule() { @Override protected void configure() { persist(WebSessionManager.CACHE_NAME, String.class, Val.class) .maximumWeight(1024) .expireAfterWrite(CacheBasedWebSession.MAX_AGE_MINUTES, MINUTES) ; install(new FactoryModuleBuilder() .build(WebSessionManagerFactory.class)); DynamicItem.itemOf(binder(), WebSession.class, true); DynamicItem.bind(binder(), WebSession.class) .to(H2CacheBasedWebSession.class) .in(RequestScoped.class); } }; }

Target:
public static Module module() { return new CacheModule() { @Override protected void configure() { persist(WebSessionManager.CACHE_NAME, String.class, Val.class) .maximumWeight(1024) .expireAfterWrite(CacheBasedWebSession.MAX_AGE_MINUTES, MINUTES) ; install(new FactoryModuleBuilder() .build(WebSessionManagerFactory.class)); DynamicItem.itemOf(binder(), WebSession.class); DynamicItem.bind(binder(), WebSession.class) .to(H2CacheBasedWebSession.class) .in(RequestScoped.class); } }; }
Source:
public List<String> getBuildCauses() { List<ModelNode> causes = get(TRIGGERED_BY).asList(); ArrayList<String> ret = new ArrayList<String>(); for (ModelNode cause : causes) { ret.add(cause.asString()); } return ret; }

Target:
public List<String> getBuildCauses() { List<ModelNode> causes = get(TRIGGERED_BY).asList(); ArrayList<String> ret = new ArrayList<>(); for (ModelNode cause : causes) { ret.add(cause.asString()); } return ret; }
Source:
public ArrayList<Attachment> createAttachmentList() { ArrayList<Attachment> result = new ArrayList<>(); for (Attachment attachment : attachments.values()) { if(account.getResizeEnabled() && !attachment.overrideDefault && Utility.isImage(context, attachment.uri)){ float factor = 1.0f / account.getResizeFactor(); String newFilename = ""; long size = 0; if(factor != 1.0f) { newFilename = Utility.getResizedImageFile(context, attachment.uri, factor); size = (new File(newFilename)).length(); } if(!newFilename.equals("")) { Attachment newAttachment = attachment.createResizedCopy(newFilename, size); result.add(newAttachment); } else { result.add(attachment); } } else if(attachment.overrideDefault && Utility.isImage(context, attachment.uri)){ float factor = attachment.resizeFactor; String newFilename = ""; long size = 0; if(factor != 1.0f) { newFilename = Utility.getResizedImageFile(context, attachment.uri, factor); size = (new File(newFilename)).length(); } if(!newFilename.equals("")) { Attachment newAttachment = attachment.createResizedCopy(newFilename, size); result.add(newAttachment); } else { result.add(attachment); } } else { result.add(attachment); } } return result; }

Target:
public ArrayList<Attachment> createAttachmentList() { ArrayList<Attachment> result = new ArrayList<>(); for (Attachment attachment : attachments.values()) { if (account.getImageResizeEnabled() && !attachment.overrideDefault && Utility.isImage(context, attachment.uri)) { float factor = 1.0f / account.getResizeFactor(); String newFilename = Utility.getResizedImageFile(context, attachment.uri, factor); long size; if (factor != 1.0f && !newFilename.equals("")) { size = (new File(newFilename)).length(); Attachment newAttachment = attachment.createResizedCopy(newFilename, size); result.add(newAttachment); } else { result.add(attachment); } } else if (attachment.overrideDefault && Utility.isImage(context, attachment.uri)) { float factor = attachment.resizeFactor; String newFilename = Utility.getResizedImageFile(context, attachment.uri, factor); long size; if (factor != 1.0f && !newFilename.equals("")) { size = (new File(newFilename)).length(); Attachment newAttachment = attachment.createResizedCopy(newFilename, size); result.add(newAttachment); } else { result.add(attachment); } } else { result.add(attachment); } } return result; }
Source:
protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { return null; }

Target:
protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { throw new ExecutionException("not implemented"); }
Source:
private List<AccountInfo> suggestAccount(VisibilityControl visibilityControl) throws OrmException { final String a = query; final String b = a + MAX_SUFFIX; final LinkedHashMap<Account.Id, AccountInfo> r = Maps.newLinkedHashMap(); for (final Account p : dbProvider.get().accounts() .suggestByFullName(a, b, limit)) { addSuggestion(r, p, new AccountInfo(p.getId()), visibilityControl); } if (r.size() < limit) { for (final Account p : dbProvider.get().accounts() .suggestByPreferredEmail(a, b, limit - r.size())) { addSuggestion(r, p, new AccountInfo(p.getId()), visibilityControl); } } if (r.size() < limit) { for (final AccountExternalId e : dbProvider.get().accountExternalIds() .suggestByEmailAddress(a, b, limit - r.size())) { if (!r.containsKey(e.getAccountId())) { final Account p = accountCache.get(e.getAccountId()).getAccount(); final AccountInfo info = new AccountInfo(p.getId()); addSuggestion(r, p, info, visibilityControl); } } } return new ArrayList<AccountInfo>(r.values()); }

Target:
private List<AccountInfo> suggestAccount(VisibilityControl visibilityControl) throws OrmException { String a = query; String b = a + MAX_SUFFIX; LinkedHashMap<Account.Id, AccountInfo> r = Maps.newLinkedHashMap(); for (Account p : dbProvider.get().accounts() .suggestByFullName(a, b, limit)) { addSuggestion(r, p, new AccountInfo(p.getId()), visibilityControl); } if (r.size() < limit) { for (Account p : dbProvider.get().accounts() .suggestByPreferredEmail(a, b, limit - r.size())) { addSuggestion(r, p, new AccountInfo(p.getId()), visibilityControl); } } if (r.size() < limit) { for (AccountExternalId e : dbProvider.get().accountExternalIds() .suggestByEmailAddress(a, b, limit - r.size())) { if (!r.containsKey(e.getAccountId())) { Account p = accountCache.get(e.getAccountId()).getAccount(); AccountInfo info = new AccountInfo(p.getId()); addSuggestion(r, p, info, visibilityControl); } } } return Lists.newArrayList(r.values()); }
Source:
private synchronized JSONObject _request(Method m, String url, String json, List<String> hostsArray, int connectTimeout, int readTimeout) throws AlgoliaException { String cacheKey = null; if (isCacheEnabled) { cacheKey = String.format("%s:%s(%s)", m, url, json); final JSONObject value = cache.get(cacheKey); if (value != null) { return value; } } try { final JSONObject result = _getJSONObject(_requestRaw(m, url, json, hostsArray, connectTimeout, readTimeout)); if (isCacheEnabled) { cache.put(cacheKey, result); } return result; } catch (JSONException e) { throw new AlgoliaException("JSON decode error:" + e.getMessage()); } catch (UnsupportedEncodingException e) { throw new AlgoliaException("UTF-8 decode error:" + e.getMessage()); } }

Target:
private synchronized JSONObject _request(Method m, String url, String json, List<String> hostsArray, int connectTimeout, int readTimeout) throws AlgoliaException { String cacheKey = null; String jsonStr = null; if (isCacheEnabled) { cacheKey = String.format("%s:%s(%s)", m, url, json); jsonStr = cache.get(cacheKey); } try { if (jsonStr == null) { final byte[] requestRaw = _requestRaw(m, url, json, hostsArray, connectTimeout, readTimeout); jsonStr = new String(requestRaw, "UTF-8"); if (isCacheEnabled) { cache.put(cacheKey, jsonStr); } } return new JSONObject(jsonStr); } catch (JSONException e) { throw new AlgoliaException("JSON decode error:" + e.getMessage()); } catch (UnsupportedEncodingException e) { throw new AlgoliaException("UTF-8 decode error:" + e.getMessage()); } }
Source:
public OAuth2UserRecord getUserRecord(String code, @NotNull OAuth20Service service) throws IOException, OAuth2Exception, InterruptedException, ExecutionException { OAuth2AccessToken accessToken = service.getAccessToken(code); final String userEndpoint = getUserEndpoint(accessToken); if ( ( accessToken.getScope() != null && ! getScope().stream().allMatch(accessToken.getScope()::contains) ) || ( accessToken.getScope() == null && ! getSpacedScope().isEmpty() ) ) { throw new OAuth2Exception(200, BundleUtil.getStringFromBundle("auth.providers.insufficientScope", Arrays.asList(this.getTitle())), ""); } OAuthRequest request = new OAuthRequest(Verb.GET, getUserEndpoint(accessToken)); request.setCharset("UTF-8"); if (id.equals("microsoft")) { request.addHeader("Accept", "application/json"); } service.signRequest(accessToken, request); Response response = service.execute(request); int responseCode = response.getCode(); String body = response.getBody(); logger.log(Level.FINE, "In requestUserRecord. Body: {0}", body); if ( responseCode == 200 && body != null ) { return getUserRecord(body, accessToken, service); } else { throw new OAuth2Exception(responseCode, body, BundleUtil.getStringFromBundle("auth.providers.exception.userinfo", Arrays.asList(this.getTitle()))); } }

Target:
public OAuth2UserRecord getUserRecord(String code, @NotNull OAuth20Service service) throws IOException, OAuth2Exception, InterruptedException, ExecutionException { OAuth2AccessToken accessToken = service.getAccessToken(code); if ( ( accessToken.getScope() != null && ! getScope().stream().allMatch(accessToken.getScope()::contains) ) || ( accessToken.getScope() == null && ! getSpacedScope().isEmpty() ) ) { throw new OAuth2Exception(200, BundleUtil.getStringFromBundle("auth.providers.insufficientScope", Arrays.asList(this.getTitle())), ""); } OAuthRequest request = new OAuthRequest(Verb.GET, getUserEndpoint(accessToken)); request.setCharset("UTF-8"); if (id.equals("microsoft")) { request.addHeader("Accept", "application/json"); } service.signRequest(accessToken, request); Response response = service.execute(request); int responseCode = response.getCode(); String body = response.getBody(); logger.log(Level.FINE, "In requestUserRecord. Body: {0}", body); if ( responseCode == 200 && body != null ) { return getUserRecord(body, accessToken, service); } else { throw new OAuth2Exception(responseCode, body, BundleUtil.getStringFromBundle("auth.providers.exception.userinfo", Arrays.asList(this.getTitle()))); } }
Source:
private String getKeyFromBackDoor(String courseId, String studentEmail) { String key = "[BACKDOOR_STATUS_FAILURE]"; while (key.startsWith("[BACKDOOR_STATUS_FAILURE]")) { key = BackDoor.getKeyForStudent(courseId, studentEmail); } return key; }

Target:
private String getKeyFromBackDoor(String courseId, String studentEmail) { int NUMBER_OF_REMAINING_RETRIES = 10; String key = "[BACKDOOR_STATUS_FAILURE]"; while (key.startsWith("[BACKDOOR_STATUS_FAILURE]") && NUMBER_OF_REMAINING_RETRIES > 0) { key = BackDoor.getKeyForStudent(courseId, studentEmail); NUMBER_OF_REMAINING_RETRIES--; ThreadHelper.waitFor(100); } return key; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setFullScreenDialogClose(Activity.RESULT_CANCELED, true); final Intent intent = new Intent(this, org.sufficientlysecure.keychain.ui.ImportKeysActivity.class); new AlertDialog.Builder(this) .setTitle("Import key attempt") .setMessage("You scanned a fingerprint with another app, please scan with Openkeychain directly to be safe" ) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { startActivity(intent); } }) .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); startQrCodeCaptureActivity(); }
Source:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { if (savedInstanceState != null) { mInProgressMessageId = savedInstanceState.getInt(KEY_IN_PROGRESS_MESSAGE_ID, 0); mOldSitesIDs = savedInstanceState.getIntegerArrayList(KEY_OLD_SITES_IDS); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_TWO_FACTOR_FORM_VIEWED); if (mService != null) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_2FA_NEEDED); } } super.onActivityCreated(savedInstanceState); }

Target:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { if (savedInstanceState != null) { mInProgressMessageId = savedInstanceState.getInt(KEY_IN_PROGRESS_MESSAGE_ID, 0); mOldSitesIDs = savedInstanceState.getIntegerArrayList(KEY_OLD_SITES_IDS); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_TWO_FACTOR_FORM_VIEWED); } super.onActivityCreated(savedInstanceState); }
Source:
public Blob run(Blob blob) throws IOException { String srcMT = blob.getMimeType(); String destMT = MimetypeRegistry.PDF_MIMETYPE; String extension = MimetypeRegistry.PDF_EXTENSION; Blob result = service.convertBlob(service.getConverterName(srcMT, destMT), new SimpleBlobHolder(blob), extension, destMT); service.adjustBlobName(blob.getFilename(), result, extension, destMT); return result; }

Target:
public Blob run(Blob blob) throws IOException { return service.convertToMimeType(MimetypeRegistry.PDF_MIMETYPE, new SimpleBlobHolder(blob), Collections.emptyMap()).getBlob(); }
Source:
protected Object readResolve() { projectUpdateLock = new ReentrantLock(); issueCache = makeIssueCache(); jiraSession = null; if (StringUtils.isNotBlank(credentialsId)) { StandardUsernamePasswordCredentials credentials = CredentialsHelper.lookupSystemCredentials(credentialsId, url != null ? url.toExternalForm() : null); setCredentials(credentials); } else if (userName != null && password != null) { StandardUsernamePasswordCredentials credentials = CredentialsHelper.migrateCredentials(userName, password.getPlainText(), url != null ? url.toExternalForm() : null); setCredentials(credentials); setCredentialsId(credentials.getId()); } return this; }

Target:
protected Object readResolve() { if (credentialsId == null && userName != null && password != null) { return new JiraSite(url, alternativeUrl, userName, password.getPlainText(), supportsWikiStyleComment, recordScmChanges, userPattern, updateJiraIssueForAllStatus, groupVisibility, roleVisibility, useHTTPAuth); } return new JiraSite(url, alternativeUrl, credentialsId, supportsWikiStyleComment, recordScmChanges, userPattern, updateJiraIssueForAllStatus, groupVisibility, roleVisibility, useHTTPAuth); }
Source:
public ImmutableList<LocalDate> getUnadjustedDates() { ImmutableList.Builder<LocalDate> dates = ImmutableList.builder(); dates.add(periods.get(0).getUnadjustedStartDate()); for (SchedulePeriod period : periods) { dates.add(period.getUnadjustedEndDate()); } return dates.build(); }

Target:
public ImmutableList<LocalDate> getUnadjustedDates() { ImmutableList.Builder<LocalDate> dates = ImmutableList.builder(); dates.add(getUnadjustedStartDate()); for (SchedulePeriod period : periods) { dates.add(period.getUnadjustedEndDate()); } return dates.build(); }
Source:
public GenericItemBlockUsingDamageDescriptor(String name, String iconName) { changeDefaultIcon(iconName); this.name = name; }

Target:
public GenericItemBlockUsingDamageDescriptor(String name, String iconName) { setDefaultIcon(iconName); this.name = name; }
Source:
private Optional<VersionMessage> attemptHandshakeForVersionMessage() { Peer peer; try { peer = createLocalPeer(port); } catch (UnknownHostException ex) { log.error("Local bitcoin node handshake attempt unexpectedly threw: {}", ex); return Optional.empty(); } var originalNioClientLoggerLevel = silence(NioClient.class); var originalNioClientManagerLoggerLevel = silence(NioClientManager.class); NioClient client; try { log.info("Initiating attempt to connect to and handshake with a local " + "Bitcoin node (which may or may not be running) on port {}.", port); client = createClient(peer, port, CONNECTION_TIMEOUT); } catch (IOException ex) { log.error("Local bitcoin node handshake attempt unexpectedly threw: {}", ex); return Optional.empty(); } ListenableFuture<VersionMessage> peerVersionMessageFuture = getVersionMessage(peer); Optional<VersionMessage> optionalPeerVersionMessage; try { var peerVersionMessage = peerVersionMessageFuture.get(); optionalPeerVersionMessage = Optional.of(peerVersionMessage); } catch (ExecutionException | InterruptedException | CancellationException ex) { optionalPeerVersionMessage = Optional.empty(); } peer.close(); client.closeConnection(); restoreLoggerLevel(NioClient.class, originalNioClientLoggerLevel); restoreLoggerLevel(NioClientManager.class, originalNioClientManagerLoggerLevel); return optionalPeerVersionMessage; }

Target:
private Optional<VersionMessage> attemptHandshakeForVersionMessage() { Peer peer; try { peer = createLocalPeer(port); } catch (UnknownHostException ex) { log.error("Local bitcoin node handshake attempt was unexpectedly interrupted", ex); return Optional.empty(); } var originalNioClientLoggerLevel = silence(NioClient.class); var originalNioClientManagerLoggerLevel = silence(NioClientManager.class); NioClient client; try { log.info("Initiating attempt to connect to and handshake with a local " + "Bitcoin node (which may or may not be running) on port {}.", port); client = createClient(peer, port, CONNECTION_TIMEOUT); } catch (IOException ex) { log.error("Local bitcoin node handshake attempt was unexpectedly interrupted", ex); return Optional.empty(); } ListenableFuture<VersionMessage> peerVersionMessageFuture = getVersionMessage(peer); Optional<VersionMessage> optionalPeerVersionMessage; try { var peerVersionMessage = peerVersionMessageFuture.get(); optionalPeerVersionMessage = Optional.of(peerVersionMessage); } catch (ExecutionException | InterruptedException | CancellationException ex) { optionalPeerVersionMessage = Optional.empty(); } peer.close(); client.closeConnection(); restoreLoggerLevel(NioClient.class, originalNioClientLoggerLevel); restoreLoggerLevel(NioClientManager.class, originalNioClientManagerLoggerLevel); return optionalPeerVersionMessage; }
Source:
public FileSystem getFileSystem() { return fs; }

Target:
public FileSystem getFileSystem() { return fileSystem; }
Source:
public OrcsBranch getBranchOps() { OrcsSession session = getSession(); LazyObject<ArtifactReadable> systemUser = new LazyObject<ArtifactReadable>() { @Override protected final FutureTask<ArtifactReadable> createLoaderTask() { Callable<ArtifactReadable> callable = new Callable<ArtifactReadable>() { @Override public ArtifactReadable call() throws Exception { return getQueryFactory().fromBranch(CoreBranches.COMMON).andIds(SystemUser.OseeSystem).getResults().getExactlyOne(); } }; return new FutureTask<ArtifactReadable>(callable); } }; QueryFactory queryFactory = getQueryFactory(); return new OrcsBranchImpl(logger, session, module.getBranchDataStore(), queryFactory, systemUser, getOrcsTypes()); }

Target:
public OrcsBranch getBranchOps() { OrcsSession session = getSession(); LazyObject<ArtifactReadable> systemUser = new LazyObject<ArtifactReadable>() { @Override protected final FutureTask<ArtifactReadable> createLoaderTask() { Callable<ArtifactReadable> callable = new Callable<ArtifactReadable>() { @SuppressWarnings("unchecked") @Override public ArtifactReadable call() throws Exception { return getQueryFactory().fromBranch(CoreBranches.COMMON).andIds(SystemUser.OseeSystem).getResults().getExactlyOne(); } }; return new FutureTask<ArtifactReadable>(callable); } }; QueryFactory queryFactory = getQueryFactory(); return new OrcsBranchImpl(logger, session, module.getBranchDataStore(), queryFactory, systemUser, getOrcsTypes()); }
Source:
protected String getEffectiveEmulatedMachine() { if (getVm().getCustomEmulatedMachine() != null) { if (getVm().getClusterArch().getFamily() == ArchitectureType.ppc) { return findEmulatedMachineByPrefix(EMULATED_MACHINE_PREFIX_PPC); } else if (getVm().getCustomEmulatedMachine() == EmulatedMachine.i440fx_seabios) { return findEmulatedMachineByPrefix(EMULATED_MACHINE_PREFIX_I440); } else { return findEmulatedMachineByPrefix(EMULATED_MACHINE_PREFIX_Q35); } } String recentClusterDefault = (getVm().getClusterArch().getFamily() == ArchitectureType.ppc) ? findEmulatedMachineByPrefix(EMULATED_MACHINE_PREFIX_PPC) : findEmulatedMachineByPrefix(EMULATED_MACHINE_PREFIX_I440); if (getVm().getCustomCompatibilityVersion() == null) { return recentClusterDefault; } String bestMatch = findBestMatchForEmulatedMachine( recentClusterDefault, Config.getValue( ConfigValues.ClusterEmulatedMachines, getVm().getCustomCompatibilityVersion().getValue())); log.info("Emulated machine '{}' selected since Custom Compatibility Version is set for '{}'", bestMatch, getVm()); return bestMatch; }

Target:
protected String getEffectiveEmulatedMachine() { if (getVm().getCustomEmulatedMachine() != null) { return findEmulatedMachineByPrefix(getVm().getCustomEmulatedMachine()); } String recentClusterDefault = (getVm().getClusterArch().getFamily() == ArchitectureType.ppc) ? findEmulatedMachineByPrefix(EmulatedMachine.pseries) : findEmulatedMachineByPrefix(EmulatedMachine.i440fx_seabios); if (getVm().getCustomCompatibilityVersion() == null) { return recentClusterDefault; } String bestMatch = findBestMatchForEmulatedMachine( recentClusterDefault, Config.getValue( ConfigValues.ClusterEmulatedMachines, getVm().getCustomCompatibilityVersion().getValue())); log.info("Emulated machine '{}' selected since Custom Compatibility Version is set for '{}'", bestMatch, getVm()); return bestMatch; }
Source:
public void testMultiHighlightMessage() { final Rectangle cellBounds = SWTBotUtils.getCellBounds(fTableBot.widget, ROW, 6); ImageHelper before = ImageHelper.getScreenGrab(cellBounds); Map<RGB, Integer> colorBefore = before.getHistogram(); fTableBot.click(0, 6); fBot.text().typeText("e\n", 100); fTableBot.select(4); ImageHelper after = ImageHelper.getScreenGrab(cellBounds); Map<RGB, Integer> colorAfter = after.getHistogram(); assertTrue(colorBefore.containsKey(BLACK)); assertTrue(colorBefore.containsKey(WHITE)); assertFalse(colorBefore.containsKey(YELLOW)); assertTrue(colorAfter.containsKey(BLACK)); assertTrue(colorAfter.containsKey(WHITE)); assertTrue(colorAfter.containsKey(YELLOW)); int start = -1; int end; List<Point> intervals = new ArrayList<>(); List<RGB> pixelRow = after.getPixelRow(2); for (int i = 1; i < pixelRow.size(); i++) { RGB prevPixel = pixelRow.get(i - 1); RGB pixel = pixelRow.get(i); if (!prevPixel.equals(YELLOW) && pixel.equals(YELLOW)) { start = i; } if (prevPixel.equals(YELLOW) && pixel.equals(WHITE)) { end = i; if (start == -1) { fail(); } intervals.add(new Point(start, end)); } } assertEquals(2, intervals.size()); assertEquals(intervals.get(1).y - intervals.get(1).x, intervals.get(0).y - intervals.get(0).x); }

Target:
public void testMultiHighlightMessage() { final Rectangle cellBounds = SWTBotUtils.getCellBounds(fTableBot.widget, ROW, MESSAGE_COLUMN); ImageHelper before = ImageHelper.getScreenGrab(cellBounds); fTableBot.click(0, MESSAGE_COLUMN); fBot.text().typeText("e\n", 100); fTableBot.select(ROW - 1); ImageHelper after = ImageHelper.getScreenGrab(cellBounds); Map<RGB, Integer> colorBefore = before.getHistogram(); Map<RGB, Integer> colorAfter = after.getHistogram(); assertTrue(colorBefore.containsKey(fBackground)); assertTrue(colorBefore.containsKey(fForeground)); assertFalse(colorBefore.containsKey(YELLOW)); assertTrue(colorAfter.containsKey(fBackground)); assertTrue(colorAfter.containsKey(fForeground)); assertTrue(colorAfter.containsKey(YELLOW)); int start = -1; int end; List<Point> intervals = new ArrayList<>(); List<RGB> pixelRow = after.getPixelRow(2); for (int i = 1; i < pixelRow.size(); i++) { RGB prevPixel = pixelRow.get(i - 1); RGB pixel = pixelRow.get(i); if (prevPixel.equals(fBackground) && pixel.equals(YELLOW)) { start = i; } if (prevPixel.equals(YELLOW) && pixel.equals(fBackground)) { end = i; if (start == -1) { fail(); } intervals.add(new Point(start, end)); } } assertEquals(2, intervals.size()); }
Source:
public Object[] getChildren(Object parentElement) { if (parentElement instanceof IProductModel) { IProductModel productModel = (IProductModel) parentElement; return productModel.getProduct().getFeatures(); } else if (parentElement instanceof IFeatureModel) { IFeatureModel featureModel = (IFeatureModel) parentElement; Object[] features = featureModel.getFeature().getIncludedFeatures(); if (!fInput.isIncludePlugins()) { return features; } Object[] plugins = featureModel.getFeature().getPlugins(); List<Object> all = new ArrayList<>(features.length + plugins.length); all.addAll(Arrays.asList(features)); all.addAll(Arrays.asList(plugins)); return all.toArray(); } else if (parentElement instanceof IFeatureChild) { IFeatureChild featureChild = (IFeatureChild) parentElement; IFeatureModel featureModel = fFeatureModelManager.findFeatureModel(featureChild.getId()); return getChildren(featureModel); } else if (parentElement instanceof IProductFeature) { IProductFeature productFeature = (IProductFeature) parentElement; IFeatureModel featureModel = fFeatureModelManager.findFeatureModel(productFeature.getId()); return getChildren(featureModel); } return new Object[0]; }

Target:
public Object[] getChildren(Object parentElement) { if (parentElement instanceof IProductModel) { IProductModel productModel = (IProductModel) parentElement; Object[] features = productModel.getProduct().getFeatures(); if (!fInput.getFeaturesViewInput().isIncludePlugins()) { return features; } Object[] plugins = productModel.getProduct().getPlugins(); List<Object> all = new ArrayList<>(features.length + plugins.length); all.addAll(Arrays.asList(features)); all.addAll(Arrays.asList(plugins)); return all.toArray(); } else if (parentElement instanceof IFeatureModel) { IFeatureModel featureModel = (IFeatureModel) parentElement; Object[] features = featureModel.getFeature().getIncludedFeatures(); if (!fInput.getFeaturesViewInput().isIncludePlugins()) { return features; } Object[] plugins = featureModel.getFeature().getPlugins(); List<Object> all = new ArrayList<>(features.length + plugins.length); all.addAll(Arrays.asList(features)); all.addAll(Arrays.asList(plugins)); return all.toArray(); } else if (parentElement instanceof IFeatureChild) { IFeatureChild featureChild = (IFeatureChild) parentElement; IFeatureModel featureModel = fFeatureModelManager.findFeatureModel(featureChild.getId()); return getChildren(featureModel); } else if (parentElement instanceof IProductFeature) { IProductFeature productFeature = (IProductFeature) parentElement; IFeatureModel featureModel = fFeatureModelManager.findFeatureModel(productFeature.getId()); return getChildren(featureModel); } return new Object[0]; }
Source:
public static Metadata extractMetadata(Metadata metadata) { Metadata toCheck = metadata; while (toCheck != null) { if (toCheck instanceof InternalMetadataImpl) { toCheck = ((InternalMetadataImpl) toCheck).actual(); } else { break; } } return toCheck; }

Target:
private static Metadata extractMetadata(Metadata metadata) { Metadata toCheck = metadata; while (toCheck != null) { if (toCheck instanceof InternalMetadataImpl) { toCheck = ((InternalMetadataImpl) toCheck).actual(); } else { break; } } return toCheck; }
Source:
public CompletableFuture<Long> write(long entryId, ByteBuf data) { SyncAddCallback callback = new SyncAddCallback(); PendingAddOp op = new PendingAddOp(this, callback, null); op.setEntryId(entryId); if ((entryId <= this.lastAddConfirmed) || pendingAddOps.contains(op)) { LOG.error("Trying to re-add duplicate entryid:{}", entryId); CompletableFuture<Long> result = createFuture(); completeExceptionally(result, BKException.create(BKException.Code.DuplicateEntryIdException)); return result; } doAsyncAddEntry(op, data, callback, null); return callback; }

Target:
public CompletableFuture<Long> write(long entryId, ByteBuf data) { SyncAddCallback callback = new SyncAddCallback(); asyncAddEntry(entryId, data, callback, data); return callback; }
Source:
public Invocation createInvocation(Object target, MockCreationSettings settings, Method method, final Callable realMethod, Object... args) { RealMethod.FromCallable superMethod = new RealMethod.FromCallable(realMethod); return MockMethodInterceptor.createInvocation(target, method, args, superMethod, settings); }

Target:
public Invocation createInvocation(Object target, MockCreationSettings settings, Method method, final Callable realMethod, Object... args) { RealMethod superMethod = new RealMethod.FromCallable(realMethod); return createInvocation(target, settings, method, superMethod, args); }
Source:
public void messageExpired(MessageReference message, SimpleString messageExpiryAddress, ServerConsumer consumer) { final ManagementService managementService = getManagementService(); if (managementService != null && sendExpiredNotifications) { try { if (!message.getQueue().getAddress().equals(managementService.getManagementNotificationAddress())) { final TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, message.getQueue().getAddress()); props.putByteProperty(ManagementHelper.HDR_ROUTING_TYPE, message.getQueue().getRoutingType().getType()); props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, message.getQueue().getName()); props.putLongProperty(ManagementHelper.HDR_MESSAGE_ID, message.getMessageID()); if (message.hasConsumerId()) { long consumerId = message.getConsumerId(); if (consumerId >= 0) { props.putLongProperty(ManagementHelper.HDR_CONSUMER_NAME, consumerId); } } managementService.sendNotification(new Notification(null, CoreNotificationType.MESSAGE_EXPIRED, props)); } } catch (Exception e) { logger.warn("Error sending notification: " + CoreNotificationType.MESSAGE_EXPIRED, e.getMessage(), e); } } }

Target:
public void messageExpired(MessageReference message, SimpleString messageExpiryAddress, ServerConsumer consumer) { final ManagementService managementService = getManagementService(); if (managementService != null && sendExpiredNotifications) { try { if (!message.getQueue().getAddress().equals(managementService.getManagementNotificationAddress())) { final TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, message.getQueue().getAddress()); props.putByteProperty(ManagementHelper.HDR_ROUTING_TYPE, message.getQueue().getRoutingType().getType()); props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, message.getQueue().getName()); props.putLongProperty(ManagementHelper.HDR_MESSAGE_ID, message.getMessageID()); if (message.hasConsumerId()) { props.putLongProperty(ManagementHelper.HDR_CONSUMER_NAME, message.getConsumerId()); } managementService.sendNotification(new Notification(null, CoreNotificationType.MESSAGE_EXPIRED, props)); } } catch (Exception e) { logger.warn("Error sending notification: " + CoreNotificationType.MESSAGE_EXPIRED, e.getMessage(), e); } } }
Source:
public String toString() { return this.getClass().getSimpleName() + " { " + getPayload().getPayloadId() + " }"; }

Target:
public String toString() { return new ToStringBuilder(this) .append("myPayload", myPayload) .toString(); }
Source:
public void testImportVMFromConfigurationWhenVMDoesNotExists() { initCommand(null); assertFalse(cmd.canDoAction()); assertTrue(cmd.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_OVF.toString())); }

Target:
public void testImportVMFromConfigurationWhenVMDoesNotExists() { initCommand(null); CanDoActionTestUtils.runAndAssertCanDoActionFailure(cmd, VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_OVF); }
Source:
public String getTypeElementsList() throws ParseException { final StringBuilder outputBuilder = new StringBuilder(); for ( final Ds3Element element : this.elements) { LOG.debug("element[" + element.getName() + "][" + element.getType() + "]"); outputBuilder.append(CHelper.indent(1)); outputBuilder.append(CHelper.elementTypeToString(element)); outputBuilder.append(" "); outputBuilder.append(Helper.camelToUnderscore(Helper.unqualifiedName(element.getName()))); outputBuilder.append(";"); outputBuilder.append(System.lineSeparator()); } return outputBuilder.toString(); }

Target:
public String getTypeElementsList() throws ParseException { final StringBuilder outputBuilder = new StringBuilder(); for (final Ds3Element element : this.elements) { outputBuilder.append(CHelper.indent(1)) .append(CHelper.elementTypeToString(element)) .append(" ") .append(Helper.camelToUnderscore(Helper.unqualifiedName(element.getName()))) .append(";") .append(System.lineSeparator()); } return outputBuilder.toString(); }