auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void test() { List<Subfield.PathElement> elements = ImmutableList.of( new NestedField("b"), new Subfield.LongSubscript(2), new Subfield.StringSubscript("z"), Subfield.allSubscripts(), new Subfield.StringSubscript("34"), new Subfield.StringSubscript("b \"test\""), new Subfield.StringSubscript("\"abc"), new Subfield.StringSubscript("abc\""), new Subfield.StringSubscript("ab\"cde")); for (Subfield.PathElement element : elements) { assertPath(new Subfield("a", ImmutableList.of(element))); } for (Subfield.PathElement element : elements) { for (Subfield.PathElement secondElement : elements) { assertPath(new Subfield("a", ImmutableList.of(element, secondElement))); } } for (Subfield.PathElement element : elements) { for (Subfield.PathElement secondElement : elements) { for (Subfield.PathElement thirdElement : elements) { assertPath(new Subfield("a", ImmutableList.of(element, secondElement, thirdElement))); } } } }

Target:
public void test() { List<PathElement> elements = ImmutableList.of( new NestedField("b"), new Subfield.LongSubscript(2), new Subfield.StringSubscript("z"), Subfield.allSubscripts(), new Subfield.StringSubscript("34"), new Subfield.StringSubscript("b \"test\""), new Subfield.StringSubscript("\"abc"), new Subfield.StringSubscript("abc\""), new Subfield.StringSubscript("ab\"cde"), new Subfield.StringSubscript("a.b[\"hello\uDBFF\"]")); for (PathElement element : elements) { assertPath(new Subfield("a", ImmutableList.of(element))); } for (PathElement element : elements) { for (PathElement secondElement : elements) { assertPath(new Subfield("a", ImmutableList.of(element, secondElement))); } } for (PathElement element : elements) { for (PathElement secondElement : elements) { for (PathElement thirdElement : elements) { assertPath(new Subfield("a", ImmutableList.of(element, secondElement, thirdElement))); } } } }
Source:
public ContainerRequest filter(ContainerRequest request) { final String taskId = Preconditions.checkNotNull( request.getPathSegments() .get( Iterables.indexOf( request.getPathSegments(), new Predicate<PathSegment>() { @Override public boolean apply(PathSegment input) { return input.getPath().equals("task"); } } ) + 1 ).getPath() ); Optional<Task> taskOptional = taskStorageQueryAdapter.getTask(taskId); if (!taskOptional.isPresent()) { throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST) .entity(StringUtils.format("Cannot find any task with id: [%s]", taskId)) .build() ); } final String dataSourceName = Preconditions.checkNotNull(taskOptional.get().getDataSource()); final ResourceAction resourceAction = new ResourceAction( new Resource(dataSourceName, ResourceType.DATASOURCE), getAction(request) ); final Access authResult = AuthorizationUtils.authorizeResourceAction( getReq(), resourceAction, getAuthorizerMapper() ); if (!authResult.isAllowed()) { throw new WebApplicationException(Response.status(Response.Status.FORBIDDEN) .entity( StringUtils.format("Access-Check-Result: %s", authResult.toString()) ) .build()); } return request; }

Target:
public ContainerRequest filter(ContainerRequest request) { final String taskId = Preconditions.checkNotNull( request.getPathSegments() .get( Iterables.indexOf( request.getPathSegments(), new Predicate<PathSegment>() { @Override public boolean apply(PathSegment input) { return input.getPath().equals("task"); } } ) + 1 ).getPath() ); Optional<Task> taskOptional = taskStorageQueryAdapter.getTask(taskId); if (!taskOptional.isPresent()) { throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST) .entity(StringUtils.format("Cannot find any task with id: [%s]", taskId)) .build() ); } final String dataSourceName = Preconditions.checkNotNull(taskOptional.get().getDataSource()); final ResourceAction resourceAction = new ResourceAction( new Resource(dataSourceName, ResourceType.DATASOURCE), getAction(request) ); final Access authResult = AuthorizationUtils.authorizeResourceAction( getReq(), resourceAction, getAuthorizerMapper() ); if (!authResult.isAllowed()) { throw new ForbiddenException(authResult.toString()); } return request; }
Source:
private static String getHeader(Map<String, Object> args, String header, boolean required) throws RestServiceException { String value = null; if (args.containsKey(header)) { Object valueObj = args.get(header); value = valueObj != null ? valueObj.toString() : null; if (value == null && required) { throw new RestServiceException("Request has unacceptable value for header: " + header, RestServiceErrorCode.InvalidArgs); } } else if (required) { throw new RestServiceException("Request does not have required header: " + header, RestServiceErrorCode.MissingArgs); } return value; }

Target:
private static String getHeader(Map<String, Object> args, String header, boolean required) throws RestServiceException { String value = null; if (args.containsKey(header)) { Object valueObj = args.get(header); value = valueObj != null ? valueObj.toString() : null; if (value == null && required) { throw new RestServiceException("Request has null value for header: " + header, RestServiceErrorCode.InvalidArgs); } } else if (required) { throw new RestServiceException("Request does not have required header: " + header, RestServiceErrorCode.MissingArgs); } return value; }
Source:
public void testDefinitionHashCode() { DefinitionImpl<String> a = new DefinitionImpl<>("a"); DefinitionImpl<String> b = new DefinitionImpl<>("a"); assertEquals(a.hashCode(), b.hashCode()); b.setDefinition("b"); assertNotEquals(a.hashCode(), b.hashCode()); b.setDefinition("a"); assertEquals(a.hashCode(), b.hashCode()); }

Target:
public void testDefinitionHashCode() { DefinitionImpl<String> a = new DefinitionImpl<>("a"); DefinitionImpl<String> b = new DefinitionImpl<>("a"); assertEquals(a.hashCode(), b.hashCode()); b.setDefinition("b"); assertNotEquals(a.hashCode(), b.hashCode()); b.setDefinition(null); assertNotEquals(a, b); b.setDefinition("a"); assertEquals(a.hashCode(), b.hashCode()); }
Source:
public boolean test() { try { String consoleText = getConsoleText(); return consoleText.contains(text); } catch (WaitTimeoutExpiredException ex) { return false; } }

Target:
public boolean test() { String consoleText = consoleView.getConsoleText(); if (consoleText == null) { return false; } else { return consoleText.contains(text); } }
Source:
private SsoLocalConfig() { String v; String defaultsPath = DEFAULTS_PATH; v = System.getProperty("ovirt-engine.config.defaults"); if (v != null) { defaultsPath = v; } v = System.getenv("ENGINE_DEFAULTS"); if (v != null) { defaultsPath = v; } String varsPath = VARS_PATH; v = System.getProperty("ovirt-engine.config.vars"); if (v != null) { varsPath = v; } v = System.getenv("ENGINE_VARS"); if (v != null) { varsPath = v; } loadConfig(defaultsPath, varsPath); }

Target:
private SsoLocalConfig() { String v; String defaultsPath = System.getProperty("ovirt-engine.config.defaults", DEFAULTS_PATH); v = System.getenv("ENGINE_DEFAULTS"); if (v != null) { defaultsPath = v; } String varsPath = System.getProperty("ovirt-engine.config.vars", VARS_PATH); v = System.getenv("ENGINE_VARS"); if (v != null) { varsPath = v; } loadConfig(defaultsPath, varsPath); }
Source:
private static void checkNotIndeterminate(Boolean equalsResult) { if (equalsResult == null) { throw new PrestoException(NOT_SUPPORTED, "map key cannot be indeterminate"); } }

Target:
private static void checkNotIndeterminate(Boolean equalsResult) { if (equalsResult == null) { throw new PrestoException(NOT_SUPPORTED, "map key cannot be null or contain nulls"); } }
Source:
public ScheduleContext(long currentTimeMillis, Collection<Integer> managedShards) { this.scheduleTime = currentTimeMillis; this.shardStateManager = new ShardStateManager(managedShards, asMillisecondsSinceEpochTicker()); this.lockManager = new NoOpShardLockManager(); this.clock = new DefaultClockImpl(); registerMBean(); }

Target:
public ScheduleContext(long currentTimeMillis, Collection<Integer> managedShards) { this(currentTimeMillis, managedShards, new DefaultClockImpl()); }
Source:
public void onGracefulLeave(AvailabilityStrategyContext context, Address leaver) { CacheTopology currentTopology = context.getCurrentTopology(); List<Address> newMembers = new ArrayList<>(currentTopology.getMembers()); if (!newMembers.remove(leaver)) { log.debugf("Cache %s does not have member %s, ignoring leave request", context.getCacheName(), leaver); return; } if (context.getStableTopology() != null && isDataLost(context.getStableTopology().getCurrentCH(), newMembers)) { log.errorf("Cache %s lost data because of graceful leaver %s", context.getCacheName(), leaver); } context.updateCurrentTopology(newMembers); context.queueRebalance(newMembers); }

Target:
public void onGracefulLeave(AvailabilityStrategyContext context, Address leaver) { CacheTopology currentTopology = context.getCurrentTopology(); List<Address> newMembers = new ArrayList<>(currentTopology.getMembers()); if (!newMembers.remove(leaver)) { log.debugf("Cache %s does not have member %s, ignoring leave request", context.getCacheName(), leaver); return; } if (context.getStableTopology() != null && isDataLost(context.getStableTopology().getCurrentCH(), newMembers)) { log.lostDataBecauseOfGracefulLeaver(context.getCacheName(), leaver); } context.updateCurrentTopology(newMembers); context.queueRebalance(newMembers); }
Source:
public static void injectSystemProperties(Job job) { for (String propName : System.getProperties().stringPropertyNames()) { Configuration conf = job.getConfiguration(); if (propName.startsWith("hadoop.")) { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } }

Target:
public static void injectSystemProperties(Job job) { final Configuration conf = job.getConfiguration(); for (String propName : System.getProperties().stringPropertyNames()) { if (propName.startsWith("hadoop.")) { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } }
Source:
protected void niceName(StringBuilder sb, int start) { if (mainGene != null && hiddenGene != null) { String niceName; if (mainGene.equals("weak") && !hiddenGene.equals("weak")) { niceName = "normal"; } else if (mainGene.equals("brown") && !hiddenGene.equals("brown")) { niceName = "normal"; } else { niceName = mainGene; } sb.insert(start, MiscUtils.niceName(niceName)).insert(start + niceName.length(), ' '); } }

Target:
protected void niceName(StringBuilder sb, int start) { if (mainGene != null && hiddenGene != null) { String niceName; if ("weak".equals(mainGene) && !"weak".equals(hiddenGene)) { niceName = "normal"; } else if ("brown".equals(mainGene) && !"brown".equals(hiddenGene)) { niceName = "normal"; } else { niceName = mainGene; } sb.insert(start, MiscUtils.niceName(niceName)).insert(start + niceName.length(), ' '); } }
Source:
public void detectAndSendChanges() { super.detectAndSendChanges(); if( Platform.isServer() ) { if( this.craftingMode != this.ct.isCraftingRecipe() ) { this.craftingMode = this.ct.isCraftingRecipe(); this.updateOrderOfOutputSlots(); } if( this.substitute != this.ct.isSubstitution() ) { this.substitute = this.ct.isSubstitution(); } } }

Target:
public void detectAndSendChanges() { super.detectAndSendChanges(); if( Platform.isServer() ) { if( this.craftingMode != this.ct.isCraftingRecipe() ) { this.craftingMode = this.ct.isCraftingRecipe(); this.updateOrderOfOutputSlots(); } this.substitute = this.ct.isSubstitution(); } }
Source:
public List<Future> rollback(NodeEngine nodeEngine) { List<Future> futures = new ArrayList<Future>(size()); ListIterator<TransactionLogRecord> iterator = getRecordList().listIterator(size()); while (iterator.hasPrevious()) { TransactionLogRecord record = iterator.previous(); Future future = invoke(nodeEngine, record, record.newRollbackOperation()); futures.add(future); } return futures; }

Target:
public List<Future> rollback(NodeEngine nodeEngine) { List<Future> futures = new ArrayList<Future>(size()); for (TransactionLogRecord record : recordMap.values()) { Future future = invoke(nodeEngine, record, record.newRollbackOperation()); futures.add(future); } return futures; }
Source:
public List<Record> apply(RevisionResource rsrc, Input input) throws AuthException, BadRequestException, OrmException { if (input == null) { input = new Input(); } if (input.rule != null && !rules.isProjectRulesEnabled()) { throw new AuthException("project rules are disabled"); } input.filters = MoreObjects.firstNonNull(input.filters, filters); SubmitRuleEvaluator evaluator = new SubmitRuleEvaluator( changeDataFactory.create(db.get(), rsrc.getChange()), rsrc.getPatchSet()); List<SubmitRecord> records = evaluator.setLogErrors(false) .setSkipSubmitFilters(input.filters == Filters.SKIP) .setRule(input.rule) .canSubmit(); List<Record> out = Lists.newArrayListWithCapacity(records.size()); AccountInfo.Loader accounts = accountInfoFactory.create(true); for (SubmitRecord r : records) { out.add(new Record(r, accounts)); } accounts.fill(); return out; }

Target:
public List<Record> apply(RevisionResource rsrc, Input input) throws AuthException, BadRequestException, OrmException { if (input == null) { input = new Input(); } if (input.rule != null && !rules.isProjectRulesEnabled()) { throw new AuthException("project rules are disabled"); } input.filters = MoreObjects.firstNonNull(input.filters, filters); SubmitRuleEvaluator evaluator = new SubmitRuleEvaluator( changeDataFactory.create(db.get(), rsrc.getControl())); List<SubmitRecord> records = evaluator.setPatchSet(rsrc.getPatchSet()) .setLogErrors(false) .setSkipSubmitFilters(input.filters == Filters.SKIP) .setRule(input.rule) .canSubmit(); List<Record> out = Lists.newArrayListWithCapacity(records.size()); AccountInfo.Loader accounts = accountInfoFactory.create(true); for (SubmitRecord r : records) { out.add(new Record(r, accounts)); } accounts.fill(); return out; }
Source:
public FileReadResponse readWithResponse(OutputStream stream, FileRange range, DownloadRetryOptions options, DataLakeRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, Context context) { try { BlobDownloadResponse response = blockBlobClient.downloadWithResponse(stream, Transforms.toBlobRange(range), Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(requestConditions), getRangeContentMd5, timeout, context); return Transforms.toFileReadResponse(response); } catch (BlobStorageException ex) { throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); } }

Target:
public FileReadResponse readWithResponse(OutputStream stream, FileRange range, DownloadRetryOptions options, DataLakeRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, Context context) { return DataLakeImplUtils.returnOrConvertException(() -> { BlobDownloadResponse response = blockBlobClient.downloadWithResponse(stream, Transforms.toBlobRange(range), Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(requestConditions), getRangeContentMd5, timeout, context); return Transforms.toFileReadResponse(response); }, logger); }
Source:
public void updateSelectionAfterTrashAction() { if (DisplayUtils.isLargeScreenLandscape(getActivity())) { List<Integer> deletedNotesPositions = getSelectedNotesPositions(); int firstDeletedNote = deletedNotesPositions.get(0); int positionToSelect = -1; for (int i = firstDeletedNote + 1; i < mNotesAdapter.getCount(); i++) { if (!deletedNotesPositions.contains(i)) { positionToSelect = i; break; } } if (positionToSelect == -1) { for (int i = firstDeletedNote - 1; i >= 0; i--) { if (!deletedNotesPositions.contains(i)) { positionToSelect = i; break; } } } if (positionToSelect != -1) { Note noteToSelect = mNotesAdapter.getItem(positionToSelect + mList.getHeaderViewsCount()); mCallbacks.onNoteSelected(noteToSelect.getSimperiumKey(), null, noteToSelect.isMarkdownEnabled(), noteToSelect.isPreviewEnabled()); mSelectedNoteId = noteToSelect.getSimperiumKey(); } else { if (getActivity() != null) { ((NotesActivity) requireActivity()).showDetailPlaceholder(); } } } }

Target:
public void updateSelectionAfterTrashAction() { if (DisplayUtils.isLargeScreenLandscape(getActivity())) { List<Integer> deletedNotesPositions = getSelectedNotesPositions(); int firstDeletedNote = deletedNotesPositions.get(0); int positionToSelect = -1; for (int i = firstDeletedNote + 1; i < mNotesAdapter.getCount(); i++) { if (!deletedNotesPositions.contains(i)) { positionToSelect = i; break; } } if (positionToSelect == -1) { for (int i = firstDeletedNote - 1; i >= 0; i--) { if (!deletedNotesPositions.contains(i)) { positionToSelect = i; break; } } } if (positionToSelect != -1) { Note noteToSelect = mNotesAdapter.getItem(positionToSelect + mList.getHeaderViewsCount()); mCallbacks.onNoteSelected(noteToSelect.getSimperiumKey(), null, noteToSelect.isMarkdownEnabled(), noteToSelect.isPreviewEnabled()); mSelectedNoteId = noteToSelect.getSimperiumKey(); } else { ((NotesActivity) requireActivity()).showDetailPlaceholder(); } } }
Source:
public ProcessEngineConfiguration setDefaultNumberOfRetries(int defaultNumberOfRetries) { this.defaultNumberOfRetries = defaultNumberOfRetries; return this; }

Target:
public void setDefaultNumberOfRetries(int defaultNumberOfRetries) { this.defaultNumberOfRetries = defaultNumberOfRetries; }
Source:
public byte[] serializeObject(Object object) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(bos); out.writeObject(object); byte[] byteArray = bos.toByteArray(); return byteArray; } catch (IOException e) { logger.error("Exception while trying serialize java object", e); throw e; } finally { try { if (out != null) { out.close(); } } catch (IOException ex) { logger.error("Exception while trying to close object output stream", ex); throw ex; } try { bos.close(); } catch (IOException ex) { logger.error("Exception while trying to close bytes output stream", ex); throw ex; } } }

Target:
public byte[] serializeObject(Object object) { try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(bos)){ out.writeObject(object); byte[] byteArray = bos.toByteArray(); return byteArray; } catch (Exception e){ logger.error("Exception occurred while Java Object Serialization", e); throw new RedisException("Java Serialization Failed", e); } }
Source:
public String getMessage(IResource[] resources) { throw new RuntimeException(); }

Target:
public String getMessage(IResource[] resources) { throw new IllegalStateException( "CrashingCommitMessageProvider fails on purpose."); }
Source:
public Session getSessionCookie() { return wrapped.getSession(); }

Target:
public Session getSessionCookie() { return wrapped.getSessionCookie(); }
Source:
private void doUpdate(boolean optional, String workspaceId, Consumer<WorkspaceActivity> updater) throws ServerException { try { EntityManager em = managerProvider.get(); WorkspaceActivity activity = em.find(WorkspaceActivity.class, workspaceId); if (activity == null) { if (optional) { return; } activity = new WorkspaceActivity(); activity.setWorkspaceId(workspaceId); updater.accept(activity); em.persist(activity); } else { updater.accept(activity); em.merge(activity); em.flush(); } } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }

Target:
private void doUpdate(boolean optional, String workspaceId, Consumer<WorkspaceActivity> updater) throws ServerException { try { EntityManager em = managerProvider.get(); WorkspaceActivity activity = em.find(WorkspaceActivity.class, workspaceId); if (activity == null) { if (optional) { return; } activity = new WorkspaceActivity(); activity.setWorkspaceId(workspaceId); updater.accept(activity); em.persist(activity); } else { updater.accept(activity); em.merge(activity); } em.flush(); } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }
Source:
protected String getDialogTitle() { return Messages.getString("PasswordController.NewLicenseKey"); }

Target:
protected String getDialogTitle() { return Messages.getString("LicenseKeyController.NewLicenseKey"); }
Source:
private static IFeaturesExtractor getExtractor(Node node) throws MalformedURLException, ClassNotFoundException, IllegalAccessException, InstantiationException { NodeList list = node.getChildNodes(); String classPath = null; String className = null; Map<String, String> parametrs = new HashMap<>(); for (int i = 0; i < list.getLength(); ++i) { Node child = list.item(i); if ("classPath".equals(child.getNodeName())) { classPath = child.getTextContent().trim(); } else if ("className".equals(child.getNodeName())) { className = child.getTextContent().trim(); } else if ("parameters".equals(child.getNodeName())) { getParametrs(parametrs, child); } } if (classPath == null || className == null) { return null; } File file = new File(classPath); URL url = file.toURI().toURL(); URL[] urls = new URL[]{url}; ClassLoader cl = new URLClassLoader(urls); Class cls = cl.loadClass(className); Object obj = cls.newInstance(); if (obj instanceof IFeaturesExtractor) { IFeaturesExtractor extractor = (IFeaturesExtractor) obj; extractor.initialise(parametrs); return extractor; } return null; }

Target:
private static ExtractorStructure getExtractor(Node node) throws MalformedURLException, ClassNotFoundException, IllegalAccessException, InstantiationException { NodeList list = node.getChildNodes(); String classPath = null; String className = null; UUID id = null; Map<String, String> parametrs = new HashMap<>(); for (int i = 0; i < list.getLength(); ++i) { Node child = list.item(i); switch (child.getNodeName()) { case "classPath": classPath = child.getTextContent().trim(); break; case "className": className = child.getTextContent().trim(); break; case "parameters": getParametrs(parametrs, child); break; case "id": try { id = UUID.fromString(child.getTextContent().trim()); } catch (IllegalArgumentException e) { LOGGER.error("Attribute id of the plugin is not in UUID format", e); return null; } break; } } if (classPath == null || className == null || id == null) { LOGGER.error("Some of required nodes have not founded."); return null; } File file = new File(classPath); URL url = file.toURI().toURL(); URL[] urls = new URL[]{url}; ClassLoader cl = new URLClassLoader(urls); Class cls = cl.loadClass(className); Object obj = cls.newInstance(); if (obj instanceof IFeaturesExtractor) { IFeaturesExtractor extractor = (IFeaturesExtractor) obj; extractor.initialize(parametrs); return new ExtractorStructure(extractor, id); } return null; }
Source:
public Resource decorate(final Resource resource) { try { if (!this.accepts(resource)) { return resource; } } catch (final RepositoryException e) { LOG.debug("Failed binary sync check for remote asset: {}", resource.getPath()); return resource; } boolean syncSuccessful = false; if (isAlreadySyncing(resource.getPath())) { syncSuccessful = waitForSyncInProgress(resource); } else { syncSuccessful = syncAssetBinaries(resource); } if (syncSuccessful) { LOG.trace("Refreshing resource after binary sync of {}", resource.getPath()); final ResourceResolver resourceResolver = resource.getResourceResolver(); resourceResolver.refresh(); return resourceResolver.getResource(resource.getPath()); } else { return resource; } }

Target:
public Resource decorate(final Resource resource) { try { if (!this.accepts(resource)) { return resource; } } catch (final Exception e) { LOG.debug("Failed binary sync check for remote asset: {}", resource.getPath()); return resource; } boolean syncSuccessful = false; if (isAlreadySyncing(resource.getPath())) { syncSuccessful = waitForSyncInProgress(resource); } else { syncSuccessful = syncAssetBinaries(resource); } if (syncSuccessful) { LOG.trace("Refreshing resource after binary sync of {}", resource.getPath()); final ResourceResolver resourceResolver = resource.getResourceResolver(); resourceResolver.refresh(); return resourceResolver.getResource(resource.getPath()); } else { return resource; } }
Source:
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { Log.d(TAG, "updateAppWidget() appWidgetId=" + appWidgetId); long unreadCount = DbConnection.getSession().getArticleDao().queryBuilder(). where(ArticleDao.Properties.Archive.eq(0)).count(); Log.d(TAG, "updateAppWidget() read from database unreadCount=" + unreadCount); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.icon_unread); Log.d(TAG, "updateAppWidget() setting unread_count_text to " + unreadCount); if (unreadCount <= 0) { views.setViewVisibility(R.id.unread_count_text, View.GONE); } else { views.setViewVisibility(R.id.unread_count_text, View.VISIBLE); if (unreadCount > MAX_UNREAD_COUNT) { views.setTextViewText(R.id.unread_count_text, MAX_UNREAD_COUNT + "+"); } else { views.setTextViewText(R.id.unread_count_text, "" + unreadCount); } } Intent intent = new Intent(context, ArticlesListActivity.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId, intent, 0); views.setOnClickPendingIntent(R.id.icon_unread_layout, pendingIntent); appWidgetManager.updateAppWidget(appWidgetId, views); }

Target:
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { Log.d(TAG, "updateAppWidget() appWidgetId=" + appWidgetId); long unreadCount = DbConnection.getSession().getArticleDao().queryBuilder(). where(ArticleDao.Properties.Archive.eq(false)).count(); Log.d(TAG, "updateAppWidget() read from database unreadCount=" + unreadCount); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.icon_unread); Log.d(TAG, "updateAppWidget() setting unread_count_text to " + unreadCount); if (unreadCount <= 0) { views.setViewVisibility(R.id.unread_count_text, View.GONE); } else { views.setViewVisibility(R.id.unread_count_text, View.VISIBLE); if (unreadCount > MAX_UNREAD_COUNT) { views.setTextViewText(R.id.unread_count_text, MAX_UNREAD_COUNT + "+"); } else { views.setTextViewText(R.id.unread_count_text, "" + unreadCount); } } Intent intent = new Intent(context, ArticlesListActivity.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId, intent, 0); views.setOnClickPendingIntent(R.id.icon_unread_layout, pendingIntent); appWidgetManager.updateAppWidget(appWidgetId, views); }
Source:
public void setCreationDate(DocumentModel doc, Calendar creationDate) { doc.setProperty(DUBLINCORE_SCHEMA_NAME, DUBLINCORE_CREATED_DATE, creationDate); }

Target:
public void setCreationDate(DocumentModel doc, Calendar creationDate) { doc.setPropertyValue(DUBLINCORE_CREATED_DATE_PROPERTY, creationDate); }
Source:
private BytecodeBlock generateCheckYieldBlock(Variable thisVariable, Variable start, Variable index, FieldDefinition yieldSignal, FieldDefinition nextIndexOrPosition) { return new BytecodeBlock() .comment("if (System.nanoTime() - start > yieldCheckPeriodNanos)") .append(new IfStatement() .condition(greaterThan(subtract(invokeStatic(System.class, "nanoTime", long.class), start), constantLong(yieldCheckPeriodNanos))) .ifTrue(new BytecodeBlock() .comment("if (yieldSignal.isSet())") .append(new IfStatement() .condition(thisVariable.getField(yieldSignal).invoke("isSet", boolean.class)) .ifTrue(new BytecodeBlock() .comment("nextIndexOrPosition = index + 1;") .append(thisVariable.setField(nextIndexOrPosition, add(index, constantInt(1)))) .comment("return false;") .push(false) .retBoolean())))); }

Target:
private BytecodeBlock generateCheckYieldBlock(Variable thisVariable, Variable start, Variable index, FieldDefinition yieldSignal, FieldDefinition nextIndexOrPosition) { BytecodeExpression shouldCheckYieldSignal = greaterThan(subtract(invokeStatic(System.class, "nanoTime", long.class), start), constantLong(yieldCheckPeriodNanos)); BytecodeExpression checkYieldSignal = thisVariable.getField(yieldSignal).invoke("isSet", boolean.class); return new BytecodeBlock() .comment("if (System.nanoTime() - start > yieldCheckPeriodNanos)") .append(new IfStatement() .condition(and(shouldCheckYieldSignal, checkYieldSignal)) .ifTrue(new BytecodeBlock() .comment("nextIndexOrPosition = index + 1;") .append(thisVariable.setField(nextIndexOrPosition, add(index, constantInt(1)))) .comment("return false;") .push(false) .retBoolean())); }
Source:
private void generateActionHttpPost(Method method) { Name name = method.getName(); buffer.addLine("def %1$s(", pythonNames.getMemberStyleName(name)); buffer.startBlock(); buffer.addLine("self,"); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateFormalParameter); buffer.endBlock(); buffer.addLine("):"); buffer.startBlock(); buffer.addLine("buf = io.BytesIO()"); buffer.addLine("writer = xml.XmlWriter(buf, indent=True)"); buffer.addLine("writer.write_start('action')"); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateWriteActionParameter); buffer.addLine("writer.write_end()"); buffer.addLine("writer.flush()"); buffer.addLine("body = buf.getvalue()"); buffer.addLine("writer.close()"); buffer.addLine("buf.close()"); buffer.addLine("request = http.Request("); buffer.startBlock(); buffer.addLine("method='POST',"); buffer.addLine("path='%%s/%%s' %% (self._path, '%1$s'),", getPath(name)); buffer.addLine("body=body,"); buffer.endBlock(); buffer.addLine(")"); buffer.addLine("response = self._connection.send(request)"); buffer.addLine("if response.code in [200]:"); buffer.startBlock(); buffer.addLine("action = self._check_action(response)"); method.parameters() .filter(x -> x.isOut()) .findFirst() .ifPresent(this::generateActionResponse); buffer.endBlock(); buffer.addLine("else:"); buffer.startBlock(); buffer.addLine("self._check_fault(response)"); buffer.endBlock(); buffer.endBlock(); buffer.addLine(); }

Target:
private void generateActionHttpPost(Method method) { Name name = method.getName(); buffer.addLine("def %1$s(", pythonNames.getMemberStyleName(name)); buffer.startBlock(); buffer.addLine("self,"); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateFormalParameter); buffer.endBlock(); buffer.addLine("):"); buffer.startBlock(); buffer.addLine("buf = io.BytesIO()"); buffer.addLine("writer = xml.XmlWriter(buf, indent=True)"); buffer.addLine("writer.write_start('action')"); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateWriteActionParameter); buffer.addLine("writer.write_end()"); buffer.addLine("writer.flush()"); buffer.addLine("body = buf.getvalue()"); buffer.addLine("writer.close()"); buffer.addLine("buf.close()"); buffer.addLine("request = http.Request("); buffer.startBlock(); buffer.addLine("method='POST',"); buffer.addLine("path='%%s/%%s' %% (self._path, '%1$s'),", getPath(name)); buffer.addLine("body=body,"); buffer.endBlock(); buffer.addLine(")"); buffer.addLine("response = self._connection.send(request)"); buffer.addLine("if response.code in [200]:"); buffer.startBlock(); buffer.addLine("action = self._check_action(response)"); method.parameters() .filter(Parameter::isOut) .findFirst() .ifPresent(this::generateActionResponse); buffer.endBlock(); buffer.addLine("else:"); buffer.startBlock(); buffer.addLine("self._check_fault(response)"); buffer.endBlock(); buffer.endBlock(); buffer.addLine(); }
Source:
public void testOneDayDivide() { final Long accountId = 999L; final Long deviceId = 999L; final int light = 2; final int zeroLight = 0; final int offsetMillis = -28800000; final DateTime timestamp = DateTime.now(DateTimeZone.UTC).withHourOfDay(19).withMinuteOfHour(0); final int offMinuteThreshold = 45; final List<DeviceData> data = new ArrayList<>(); data.add(new DeviceData(accountId, deviceId, 0, 0, 0, 0, 0, 0, 0, light,light, 0, 0, timestamp, offsetMillis, 1, 1, 1, 0, 0, 0)); data.add(new DeviceData(accountId, deviceId, 0, 0, 0, 0, 0, 0, 0, zeroLight,zeroLight, 0, 0, timestamp.withMinuteOfHour(10), offsetMillis, 1, 1, 1, 0, 0, 0)); data.add(new DeviceData(accountId, deviceId, 0, 0, 0, 0, 0, 0, 0, zeroLight,zeroLight, 0, 0, timestamp.withMinuteOfHour(30), offsetMillis, 1, 1, 1, 0, 0, 0)); data.add(new DeviceData(accountId, deviceId, 0, 0, 0, 0, 0, 0, 0, zeroLight,zeroLight, 0, 0, timestamp.withMinuteOfHour(45), offsetMillis, 1, 1, 1, 0, 0, 0)); data.add(new DeviceData(accountId, deviceId, 0, 0, 0, 0, 0, 0, 0, zeroLight,zeroLight, 0, 0, timestamp.withHourOfDay(21), offsetMillis, 1, 1, 1, 0, 0, 0)); final Integer calculatedLightDurationList = BedLightDuration.findLightOnDurationForDay(data, offMinuteThreshold); final Integer expectedLightDurationList = light/4; assertThat(calculatedLightDurationList, is(expectedLightDurationList)); }

Target:
public void testOneDayDivide() { final int light = 2; final int zeroLight = 0; final DateTime timestamp = DateTime.now(DateTimeZone.UTC).withHourOfDay(19).withMinuteOfHour(0); final int offMinuteThreshold = 45; final List<DeviceData> data = Lists.newArrayList( createNewDeviceData(light, timestamp), createNewDeviceData(zeroLight, timestamp.withMinuteOfHour(10)), createNewDeviceData(zeroLight, timestamp.withMinuteOfHour(30)), createNewDeviceData(zeroLight, timestamp.withMinuteOfHour(45)), createNewDeviceData(zeroLight, timestamp.withHourOfDay(21)) ); final Integer calculatedLightDurationList = BedLightDuration.findLightOnDurationForDay(data, offMinuteThreshold); final Integer expectedLightDurationList = light/4; assertThat(calculatedLightDurationList, is(expectedLightDurationList)); }
Source:
public void testFileSystemProperties() { String projectID = "projectID"; String jsonKey = "jsonKey"; String path = "path"; String schema = "schema"; String bucket = "bucket"; GCSAvroBatchSink.GCSAvroSinkConfig gcsAvroConfig = new GCSAvroBatchSink.GCSAvroSinkConfig("gcstest", bucket, schema, projectID, jsonKey, null, path); Map<String, String> fsProperties = GSON.fromJson(gcsAvroConfig.getFileSystemProperties(null, projectID, jsonKey), MAP_STRING_STRING_TYPE); Assert.assertNotNull(fsProperties); Assert.assertEquals(3, fsProperties.size()); Assert.assertEquals("gs://bucket/path", fsProperties.get(FileOutputFormat.OUTDIR) ); Assert.assertEquals(projectID, fsProperties.get("fs.gs.project.id")); Assert.assertEquals(jsonKey, fsProperties.get("google.cloud.auth.service.account.json.keyfile")); }

Target:
public void testFileSystemProperties() { String projectId = "projectId"; String jsonKey = "jsonKey"; String path = "path"; String schema = "schema"; String bucket = "bucket"; GCSAvroBatchSink.GCSAvroSinkConfig gcsAvroConfig = new GCSAvroBatchSink.GCSAvroSinkConfig("gcstest", bucket, schema, projectId, jsonKey, null, path); Map<String, String> fsProperties = GSON.fromJson(gcsAvroConfig.getFileSystemProperties(null, projectId, jsonKey), MAP_STRING_STRING_TYPE); Assert.assertNotNull(fsProperties); Assert.assertEquals(5, fsProperties.size()); Assert.assertEquals("gs://bucket/path", fsProperties.get(FileOutputFormat.OUTDIR)); Assert.assertEquals(projectId, fsProperties.get("fs.gs.project.id")); Assert.assertEquals(jsonKey, fsProperties.get("google.cloud.auth.service.account.json.keyfile")); }
Source:
public void testWithoutProxy() throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { keyStoreManager.createNew(f, KEYSTORE_PASSWORD.toCharArray()); final KeyStore ks = keyStoreManager.addCertificates(f, KEYSTORE_PASSWORD.toCharArray(), InetAddress.getLocalHost(), LDAPS_PORT); assertThat(ks.size()).as("localhost should have three certificates in the chain").isEqualTo(1); Map<String, Certificate> certs = keyStoreManager.listCertificates(f, KEYSTORE_PASSWORD.toCharArray()); for (final Map.Entry<String, Certificate> cert : certs.entrySet()) { System.out.println(cert.getKey() + " : " + ((X509Certificate)cert.getValue()).getSubjectDN()); } final String newPassword = "newpassword"; keyStoreManager.changePassword(f, KEYSTORE_PASSWORD.toCharArray(), newPassword.toCharArray()); keyStoreManager.removeCertificates(f, newPassword.toCharArray(), InetAddress.getLocalHost(), LDAPS_PORT); certs = keyStoreManager.listCertificates(f, newPassword.toCharArray()); assertThat(certs.size()).as("Expected empty certs.").isEqualTo(0); }

Target:
public void testWithoutProxy() throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { keyStoreManager.createNew(f, KEYSTORE_PASSWORD.toCharArray()); final KeyStore ks = keyStoreManager.addCertificates(f, KEYSTORE_PASSWORD.toCharArray(), InetAddress.getLocalHost(), LDAPS_PORT); assertThat(ks.size()).as("localhost should have three certificates in the chain").isEqualTo(1); Map<String, Certificate> certs = keyStoreManager.listCertificates(f, KEYSTORE_PASSWORD.toCharArray()); for (final Map.Entry<String, Certificate> cert : certs.entrySet()) { System.out.println(cert.getKey() + " : " + ((X509Certificate)cert.getValue()).getSubjectDN()); } final String newPassword = "newpassword"; keyStoreManager.changePassword(f, KEYSTORE_PASSWORD.toCharArray(), newPassword.toCharArray()); keyStoreManager.removeCertificates(f, newPassword.toCharArray(), InetAddress.getLocalHost(), LDAPS_PORT); certs = keyStoreManager.listCertificates(f, newPassword.toCharArray()); assertThat(certs).as("Expected empty certs.").isEmpty(); }
Source:
public static boolean isFormatCorrect(String blob) throws IOException { final Map<String, String> map = getEncryptionMap(blob); if (map.isEmpty()) { return false; } return ARTIFACT.equals(map.get(ARTIFACT_KEY)) && VERSION.equals(map.get(VERSION_KEY)); }

Target:
public static boolean isFormatCorrect(String blob) throws IOException { final Map<String, String> map = getEncryptionMap(blob); return ARTIFACT.equals(map.get(ARTIFACT_KEY)) && VERSION.equals(map.get(VERSION_KEY)); }
Source:
public Object get(String name) { return getCurrentEntries().get( EvalHelper.normalizeVariableName( name ) ); }

Target:
public Object get(String name) { return getCurrentEntries().get( name ); }
Source:
public void runInControlledConcurrency(Runnable codeblock) { try { if (syncLock.isLocked()) { log.info("Waiting on other task to finish ({} additional threads are queued)", syncLock.getQueueLength()); } syncLock.lock(); codeblock.run(); } finally { syncLock.unlock(); } }

Target:
public void runInControlledConcurrency(Runnable codeblock) { try { if (!syncLock.isHeldByCurrentThread()) { log.info("Waiting on other task to finish ({} additional threads are queued)", syncLock.getQueueLength()); } syncLock.lock(); codeblock.run(); } finally { syncLock.unlock(); } }
Source:
public int queryReplicationStatus() { long maxTail = queryStreamTail(); if (maxTail > prepareSiteRoleChangeStreamTail) { prepareSiteRoleChange(); } long currentNumEntriesToSend = queryEntriesToSend(prepareSiteRoleChangeStreamTail); log.debug("maxTail totalNumEntriesToSend currentNumEntriesToSend {}", maxTail, totalNumEntriesToSend, currentNumEntriesToSend); if (totalNumEntriesToSend == 0 || currentNumEntriesToSend == 0) return PERCENTAGE_BASE; int percent = (int)((totalNumEntriesToSend - currentNumEntriesToSend)*PERCENTAGE_BASE/totalNumEntriesToSend); if (percent == PERCENTAGE_BASE) { percent = PERCENTAGE_BASE - 1; } return percent; }

Target:
public int queryReplicationStatus() { long maxTail = queryStreamTail(); if (maxTail > prepareClusterRoleChangeLogTail) { prepareSiteRoleChange(); } long currentNumEntriesToSend = queryEntriesToSend(prepareClusterRoleChangeLogTail); log.debug("maxTail totalNumEntriesToSend currentNumEntriesToSend {}", maxTail, totalNumEntriesToSend, currentNumEntriesToSend); if (totalNumEntriesToSend == 0 || currentNumEntriesToSend == 0) return PERCENTAGE_BASE; int percent = (int)((totalNumEntriesToSend - currentNumEntriesToSend)*PERCENTAGE_BASE/totalNumEntriesToSend); if (percent == PERCENTAGE_BASE) { percent = PERCENTAGE_BASE - 1; } return percent; }
Source:
public RouterConfig(JsonNode node, String source, boolean logUnusedParams) { NodeAdapter adapter = new NodeAdapter(node, source); this.rawJson = node; this.requestLogFile = adapter.asText("requestLogFile", null); this.streetRoutingTimeoutSeconds = adapter.asDouble( "streetRoutingTimeout", DEFAULT_STREET_ROUTING_TIMEOUT ); this.bikeShareUpdaterEndpoint = adapter.asText( "bikeShareUpdaterEndpoint", null ); this.transitConfig = new TransitRoutingConfig(adapter.path("transit")); this.routingRequestDefaults = mapRoutingRequest(adapter.path("routingDefaults")); this.updaterConfig = new UpdaterConfig(adapter.path("updaters")); if(logUnusedParams) { adapter.logAllUnusedParameters(LOG); } }

Target:
public RouterConfig(JsonNode node, String source, boolean logUnusedParams) { NodeAdapter adapter = new NodeAdapter(node, source); this.rawJson = node; this.requestLogFile = adapter.asText("requestLogFile", null); this.streetRoutingTimeoutSeconds = adapter.asDouble( "streetRoutingTimeout", DEFAULT_STREET_ROUTING_TIMEOUT ); this.bikeRentalServiceDirectoryUrl = adapter.asUri( "bikeRentalServiceDirectoryUrl", null ); this.transitConfig = new TransitRoutingConfig(adapter.path("transit")); this.routingRequestDefaults = mapRoutingRequest(adapter.path("routingDefaults")); this.updaterConfig = new UpdaterConfig(adapter.path("updaters")); if(logUnusedParams) { adapter.logAllUnusedParameters(LOG); } }
Source:
private void apply( Iterable<IndexEntryUpdate<LabelSchemaDescriptor>> updates, IndexUpdateMode updateMode ) throws IOException, IndexEntryConflictException { Map<LabelSchemaDescriptor,List<IndexEntryUpdate<LabelSchemaDescriptor>>> bySchema = new HashMap<>(); for ( IndexEntryUpdate<LabelSchemaDescriptor> indexUpdate : updates ) { List<IndexEntryUpdate<LabelSchemaDescriptor>> forSchema = bySchema.get( indexUpdate.indexKey() ); if ( forSchema == null ) { forSchema = new ArrayList<>(); bySchema.put( indexUpdate.indexKey(), forSchema ); } forSchema.add( indexUpdate ); } for ( Map.Entry<LabelSchemaDescriptor, List<IndexEntryUpdate<LabelSchemaDescriptor>>> entry : bySchema.entrySet() ) { LabelSchemaDescriptor schema = entry.getKey(); try ( IndexUpdater updater = indexMapRef.getIndexProxy( schema ).newUpdater( updateMode ) ) { for ( IndexEntryUpdate<LabelSchemaDescriptor> indexUpdate : entry.getValue() ) { updater.process( indexUpdate ); } } catch ( IndexNotFoundKernelException e ) { } } }

Target:
private void apply( Iterable<IndexEntryUpdate<LabelSchemaDescriptor>> updates, IndexUpdateMode updateMode ) throws IOException, IndexEntryConflictException { try ( IndexUpdaterMap updaterMap = indexMapRef.createIndexUpdaterMap( updateMode ) ) { for ( IndexEntryUpdate<LabelSchemaDescriptor> indexUpdate : updates ) { IndexUpdater updater = updaterMap.getUpdater( indexUpdate.indexKey().schema() ); if ( updater != null ) { updater.process( indexUpdate ); } } } }
Source:
private CallNotPermittedException(CircuitBreaker circuitBreaker, String message, boolean writableStackTrace) { super(message, null, false, writableStackTrace); this.circuitBreaker = circuitBreaker; }

Target:
private CallNotPermittedException(CircuitBreaker circuitBreaker, String message, boolean writableStackTrace) { super(message, null, false, writableStackTrace); this.causingCircuitBreakerName = circuitBreaker.getName(); }
Source:
public void cleanUp(boolean ok, Exception e) { super.cleanUp(ok, e); if (ok) { return; } List<Blob> blobs = new ArrayList<Blob>(); Blob emptyBlob = new AsyncBlob(key); blobs.add(emptyBlob); TransientStore ts = getTransientStore(); ts.putParameter(key, DownloadService.ERROR, e); updateAndCompleteStoreEntry(blobs); }

Target:
public void cleanUp(boolean ok, Exception e) { super.cleanUp(ok, e); if (ok) { return; } List<Blob> blobs = Collections.singletonList(new AsyncBlob(key)); TransientStore ts = getTransientStore(); ts.putParameter(key, DownloadService.TRANSIENT_STORE_PARAM_ERROR, e.getMessage()); updateAndCompleteStoreEntry(blobs); }
Source:
public Response getChargesJson(@PathParam(ACCOUNT_ID) Long accountId, @QueryParam(EMAIL_KEY) String email, @QueryParam(REFERENCE_KEY) String reference, @QueryParam(STATE_KEY) String state, @QueryParam(CARD_BRAND_KEY) String cardBrand, @QueryParam(FROM_DATE_KEY) String fromDate, @QueryParam(TO_DATE_KEY) String toDate, @QueryParam(PAGE) Long pageNumber, @QueryParam(DISPLAY_SIZE) Long displaySize, @Context UriInfo uriInfo, @HeaderParam(FEATURES_HEADER) String features) { List<Pair<String, String>> inputDatePairMap = ImmutableList.of(Pair.of(FROM_DATE_KEY, fromDate), Pair.of(TO_DATE_KEY, toDate)); List<Pair<String, Long>> nonNegativePairMap = ImmutableList.of(Pair.of(PAGE, pageNumber), Pair.of(DISPLAY_SIZE, displaySize)); return ApiValidators .validateQueryParams(inputDatePairMap, nonNegativePairMap) .map(ResponseUtil::badRequestResponse) .orElseGet(() -> reduce(validateGatewayAccountReference(gatewayAccountDao, accountId) .bimap(handleError, listCharges(new ChargeSearchParams() .withGatewayAccountId(accountId) .withEmailLike(email) .withReferenceLike(reference) .withExternalChargeState(state) .withCardBrand(cardBrand) .withFromDate(parseDate(fromDate)) .withToDate(parseDate(toDate)) .withDisplaySize(displaySize != null ? displaySize : configuration.getTransactionsPaginationConfig().getDisplayPageSize()) .withPage(pageNumber != null ? pageNumber : 1), uriInfo, Optional.ofNullable(features))))); }

Target:
public Response getChargesJson(@PathParam(ACCOUNT_ID) Long accountId, @QueryParam(EMAIL_KEY) String email, @QueryParam(REFERENCE_KEY) String reference, @QueryParam(STATE_KEY) String state, @QueryParam(CARD_BRAND_KEY) String cardBrand, @QueryParam(FROM_DATE_KEY) String fromDate, @QueryParam(TO_DATE_KEY) String toDate, @QueryParam(PAGE) Long pageNumber, @QueryParam(DISPLAY_SIZE) Long displaySize, @Context UriInfo uriInfo, @HeaderParam(FEATURES_HEADER) String features) { List<Pair<String, String>> inputDatePairMap = ImmutableList.of(Pair.of(FROM_DATE_KEY, fromDate), Pair.of(TO_DATE_KEY, toDate)); List<Pair<String, Long>> nonNegativePairMap = ImmutableList.of(Pair.of(PAGE, pageNumber), Pair.of(DISPLAY_SIZE, displaySize)); List<String> userFeatures = Optional.ofNullable(features).map(FEATURES_STRING_SPLITTER::splitToList).orElseGet(Collections::emptyList); return ApiValidators .validateQueryParams(inputDatePairMap, nonNegativePairMap) .map(ResponseUtil::badRequestResponse) .orElseGet(() -> reduce(validateGatewayAccountReference(gatewayAccountDao, accountId) .bimap(handleError, listTransactions(new ChargeSearchParams() .withGatewayAccountId(accountId) .withEmailLike(email) .withReferenceLike(reference) .withExternalChargeState(state) .withCardBrand(cardBrand) .withFromDate(parseDate(fromDate)) .withToDate(parseDate(toDate)) .withDisplaySize(displaySize != null ? displaySize : configuration.getTransactionsPaginationConfig().getDisplayPageSize()) .withPage(pageNumber != null ? pageNumber : 1), uriInfo, userFeatures)))); }
Source:
public JClogin() { logger.trace("JClogin(constructor) called."); logger.trace("JClogin(this={}) called.",this); }

Target:
public JClogin() { logger.trace("JClogin(constructor) called."); }
Source:
public void testRemoveVolume() throws Exception { requireDockerApiVersionAtLeast("1.21", "volumes"); final Volume volume1 = sut.createVolume(); sut.removeVolume(volume1); try { sut.removeVolume(volume1); fail("Should not be able to remove a non-existent volume."); } catch (VolumeNotFoundException e) { assertEquals(volume1.name(), e.getVolumeName()); } final Volume volume2 = sut.createVolume(); final HostConfig hostConfig = HostConfig.builder() .binds(Bind.from(volume2).to("/tmp").build()) .build(); final ContainerConfig config = ContainerConfig.builder() .image(BUSYBOX) .hostConfig(hostConfig) .build(); final ContainerCreation container = sut.createContainer(config); try { sut.removeVolume(volume2); fail("Should not be able to remove a volume in use by a container."); } catch (ConflictException ignored) { } sut.removeContainer(container.id()); sut.removeVolume(volume2); }

Target:
public void testRemoveVolume() throws Exception { requireDockerApiVersionAtLeast("1.21", "volumes"); final Volume volume1 = sut.createVolume(); sut.removeVolume(volume1); exception.expect(VolumeNotFoundException.class); exception.expect(volumeNotFoundExceptionWithName(volume1.name())); sut.removeVolume(volume1); final Volume volume2 = sut.createVolume(); final HostConfig hostConfig = HostConfig.builder() .binds(Bind.from(volume2).to("/tmp").build()) .build(); final ContainerConfig config = ContainerConfig.builder() .image(BUSYBOX) .hostConfig(hostConfig) .build(); final ContainerCreation container = sut.createContainer(config); exception.expect(ConflictException.class); sut.removeVolume(volume2); sut.removeContainer(container.id()); sut.removeVolume(volume2); }