auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public AtmosphereResource initialize(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest req, AtmosphereResponse response, AsyncSupport asyncSupport, AtmosphereHandler atmosphereHandler) { this.req = req; this.response = response; this.config = config; this.asyncSupport = asyncSupport; this.atmosphereHandler = atmosphereHandler; this.event = new AtmosphereResourceEventImpl(this); this.broadcaster = broadcaster; uniqueBroadcaster(broadcaster); String s = (String) req.getAttribute(SUSPENDED_ATMOSPHERE_RESOURCE_UUID); if (s == null) { s = response.getHeader(HeaderConfig.X_ATMOSPHERE_TRACKING_ID); if (s == null && req != null) { String tmp = req.getHeader(HeaderConfig.X_ATMOSPHERE_TRACKING_ID); s = tmp != null && !tmp.equalsIgnoreCase("0") ? tmp : null; } } <START> this.setUUID( s == null ? config.uuidProvider().generateUuid() : s ); <END> if (config.isSupportSession()) { try { session = req.getSession(config.getInitParameter(PROPERTY_SESSION_CREATE, true)); } catch (NullPointerException ex) { logger.trace("<LINK_0>", ex); } } transport = configureTransport(); closeOnCancel = config.getInitParameter(ApplicationConfig.CLOSE_STREAM_ON_CANCEL, false); return this; }</code><technical_language>need this</technical_language>

Target:
public AtmosphereResource initialize(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest req, AtmosphereResponse response, AsyncSupport asyncSupport, AtmosphereHandler atmosphereHandler) { this.req = req; this.response = response; this.config = config; this.asyncSupport = asyncSupport; this.atmosphereHandler = atmosphereHandler; this.event = new AtmosphereResourceEventImpl(this); this.broadcaster = broadcaster; uniqueBroadcaster(broadcaster); String s = (String) req.getAttribute(SUSPENDED_ATMOSPHERE_RESOURCE_UUID); if (s == null) { s = response.getHeader(HeaderConfig.X_ATMOSPHERE_TRACKING_ID); if (s == null && req != null) { String tmp = req.getHeader(HeaderConfig.X_ATMOSPHERE_TRACKING_ID); s = tmp != null && !tmp.equalsIgnoreCase("0") ? tmp : null; } } setUUID(s == null ? config.uuidProvider().generateUuid() : s); if (config.isSupportSession()) { try { session = req.getSession(config.getInitParameter(PROPERTY_SESSION_CREATE, true)); } catch (NullPointerException ex) { logger.trace("<LINK_0>", ex); } } transport = configureTransport(); closeOnCancel = config.getInitParameter(ApplicationConfig.CLOSE_STREAM_ON_CANCEL, false); return this; }
Source:
<code>public IValue getInitialValue() { Set<CPPVariable> recursionProtectionSet = fInitialValueInProgress.get(); if (!recursionProtectionSet.add(this)) { return IntegralValue.UNKNOWN; } try { final IValue initialValue = VariableHelpers.getInitialValue(fDefinition, fDeclarations, getType()); final IType nestedType = SemanticUtil.getNestedType(getType(), TDEF | REF | CVTYPE); <START> if(nestedType instanceof ICPPClassType || initialValue == IntegralValue.UNKNOWN) { <END> ICPPEvaluation initEval = getInitializerEvaluation(); if(initEval == null) { return null; } return IntegralValue.create(initEval); } return initialValue; } finally { recursionProtectionSet.remove(this); } }</code><technical_language>If "nestedType instanceof ICPPClassType", initialValue all; avoid computing in case</technical_language>

Target:
public IValue getInitialValue() { Set<CPPVariable> recursionProtectionSet = fInitialValueInProgress.get(); if (!recursionProtectionSet.add(this)) { return IntegralValue.UNKNOWN; } try { IValue initialValue = null; final IType nestedType = SemanticUtil.getNestedType(getType(), TDEF | REF | CVTYPE); if(nestedType instanceof ICPPClassType || (initialValue = VariableHelpers.getInitialValue(fDefinition, fDeclarations, getType())) == IntegralValue.UNKNOWN) { ICPPEvaluation initEval = getInitializerEvaluation(); if(initEval == null) { return null; } return IntegralValue.create(initEval); } return initialValue; } finally { recursionProtectionSet.remove(this); } }
Source:
<code>public double calculateEntropy() { double sum = 0; for (FixedDoubleHistogram.Bucket bucket : histogram) { sum += bucket.getWeight(); } if (sum == 0.0) { return Double.NaN; } double rawEntropy = 0; for (FixedDoubleHistogram.Bucket bucket : histogram) { <START> final double prob = bucket.getWeight() / sum; <END> rawEntropy -= getXLogX(prob); } return (rawEntropy + Math.log(histogram.getWidth())) / Math.log(2); }</code><technical_language>final - inline prob rawEntropy -= getXLogX(bucket.getWeight() / sum);</technical_language>

Target:
public double calculateEntropy() { double sum = 0; for (FixedDoubleHistogram.Bucket bucket : histogram) { sum += bucket.getWeight(); } if (sum == 0.0) { return Double.NaN; } double rawEntropy = 0; for (FixedDoubleHistogram.Bucket bucket : histogram) { rawEntropy -= getXLogX(bucket.getWeight() / sum); } return (rawEntropy + Math.log(histogram.getWidth())) / Math.log(2); }
Source:
<code><START> public Response getUser(@Auth Key key, @QueryParam("username") String username) { <END> StormUser stormUser = thunderClient.getUser(username); FacebookUser facebookUser = new FacebookProvider(stormUser, auth).getFacebookUser(); return Response.ok(facebookUser).build(); }</code><technical_language>add some error handling for username parameter? as: java if (username == null) { return Response.status(Response.Status.BAD_REQUEST) .entity("'username' query parameter is required for getUser").build(); }</technical_language>

Target:
public Response getUser(@Auth Key key, @QueryParam("username") String username) { if (username == null) { return Response.status(Response.Status.BAD_REQUEST) .entity("'username' query parameter is required for getUser").build(); } StormUser stormUser = thunderClient.getUser(username); FacebookUser facebookUser = null; try { facebookUser = new FacebookProvider(stormUser.getFacebookAccessToken(), applicationKey).getFacebookUser(); } catch (FacebookOAuthException e) { LOG.error("Bad Facebook OAuth Token", e); return Response.status(Response.Status.NOT_FOUND) .entity("Request rejected due to bad OAuth token").build(); } return Response.status(Response.Status.ACCEPTED).entity(facebookUser).build(); }
Source:
<code>public SmudgeFilter(Repository db, InputStream in, OutputStream out) throws IOException { super(in, out); <START> lfs = <END> new Lfs(db); LfsPointer res = LfsPointer.parseLfsPointer(in); if (res != null) { AnyLongObjectId oid = res.getOid(); Path mediaFile = lfs.getMediaFile(oid); if (!Files.exists(mediaFile)) { downloadLfsResource(lfs, db, res); } this.in = Files.newInputStream(mediaFile); } }</code><technical_language>Lfs lfs = ... move if delete private *field*</technical_language>

Target:
public SmudgeFilter(Repository db, InputStream in, OutputStream out) throws IOException { super(in, out); Lfs lfs = new Lfs(db); LfsPointer res = LfsPointer.parseLfsPointer(in); if (res != null) { AnyLongObjectId oid = res.getOid(); Path mediaFile = lfs.getMediaFile(oid); if (!Files.exists(mediaFile)) { downloadLfsResource(lfs, db, res); } this.in = Files.newInputStream(mediaFile); } }
Source:
<code>public void run() { long iteration = 0; while (!testContext.isStopped()) { int key = randomKey(); int value = randomValue(); switch (selector.select()) { case PUT: putLatency.started(); map.put(key, value); putLatency.done(); break; case SET: putLatency.started(); map.put(key, value); putLatency.done(); break; case GET: getLatency.started(); map.put(key, value); getLatency.done(); <START> break; <END> default: throw new UnsupportedOperationException(); } if (iteration % logFrequency == 0) { log.info(Thread.currentThread().getName() + " At iteration: " + iteration); } if (iteration % performanceUpdateFrequency == 0) { operations.addAndGet(performanceUpdateFrequency); } iteration++; throughput.done(); } operations.addAndGet(iteration % performanceUpdateFrequency); }</code><technical_language>put set get measured probe</technical_language>

Target:
public void run() { long iteration = 0; while (!testContext.isStopped()) { int key = randomKey(); int value = randomValue(); switch (selector.select()) { case PUT: putLatency.started(); if (useSet) { map.set(key, value); } else { map.put(key, value); } putLatency.done(); break; case GET: getLatency.started(); map.put(key, value); getLatency.done(); break; default: throw new UnsupportedOperationException(); } iteration++; if (iteration % logFrequency == 0) { log.info(Thread.currentThread().getName() + " At iteration: " + iteration); } if (iteration % performanceUpdateFrequency == 0) { operations.addAndGet(performanceUpdateFrequency); } throughput.done(); } operations.addAndGet(iteration % performanceUpdateFrequency); }
Source:
<code>private void writeNotification(AttributeChangeNotification notification, Path path) { try (BufferedWriter in = Files.newBufferedWriter(path, StandardCharsets.UTF_8, StandardOpenOption.APPEND)) { in.write(String.format("%s %s %s %s", notification.getType(), notification.getSequenceNumber(), notification.getSource().toString(), notification.getMessage())); in.newLine(); in.flush(); } catch (ClosedByInterruptException cbie) { <START> Thread.interrupted(); <END> Logger.getLogger(ControlledStateNotificationListener.class).error("We were interrupted and couldn't write into file, try again", cbie); try (BufferedWriter in = Files.newBufferedWriter(path, StandardCharsets.UTF_8, StandardOpenOption.APPEND)) { in.write(String.format("%s %s %s %s", notification.getType(), notification.getSequenceNumber(), notification.getSource().toString(), notification.getMessage())); in.newLine(); in.flush(); } catch(IOException ex2) { Logger.getLogger(ControlledStateNotificationListener.class).error("No success on second attempt either", ex2); } } catch (IOException ex) { Logger.getLogger(ControlledStateNotificationListener.class).error("Problem handling JMX Notification", ex); } }</code><technical_language>If this returns true interrupt thread in a finally block. server wanted thread interrupted respected</technical_language>

Target:
private void writeNotification(AttributeChangeNotification notification, Path path) { try (BufferedWriter in = Files.newBufferedWriter(path, StandardCharsets.UTF_8, StandardOpenOption.APPEND)) { in.write(String.format("%s %s %s %s", notification.getType(), notification.getSequenceNumber(), notification.getSource().toString(), notification.getMessage())); in.newLine(); in.flush(); } catch (ClosedByInterruptException cbie) { boolean wasInterrupted = Thread.interrupted(); try { Logger.getLogger(ControlledStateNotificationListener.class) .error("We were interrupted and couldn't write into file, try again", cbie); try (BufferedWriter in = Files .newBufferedWriter(path, StandardCharsets.UTF_8, StandardOpenOption.APPEND)) { in.write(String.format("%s %s %s %s", notification.getType(), notification.getSequenceNumber(), notification.getSource().toString(), notification.getMessage())); in.newLine(); in.flush(); } catch (IOException ex2) { Logger.getLogger(ControlledStateNotificationListener.class) .error("No success on second attempt either", ex2); } } finally { if(wasInterrupted) Thread.currentThread().interrupt(); } } catch (IOException ex) { Logger.getLogger(ControlledStateNotificationListener.class).error("Problem handling JMX Notification", ex); } }
Source:
<code>private void downloadFileAndRenderPdf() { mFileDownloader.downloadFile(mItem.getUrl(), PDF_MIME_TYPE, new FileDownloader.FileDownloaderCallback() { @Override public void onFailure(IOException e) { <START> } <END> @Override public void onSuccess(String filePath) { reloadUrl(PDF_LOADER_URL, filePath); } }); }</code><technical_language>fall flow prompt user open in another app? show a toast</technical_language>

Target:
private void downloadFileAndRenderPdf() { mFileDownloader.downloadFile(mItem.getUrl(), PDF_MIME_TYPE, new FileDownloader.FileDownloaderCallback() { @Override public void onFailure(Call call, IOException e) { offerExternalApp(); } @Override public void onSuccess(String filePath) { reloadUrl(PDF_LOADER_URL, filePath); } }); }
Source:
<code>@Override protected SqlParserImplFactory parserImplFactory() { <START> return null; <END> }</code><technical_language>return a null factory</technical_language>

Target:
@Override protected SqlParserImplFactory parserImplFactory() { return ExtensionSqlParserImpl.FACTORY; }
Source:
<code>private void startLookups(final List<LookupBean> lookupBeanList) { ImmutableMap.Builder<String, LookupExtractorFactoryContainer> builder = ImmutableMap.builder(); ExecutorService executorService = Execs.multiThreaded( lookupConfig.getNumLookupLoadingThreads(), "LookupReferencesManager-Startup-%s" ); CompletionService<Map.Entry<String, LookupExtractorFactoryContainer>> completionService = new ExecutorCompletionService<>(executorService); try { LOG.info("Starting lookup loading process"); List<LookupBean> remainingLookups = lookupBeanList; for (int i = 0; i < lookupConfig.getLookupStartRetries(); i++) { LOG.info("Round of attempts #%d, [%d] lookups", i + 1, remainingLookups.size()); Map<String, LookupExtractorFactoryContainer> successfulLookups = startLookups(remainingLookups, completionService); builder.putAll(successfulLookups); List<LookupBean> failedLookups = remainingLookups .stream() .filter(l -> !successfulLookups.containsKey(l.getName())) .collect(Collectors.toList()); if (failedLookups.isEmpty()) { break; } else { remainingLookups = failedLookups; } } stateRef.set(new LookupUpdateState(builder.build(), ImmutableList.of(), ImmutableList.of())); <START> } <END> catch (InterruptedException | RuntimeException e) { LOG.error(e, "Failed to finish lookup load process."); } finally { executorService.shutdownNow(); } }</code><technical_language>in end log failed lookups able load retries</technical_language>

Target:
private void startLookups(final List<LookupBean> lookupBeanList) { ImmutableMap.Builder<String, LookupExtractorFactoryContainer> builder = ImmutableMap.builder(); ExecutorService executorService = Execs.multiThreaded( lookupConfig.getNumLookupLoadingThreads(), "LookupReferencesManager-Startup-%s" ); CompletionService<Map.Entry<String, LookupExtractorFactoryContainer>> completionService = new ExecutorCompletionService<>(executorService); try { LOG.info("Starting lookup loading process"); List<LookupBean> remainingLookups = lookupBeanList; for (int i = 0; i < lookupConfig.getLookupStartRetries(); i++) { LOG.info("Round of attempts #%d, [%d] lookups", i + 1, remainingLookups.size()); Map<String, LookupExtractorFactoryContainer> successfulLookups = startLookups(remainingLookups, completionService); builder.putAll(successfulLookups); List<LookupBean> failedLookups = remainingLookups .stream() .filter(l -> !successfulLookups.containsKey(l.getName())) .collect(Collectors.toList()); if (failedLookups.isEmpty()) { break; } else { remainingLookups = failedLookups; } } LOG.info( "Failed to start the following lookups after [%d] attempts: [%s]", lookupConfig.getLookupStartRetries(), remainingLookups ); stateRef.set(new LookupUpdateState(builder.build(), ImmutableList.of(), ImmutableList.of())); } catch (InterruptedException | RuntimeException e) { LOG.error(e, "Failed to finish lookup load process."); } finally { executorService.shutdownNow(); } }
Source:
<code>public void annotate(PsiElement element, AnnotationHolder holder) { <START> PsiFile file = element.getContainingFile(); <END> Long analyzedFileTime = file.getUserData(HaxeSemanticError.KEY_ANALYZED_METHOD_TIME); if (analyzedFileTime == null || analyzedFileTime != file.getModificationStamp()) { analyze(file); file.putUserData(HaxeSemanticError.KEY_ANALYZED_METHOD_TIME, file.getModificationStamp()); } List<HaxeSemanticError> errors = element.getUserData(HaxeSemanticError.KEY_HAXE_ERROR); if (errors != null) { for (HaxeSemanticError error : errors) { Annotation annotation = holder.createErrorAnnotation(element, error.message); if (error.quickfix != null) annotation.registerFix(error.quickfix); } } }</code><technical_language>This version of annotate is (obviously) called for element in PSI. However, want process once, file time. file-based version of this interface, ExternalAnnotator, is more appropriate. ExternalAnnotators run immediately simple annotators</technical_language>

Target:
public void annotate(PsiElement element, AnnotationHolder holder) { analyzeSingle(element, holder); }
Source:
<code>public void run(IAction action) { IReviewItem item = compareSourceViewer.getAnnotationModel().getItem(); ReviewBehavior reviewBehavior = compareSourceViewer.getAnnotationModel().getBehavior(); <START> if (item.getReview() != null && item.getReview().getRepository() != null <END> && item.getReview().getRepository().getAccount() != null) { AddCommentDialog dialog = new AddCommentDialog(WorkbenchUtil.getShell(), reviewBehavior, item, getLocation()); dialog.open(); } else { MessageDialog.openError(WorkbenchUtil.getShell(), "Can't Add Comments", "Anonymous users cannot comment on a review. Please log in to perform this action."); } }</code><technical_language>simply disable action</technical_language>

Target:
public void run(IAction action) { IReviewItem item = getItem(); ReviewBehavior reviewBehavior = compareSourceViewer.getAnnotationModel().getBehavior(); AddCommentDialog dialog = new AddCommentDialog(WorkbenchUtil.getShell(), reviewBehavior, item, getLocation()); dialog.open(); }
Source:
<code>private boolean setOwningPlayerInternal(OfflinePlayer owningPlayer) { if (owningPlayer instanceof GlowOfflinePlayer) { GlowOfflinePlayer impl = (GlowOfflinePlayer) owningPlayer; this.owner.set(impl.getProfile()); return true; <START> } else { <END> CompletableFuture<PlayerProfile> profileFuture = PlayerProfile .getProfile(owningPlayer.getName()); PlayerProfile profile = profileFuture.getNow(null); if (profile != null) { this.owner.set(profile); return true; } else { profileFuture.thenAcceptAsync(this.owner::set); return false; } } }</code><technical_language>owningPlayer a GlowPlayer (which extend GlowOfflinePlayer)</technical_language>

Target:
private boolean setOwningPlayerInternal(OfflinePlayer owningPlayer) { if (owningPlayer instanceof GlowOfflinePlayer) { GlowOfflinePlayer impl = (GlowOfflinePlayer) owningPlayer; this.owner.set(impl.getProfile()); return true; } else if (owningPlayer instanceof GlowPlayer) { this.owner.set(((GlowPlayer) owningPlayer).getProfile()); return true; } else { CompletableFuture<PlayerProfile> profileFuture = PlayerProfile .getProfile(owningPlayer.getName()); PlayerProfile profile = profileFuture.getNow(null); if (profile != null) { this.owner.set(profile); return true; } else { profileFuture.thenAcceptAsync(this.owner::set); return false; } } }
Source:
<code><START> private List<String> createSocketBindings() throws CommandFailedException, IOException { <END> final List<String> socketBindingNames = new LinkedList<>(); for (int i = 0; i < count; i++) { String name = generateName(); Address remoteSocketBindingAddress = this.socketBindingGroupAddress.and("remote-destination-outbound-socket-binding", name); operations.add(remoteSocketBindingAddress, Values.of("host", "el-policy-host_" + RandomStringUtils.randomAlphanumeric(5)) .and("port", AvailablePortFinder.getNextAvailableNonPrivilegedPort())).assertSuccess(); socketBindingNames.add(name); } return socketBindingNames; }</code><technical_language>throws CommandFailedException</technical_language>

Target:
private List<String> createSocketBindings() throws IOException { final List<String> socketBindingNames = new LinkedList<>(); for (int i = 0; i < count; i++) { String name = generateName(); Address remoteSocketBindingAddress = this.socketBindingGroupAddress.and(SOCKET_BINDING_TYPE, name); operations.add(remoteSocketBindingAddress, Values.of("host", "el-policy-host_" + RandomStringUtils.randomAlphanumeric(5)) .and("port", AvailablePortFinder.getNextAvailableNonPrivilegedPort())).assertSuccess(); socketBindingNames.add(name); } return socketBindingNames; }
Source:
<code>public static Query readAll(Class<? extends Message> entityClass, String... paths) { <START> final FieldMask fieldMask = paths != null ? <END> FieldMask.newBuilder() .addAllPaths(Arrays.asList(paths)) .build() : null; final Query result = composeQuery(entityClass, null, fieldMask); return result; }</code><technical_language>Please update @ParametersAreNonnullByDefault</technical_language>

Target:
public static Query readAll(Class<? extends Message> entityClass, String... paths) { final FieldMask fieldMask = FieldMask.newBuilder() .addAllPaths(Arrays.asList(paths)) .build(); final Query result = composeQuery(entityClass, null, fieldMask); return result; }
Source:
<code>private void checkVideoStatus(VideoBlockModel unit) { final DownloadEntry entry = unit.getDownloadEntry(environment.getStorage()); if (entry == null) return; if (entry.isDownload()) { if (entry.isVideoForWebOnly) { Toast.makeText(getActivity(), getString(R.string.video_only_on_web_short), Toast.LENGTH_SHORT).show(); return; } if (!entry.isDownloaded()) { IDialogCallback dialogCallback = new IDialogCallback() { @Override public void onPositiveClicked() { startOnlinePlay(entry); } @Override public void onNegativeClicked() { ((BaseFragmentActivity) getActivity()). showInfoMessage(getString(R.string.wifi_off_message)); notifyAdapter(); } }; MediaConsentUtils.consentToMediaPlayback(getActivity(), dialogCallback, environment.getConfig()); } else { <START> if (playerFragment != null && !playerFragment.isFrozen()) { <END> startOnlinePlay(entry); } } } }</code><technical_language>This converted a else if condition I guess. Also, setUserVisibleHint() called onActivityCreated(), playerFragment initialized, is need for null check. performed in a lot of other places though, removed fine is I guess</technical_language>

Target:
private void checkVideoStatus(VideoBlockModel unit) { final DownloadEntry entry = unit.getDownloadEntry(environment.getStorage()); if (entry == null) return; if (entry.isDownload()) { if (entry.isVideoForWebOnly) { Toast.makeText(getActivity(), getString(R.string.video_only_on_web_short), Toast.LENGTH_SHORT).show(); return; } if (!entry.isDownloaded()) { IDialogCallback dialogCallback = new IDialogCallback() { @Override public void onPositiveClicked() { startOnlinePlay(entry); } @Override public void onNegativeClicked() { ((BaseFragmentActivity) getActivity()). showInfoMessage(getString(R.string.wifi_off_message)); notifyAdapter(); } }; MediaConsentUtils.consentToMediaPlayback(getActivity(), dialogCallback, environment.getConfig()); } else if (playerFragment != null && !playerFragment.isFrozen()) { startOnlinePlay(entry); } } }
Source:
<code>public Optional<Float> calculateAverageSensorState(final List<Sample> samples, final long startTimestampUTC, final long endTimestampUTC) { if (samples.isEmpty() || (startTimestampUTC == endTimestampUTC)) { return Optional.absent(); } float sum = 0; int count = 0; for (final Sample sample : samples) { final long sampleTimestampUTC = sample.dateTime; if (sampleTimestampUTC < startTimestampUTC) { continue; } if (sampleTimestampUTC > endTimestampUTC) { break; } sum += sample.value; count++; } <START> final float average = sum / count; <END> return Optional.of(average); }</code><technical_language>check for if (count == 0)</technical_language>

Target:
public Optional<Float> calculateAverageSensorState(final List<Sample> samples, final long startTimestampUTC, final long endTimestampUTC) { if (samples.isEmpty() || (startTimestampUTC == endTimestampUTC)) { return Optional.absent(); } float sum = 0; int count = 0; for (final Sample sample : samples) { final long sampleTimestampUTC = sample.dateTime; if (sampleTimestampUTC < startTimestampUTC) { continue; } if (sampleTimestampUTC > endTimestampUTC) { break; } sum += sample.value; count++; } if (count > 0) { final float average = sum / count; return Optional.of(average); } else { return Optional.absent(); } }
Source:
<code>static boolean mongoInsertLectureIntoCourse(final DB dbs, final String courseId, final String lectureId) throws AuthenticationException, DatabaseAccessException { final DBCollection collection = dbs.getCollection(getCollectionFromType(School.ItemType.COURSE)); final DBObject cursor = collection.findOne(convertStringToObjectId(courseId)); DBObject updateObj = null; <START> final DBCollection courses = dbs.getCollection(getCollectionFromType(School.ItemType.COURSE)); <END> updateObj = new BasicDBObject(LECTURE_LIST, lectureId); courses.update(cursor, new BasicDBObject(ADD_SET_COMMAND, updateObj)); UserUpdateHandler.insertUpdates(dbs, ((List) cursor.get(USERS)), courseId, UserUpdateHandler.COURSE_CLASSIFICATION); return true; }</code><technical_language>is this object is a copy of collection? collection</technical_language>

Target:
static boolean mongoInsertLectureIntoCourse(final DB dbs, final String courseId, final String lectureId) throws AuthenticationException, DatabaseAccessException { final DBCollection courseCollection = dbs.getCollection(getCollectionFromType(School.ItemType.COURSE)); final DBObject cursor = courseCollection.findOne(convertStringToObjectId(courseId)); DBObject updateObj = null; updateObj = new BasicDBObject(LECTURE_LIST, lectureId); courseCollection.update(cursor, new BasicDBObject(ADD_SET_COMMAND, updateObj)); UserUpdateHandler.insertUpdates(dbs, ((List) cursor.get(USERS)), courseId, UserUpdateHandler.COURSE_CLASSIFICATION); return true; }
Source:
<code>public GrpcBackedQueryUpdateMessage(QueryUpdate queryUpdate, Serializer serializer) { this.queryUpdate = queryUpdate; <START> this.serializedPayload = <END> new LazyDeserializingObject<>(new GrpcSerializedObject(queryUpdate.getPayload()), serializer); this.metaDataSupplier = new GrpcMetaData(queryUpdate.getMetaDataMap(), serializer); }</code><technical_language>invoked primary private constructor</technical_language>

Target:
public GrpcBackedQueryUpdateMessage(QueryUpdate queryUpdate, Serializer serializer) { this( queryUpdate, new LazyDeserializingObject<>(new GrpcSerializedObject(queryUpdate.getPayload()), serializer), new GrpcMetaData(queryUpdate.getMetaDataMap(), serializer) ); }
Source:
<code>public String scheduleACronJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, String cronExpression, Date startAt, <START> Date endBy) { <END> JobDetail job = createJobWithBasicMapValues(instance, methodName, inputTypes, inputParams); try { String triggerName = generateUniqueNameForInstance(instance, TRIGGER_PREFIX); Trigger trigger = newTrigger() .withIdentity(triggerName, Scheduler.DEFAULT_GROUP) .withSchedule(cronSchedule(cronExpression)) .startAt(startAt) .endAt(endBy) .build(); sched.scheduleJob(job, trigger); } catch (Exception se) { log.error("failed to schedule job: {}", se.getMessage()); log.debug("Exception", se); } return job.getKey().getName(); }</code><technical_language>Validations startAt < endBy, startAt > etc</technical_language>

Target:
public String scheduleACronJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, String cronExpression, Date startAt, Date endBy) { JobDetail job = createJobWithBasicMapValues(instance, methodName, inputTypes, inputParams); try { String triggerName = generateUniqueNameForInstance(instance, TRIGGER_PREFIX); Trigger trigger = newTrigger() .withIdentity(triggerName, Scheduler.DEFAULT_GROUP) .withSchedule(cronSchedule(cronExpression)) .startAt(startAt) .endAt(endBy) .build(); sched.scheduleJob(job, trigger); } catch (Exception se) { log.error("failed to schedule job: {}", se.getMessage()); log.debug("Exception", se); return null; } return job.getKey().getName(); }
Source:
<code>private void checkConstraints(Element annotatedElement, List<AnnotationMirror> mirrors) { for ( AnnotationMirror oneAnnotationMirror : mirrors ) { try { ConstraintChecks constraintChecks = constraintCheckFactory.getConstraintChecks( annotatedElement, oneAnnotationMirror ); Set<ConstraintCheckIssue> errors = constraintChecks.execute( annotatedElement, oneAnnotationMirror ); <START> Map<Class, Set<ConstraintCheckIssue>> issues = errors.stream().collect( Collectors.groupingBy( issue -> issue.getClass(), Collectors.toSet() ) ); <END> messager.reportErrors( issues.getOrDefault( ConstraintCheckError.class, Collections.emptySet() ) ); messager.reportWarnings( issues.getOrDefault( ConstraintCheckWarning.class, Collections.emptySet() ) ); } catch (Exception e) { if ( verbose ) { messager.getDelegate() .printMessage( Kind.NOTE, e.getMessage() != null ? e.getMessage() : e.toString(), annotatedElement, oneAnnotationMirror ); } } } }</code><technical_language>Instead of sub-types, add getKind() ConstraintCheckError (renaming is a good idea though) this kind reporting diagnostic</technical_language>

Target:
private void checkConstraints(Element annotatedElement, List<AnnotationMirror> mirrors) { for ( AnnotationMirror oneAnnotationMirror : mirrors ) { try { ConstraintChecks constraintChecks = constraintCheckFactory.getConstraintChecks( annotatedElement, oneAnnotationMirror ); Set<ConstraintCheckIssue> allIssues = constraintChecks.execute( annotatedElement, oneAnnotationMirror ); Set<ConstraintCheckIssue> warnings = CollectionHelper.newHashSet(); Set<ConstraintCheckIssue> errors = CollectionHelper.newHashSet(); for ( ConstraintCheckIssue issue : allIssues ) { if ( issue.isError() ) { errors.add( issue ); } else if ( issue.isWarning() ) { warnings.add( issue ); } } messager.reportErrors( errors ); messager.reportWarnings( warnings ); } catch (Exception e) { if ( verbose ) { messager.getDelegate() .printMessage( Kind.NOTE, e.getMessage() != null ? e.getMessage() : e.toString(), annotatedElement, oneAnnotationMirror ); } } } }
Source:
<code>public static void beforeClass() throws Exception { locatorProperties = new Properties(); locatorProperties.setProperty(MAX_WAIT_TIME_RECONNECT, "15000"); locator = cluster.startLocatorVM(0, locatorProperties); Properties props = new Properties(); <START> props.setProperty("statistic-archive-file", "stats1.gfs"); <END> server1 = cluster.startRedisVM(1, props, locator.getPort()); props.setProperty("statistic-archive-file", "stats2.gfs"); server2 = cluster.startRedisVM(2, props, locator.getPort()); props.setProperty("statistic-archive-file", "stats3.gfs"); server3 = cluster.startRedisVM(3, props, locator.getPort()); props.setProperty("statistic-archive-file", "stats4.gfs"); server4 = cluster.startRedisVM(4, props, locator.getPort()); props.setProperty("statistic-archive-file", "stats5.gfs"); server5 = cluster.startServerVM(5, props, locator.getPort()); redisServerPort1 = cluster.getRedisPort(1); redisServerPort2 = cluster.getRedisPort(2); redisServerPort3 = cluster.getRedisPort(3); redisServerPort4 = cluster.getRedisPort(4); subscriber1 = new Jedis(LOCAL_HOST, redisServerPort1, 120000); subscriber2 = new Jedis(LOCAL_HOST, redisServerPort2, 120000); publisher1 = new Jedis(LOCAL_HOST, redisServerPort3, 120000); publisher2 = new Jedis(LOCAL_HOST, redisServerPort4, 120000); gfsh.connectAndVerify(locator); }</code><technical_language>remove stats file config</technical_language>

Target:
public static void beforeClass() throws Exception { locatorProperties = new Properties(); locatorProperties.setProperty(MAX_WAIT_TIME_RECONNECT, "15000"); locator = cluster.startLocatorVM(0, locatorProperties); server1 = cluster.startRedisVM(1, locator.getPort()); server2 = cluster.startRedisVM(2, locator.getPort()); server3 = cluster.startRedisVM(3, locator.getPort()); server4 = cluster.startRedisVM(4, locator.getPort()); server5 = cluster.startServerVM(5, locator.getPort()); for (VM v : Host.getHost(0).getAllVMs()) { v.invoke(() -> { Logger logger = LogService.getLogger("org.apache.geode.redis"); Configurator.setAllLevels(logger.getName(), Level.getLevel("DEBUG")); FastLogger.setDelegating(true); }); } redisServerPort1 = cluster.getRedisPort(1); redisServerPort2 = cluster.getRedisPort(2); redisServerPort3 = cluster.getRedisPort(3); redisServerPort4 = cluster.getRedisPort(4); subscriber1 = new Jedis(LOCAL_HOST, redisServerPort1, 120000); subscriber2 = new Jedis(LOCAL_HOST, redisServerPort2, 120000); publisher1 = new Jedis(LOCAL_HOST, redisServerPort3, 120000); publisher2 = new Jedis(LOCAL_HOST, redisServerPort4, 120000); gfsh.connectAndVerify(locator); }
Source:
<code>public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager manager) { bbd.addAnnotatedType(manager.createAnnotatedType(TracerProducer.class), TracerProducer.class.toString()); <START> bbd.addAnnotatedType(manager.createAnnotatedType(SmallRyeTracingCDIInterceptor.class), SmallRyeTracingCDIInterceptor.class.toString()); <END> }</code><technical_language>Is simply class name practice? In other example of this I see, #10899, @stuartwdouglas incorporated extension name in id. I difference in this case though</technical_language>

Target:
public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager manager) { String extensionName = TracingCDIExtension.class.getName(); bbd.addAnnotatedType(manager.createAnnotatedType(TracerProducer.class), extensionName + "-" + TracerProducer.class.getName()); bbd.addAnnotatedType(manager.createAnnotatedType(SmallRyeTracingCDIInterceptor.class), extensionName + "-" + SmallRyeTracingCDIInterceptor.class.getName()); }
Source:
<code>protected void addItemFactory(ItemFactory itemFactory) { itemFactories.add(itemFactory); if (failedToCreate.size() > 0) { Iterator<ItemInfo> iterator = failedToCreate.iterator(); while (iterator.hasNext()) { ItemInfo itemInfo = iterator.next(); Item item = itemFactory.createItem(itemInfo.itemType, itemInfo.itemName); if (item != null) { iterator.remove(); notifyListenersAboutAddedElement(item); } else { <START> logger.debug("The added item factotry '{}' still could not instantiate item '{}'.", itemFactory, <END> itemInfo.itemName); } } if (failedToCreate.isEmpty()) { logger.info("Finished loading all items that could not have been created before."); } } }</code><technical_language>typo: factotry</technical_language>

Target:
protected void addItemFactory(ItemFactory itemFactory) { itemFactories.add(itemFactory); if (failedToCreate.size() > 0) { Iterator<ItemInfo> iterator = failedToCreate.iterator(); while (iterator.hasNext()) { ItemInfo itemInfo = iterator.next(); Item item = itemFactory.createItem(itemInfo.itemType, itemInfo.itemName); if (item != null) { iterator.remove(); notifyListenersAboutAddedElement(item); } else { logger.debug("The added item factory '{}' still could not instantiate item '{}'.", itemFactory, itemInfo.itemName); } } if (failedToCreate.isEmpty()) { logger.info("Finished loading the items which could not have been created before."); } } }
Source:
<code>public void removeWorkspaceChatRoom(WorkspaceEntity workspaceEntity) { String openfireToken = pluginSettingsController.getPluginSetting("chat", "openfireToken"); if (openfireToken == null) { logger.log(Level.INFO, "No openfire token set, skipping room sync"); return; } String openfireUrl = pluginSettingsController.getPluginSetting("chat", "openfireUrl"); if (openfireUrl == null) { logger.log(Level.INFO, "No openfire url set, skipping room sync"); return; } String openfirePort = pluginSettingsController.getPluginSetting("chat", "openfirePort"); if (openfirePort == null) { logger.log(Level.INFO, "No openfire port set, skipping room sync"); return; } if (!StringUtils.isNumeric(openfirePort)) { logger.log(Level.WARNING, "Invalid openfire port, skipping room sync"); return; } AuthenticationToken token = new AuthenticationToken(openfireToken); RestApiClient client = new RestApiClient(openfireUrl, Integer.parseInt(openfirePort, 10), token); <START> Workspace workspace = workspaceController.findWorkspace(workspaceEntity); <END> String roomName = workspace.getIdentifier(); client.deleteChatRoom(roomName); }</code><technical_language>identifier in workspaceEntity (Muikku's representation of a course) is exact identifier in Workspace (Pyramus' representation of a course) instead of... Workspace workspace = workspaceController.findWorkspace(workspaceEntity); String roomName = workspace.getIdentifier(); client.deleteChatRoom(roomName); ...you do just... client.deleteChatRoom(workspaceEntity.getIdentifier()); ...so server call Pyramus</technical_language>

Target:
public void removeWorkspaceChatRoom(WorkspaceEntity workspaceEntity) { String openfireToken = pluginSettingsController.getPluginSetting("chat", "openfireToken"); if (openfireToken == null) { logger.log(Level.INFO, "No openfire token set, skipping room sync"); return; } String openfireUrl = pluginSettingsController.getPluginSetting("chat", "openfireUrl"); if (openfireUrl == null) { logger.log(Level.INFO, "No openfire url set, skipping room sync"); return; } String openfirePort = pluginSettingsController.getPluginSetting("chat", "openfirePort"); if (openfirePort == null) { logger.log(Level.INFO, "No openfire port set, skipping room sync"); return; } if (!StringUtils.isNumeric(openfirePort)) { logger.log(Level.WARNING, "Invalid openfire port, skipping room sync"); return; } AuthenticationToken token = new AuthenticationToken(openfireToken); RestApiClient client = new RestApiClient(openfireUrl, Integer.parseInt(openfirePort, 10), token); client.deleteChatRoom(workspaceEntity.getIdentifier()); }
Source:
<code>public boolean categoryMembersContainerIsVisible() { wait.forElementVisible(categoryMembersContainer); <START> PageObjectLogging.logInfo("Category sections container is visible."); <END> return true; }</code><technical_language>"Category members container"</technical_language>

Target:
public boolean categoryMembersContainerIsVisible() { wait.forElementVisible(categoryMembersContainer); PageObjectLogging.logInfo("Category members container is visible."); return true; }
Source:
<code>private CompletableFuture<byte[]> generateThumbnail(NetworkAccess network, AsyncReader fileData, int fileSize, String filename) { CompletableFuture<byte[]> fut = new CompletableFuture<>(); if (fileSize > MimeTypes.HEADER_BYTES_TO_IDENTIFY_MIME_TYPE) { getFileType(fileData).thenAccept(type -> { if (type == FileType.Image) { if (network.isJavascript()) { thumbnail.generateThumbnail(fileData, fileSize, filename).thenAccept(base64Str -> { byte[] bytesOfData = Base64.getDecoder().decode(base64Str); fut.complete(bytesOfData); }); } else { byte[] bytes = new byte[fileSize]; fileData.readIntoArray(bytes, 0, fileSize).thenAccept(data -> { fut.complete(generateThumbnail(bytes)); }); } }else if(type == FileType.Video) { <START> if (network.isJavascript()) { <END> thumbnail.generateVideoThumbnail(fileData, fileSize, filename).thenAccept(base64Str -> { byte[] bytesOfData = Base64.getDecoder().decode(base64Str); fut.complete(bytesOfData); }); } else { byte[] bytes = new byte[fileSize]; fileData.readIntoArray(bytes, 0, fileSize).thenAccept(data -> { fut.complete(generateVideoThumbnail(bytes)); }); } } else { fut.complete(new byte[0]); } }); } else { fut.complete(new byte[0]); } return fut; }</code><technical_language>This is interface, say, VideoThumbnailGenerator put instance of in UserContext</technical_language>

Target:
private CompletableFuture<byte[]> generateThumbnail(NetworkAccess network, AsyncReader fileData, int fileSize, String filename) { CompletableFuture<byte[]> fut = new CompletableFuture<>(); if (fileSize > MimeTypes.HEADER_BYTES_TO_IDENTIFY_MIME_TYPE) { getFileType(fileData).thenAccept(mimeType -> { if (mimeType.startsWith("image")) { if (network.isJavascript()) { thumbnail.generateThumbnail(fileData, fileSize, filename).thenAccept(base64Str -> { byte[] bytesOfData = Base64.getDecoder().decode(base64Str); fut.complete(bytesOfData); }); } else { byte[] bytes = new byte[fileSize]; fileData.readIntoArray(bytes, 0, fileSize).thenAccept(data -> { fut.complete(generateThumbnail(bytes)); }); } }else if(mimeType.startsWith("video")) { if (network.isJavascript()) { thumbnail.generateVideoThumbnail(fileData, fileSize, filename).thenAccept(base64Str -> { byte[] bytesOfData = Base64.getDecoder().decode(base64Str); fut.complete(bytesOfData); }); } else { byte[] bytes = new byte[fileSize]; fileData.readIntoArray(bytes, 0, fileSize).thenAccept(data -> { fut.complete(generateVideoThumbnail(bytes)); }); } } else { fut.complete(new byte[0]); } }); } else { fut.complete(new byte[0]); } return fut; }
Source:
<code>public VolumeListModel() { setTitle(ConstantsManager.getInstance().getConstants().volumesTitle()); setDefaultSearchString("Volumes:"); setSearchString(getDefaultSearchString()); setSearchObjects(new String[] { SearchObjects.GLUSTER_VOLUME_OBJ_NAME, SearchObjects.GLUSTER_VOLUME_PLU_OBJ_NAME }); setAvailableInModes(ApplicationMode.GlusterOnly); setCreateVolumeCommand(new UICommand("Create Volume", this)); setRemoveVolumeCommand(new UICommand("Remove", this)); setStartCommand(new UICommand("Start", this)); setStopCommand(new UICommand("Stop", this)); <START> setStartRebalanceCommand(new UICommand("Rebalance", this)); END> setOptimizeForVirtStoreCommand(new UICommand("OptimizeForVirtStore", this)); getStartRebalanceCommand().setIsAvailable(true); getRemoveVolumeCommand().setIsExecutionAllowed(false); getStartCommand().setIsExecutionAllowed(false); getStopCommand().setIsExecutionAllowed(false); getStartRebalanceCommand().setIsExecutionAllowed(false); getSearchNextPageCommand().setIsAvailable(true); getSearchPreviousPageCommand().setIsAvailable(true); }</code><technical_language>change "StartRebalance" well</technical_language>

Target:
public VolumeListModel() { setTitle(ConstantsManager.getInstance().getConstants().volumesTitle()); setDefaultSearchString("Volumes:"); setSearchString(getDefaultSearchString()); setSearchObjects(new String[] { SearchObjects.GLUSTER_VOLUME_OBJ_NAME, SearchObjects.GLUSTER_VOLUME_PLU_OBJ_NAME }); setAvailableInModes(ApplicationMode.GlusterOnly); setCreateVolumeCommand(new UICommand("Create Volume", this)); setRemoveVolumeCommand(new UICommand("Remove", this)); setStartCommand(new UICommand("Start", this)); setStopCommand(new UICommand("Stop", this)); setStartRebalanceCommand(new UICommand("startRebalance", this)); setOptimizeForVirtStoreCommand(new UICommand("OptimizeForVirtStore", this)); getStartRebalanceCommand().setIsAvailable(true); getRemoveVolumeCommand().setIsExecutionAllowed(false); getStartCommand().setIsExecutionAllowed(false); getStopCommand().setIsExecutionAllowed(false); getStartRebalanceCommand().setIsExecutionAllowed(false); getSearchNextPageCommand().setIsAvailable(true); getSearchPreviousPageCommand().setIsAvailable(true); }
Source:
<code>private void pickedUp(Player player) { if (!pickedUp) { levelController.getScreenController().removeSprite(this); pickedUp = true; Logger.log("Picked up Powerup."); if (kind < 1) { for (int i = 0; i < AMOUNT_OF_POWERUPS; i++) { if (kind >= i * (kind / AMOUNT_OF_POWERUPS)) { player.activateSpeedPowerup(); } <START> } <END> } else { switch ((int) kind) { case 2: player.activateSpeedPowerup(); default: Logger.log("Unknown Powerup int, should use static int."); } } } }</code><technical_language>I suggest Math.ceil(kind*AMOUNT_OF_POWERUPS) check powerup is. for loop removed. <logic</technical_language>

Target:
private void pickedUp(Player player) { if (!pickedUp) { levelController.getScreenController().removeSprite(this); pickedUp = true; Logger.log("Picked up Powerup."); int k = (int) kind; if (kind < 1) { k = (int) Math.ceil(kind * AMOUNT_OF_POWERUPS); } switch (k) { case POWERUP_SPEED: player.activateSpeedPowerup(); break; default: Logger.log("Unknown Powerup int, should use static int."); } } }
Source:
<code><START> public void verifyNameLength(String constructType, int maxLength, ParserRuleContext ctx) { <END> if (SourceFileUtil.nameTooLong(ctx, maxLength)) { String lengthVersusLimit = " (" + ctx.getText().length() + "/" + maxLength + ")"; Location location = getContextStartLocation(ctx); this.printer.error(constructType + Messages.EXCEEDS_CHARACTER_LIMIT + lengthVersusLimit, location); } }</code><technical_language>I of verify () methods [package-private](<LINK_0> well</technical_language>

Target:
void verifyNameLength(String constructType, int maxLength, ParserRuleContext ctx) { if (SourceFileUtil.nameTooLong(ctx, maxLength)) { String lengthVersusLimit = " (" + ctx.getText().length() + "/" + maxLength + ")"; Location location = getContextStartLocation(ctx); this.printer.error(constructType + Messages.EXCEEDS_CHARACTER_LIMIT + lengthVersusLimit, location); } }
Source:
<code>public void testRecordRetrievalMatchingId() { <START> beforeEachTest(); <END> Set<Long> set = Sets.newHashSet(); set.add(new Long(35)); Assert.assertEquals( set, client.find(Criteria.where() .key(Constants.JSON_RESERVED_IDENTIFIER_NAME) .operator(Operator.EQUALS).value(35).build())); }</code><technical_language>learning code base is this call beforeEachTest() necessary? is this done automatically? I in other tests</technical_language>

Target:
public void testRecordRetrievalMatchingId() { Set<Long> set = Sets.newHashSet(); set.add(new Long(35)); Assert.assertEquals( set, client.find(Criteria.where() .key(Constants.JSON_RESERVED_IDENTIFIER_NAME) .operator(Operator.EQUALS).value(35).build())); }
Source:
<code><START> public int fontSize() { <END> if (fontSize < MIN_FONT) { return MIN_FONT; } else if (fontSize > MAX_FONT) { return MAX_FONT; } else { return fontSize; } }</code><technical_language>Duplicated pattern fontsize(), width() height() write a function coerce a a range</technical_language>

Target:
public int fontSize() { return Utils.constrainIntToRange(fontSize, MIN_FONT, MAX_FONT); }
Source:
<code>public void doPolling(Guid cmdId, List<Guid> childCmdIds) { boolean anyFailed = false; for (Guid childCmdId : childCmdIds) { switch (TaskManagerUtil.getCommandStatus(childCmdId)) { case ACTIVE: case ACTIVE_SYNC: case ACTIVE_ASYNC: case ACTIVE_ASYNC_EXECUTED: <START> log.info("Waiting on Live Merge child commands to complete"); <END> return; case FAILED: case FAILED_RESTARTED: case UNKNOWN: anyFailed = true; break; default: break; } } RemoveSnapshotCommand<RemoveSnapshotParameters> command = getCommand(cmdId); command.getParameters().setTaskGroupSuccess(!anyFailed); command.setCommandStatus(anyFailed ? CommandStatus.FAILED : CommandStatus.SUCCEEDED); log.infoFormat("All Live Merge child commands have completed, status {0}", command.getCommandStatus()); }</code><technical_language>get this 10s for snapshot</technical_language>

Target:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { boolean anyFailed = false; for (Guid childCmdId : childCmdIds) { switch (TaskManagerUtil.getCommandStatus(childCmdId)) { case ACTIVE: case ACTIVE_SYNC: case ACTIVE_ASYNC: log.info("Waiting on Live Merge child commands to complete"); return; case FAILED: case FAILED_RESTARTED: case UNKNOWN: anyFailed = true; break; default: break; } } RemoveSnapshotCommand<RemoveSnapshotParameters> command = getCommand(cmdId); command.getParameters().setTaskGroupSuccess(!anyFailed); command.setCommandStatus(anyFailed ? CommandStatus.FAILED : CommandStatus.SUCCEEDED); log.infoFormat("All Live Merge child commands have completed, status {0}", command.getCommandStatus()); }
Source:
<code>public void init(String <START> title, String <END> width, String height, boolean closeIconVisible) { asWidget().setWidth(width); asWidget().setHeight(height); asWidget().setCloseIconButtonVisible(closeIconVisible); }</code><technical_language>able set dialog's title (?) In this case, title is dynamic UI plugin API function call</technical_language>

Target:
public void init(String title, String width, String height, boolean closeIconVisible) { dialogPanel.setTitle(title); asWidget().setWidth(width); asWidget().setHeight(height); asWidget().setCloseIconButtonVisible(closeIconVisible); }
Source:
<code>public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.time, container, false); final TimePicker picker = ButterKnife.findById(view, R.id.picker); picker.setCurrentHour(date.get(Calendar.HOUR_OF_DAY)); picker.setCurrentMinute(date.get(Calendar.MINUTE)); picker.setOnTimeChangedListener(new TimePickerListener()); <START> picker.setIs24HourView(Settings.get24HourStyle()); <END> return view; }</code><technical_language>need for this extra method, use: java picker.setIs24HourView(DateFormat.is24HourFormat(getActivity()); refer context of enclosing activity</technical_language>

Target:
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.time, container, false); final TimePicker picker = ButterKnife.findById(view, R.id.picker); picker.setCurrentHour(date.get(Calendar.HOUR_OF_DAY)); picker.setCurrentMinute(date.get(Calendar.MINUTE)); picker.setOnTimeChangedListener(new TimePickerListener()); picker.setIs24HourView(DateFormat.is24HourFormat(getActivity())); return view; }