auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static ConnectorPropertiesWrapperJPAEntity getFromObject( Object property) { Class<?> clazz = property.getClass(); ConnectorPropertiesWrapperJPAEntity wrapper = new ConnectorPropertiesWrapperJPAEntity(); List<ConnectorPropertyJPAEntity> propList = new ArrayList<ConnectorPropertyJPAEntity>(); wrapper.setProperties(propList); wrapper.setCollectionType(clazz.getName()); Object[] arr; if (clazz.isArray()) { Class<?> compClass = clazz.getComponentType(); if (compClass.isPrimitive()) { compClass = ClassUtils.primitiveToWrapper(compClass); int length = Array.getLength(property); Object wrapperArray = Array.newInstance(compClass, length); for (int i = 0; i < length; i++) { Array.set(wrapperArray, i, Array.get(property, i)); } arr = (Object[]) wrapperArray; } else { arr = (Object[]) property; } loopProperties(Arrays.asList(arr), propList); return wrapper; } if (Collection.class.isAssignableFrom(clazz)) { Collection<Object> coll = (Collection<Object>) property; loopProperties(coll, propList); return wrapper; } wrapper.setCollectionType(null); propList.add(ConnectorPropertyJPAEntity.getFromObject(property)); return wrapper; }

Target:
public static ConnectorPropertiesWrapperJPAEntity getFromObject( Object property) { Class<?> clazz = property.getClass(); ConnectorPropertiesWrapperJPAEntity wrapper = new ConnectorPropertiesWrapperJPAEntity(); List<ConnectorPropertyJPAEntity> propList = new ArrayList<ConnectorPropertyJPAEntity>(); wrapper.setProperties(propList); wrapper.setCollectionType(clazz.getName()); if (clazz.isArray()) { Object[] arr; Class<?> compClass = clazz.getComponentType(); if (compClass.isPrimitive()) { compClass = ClassUtils.primitiveToWrapper(compClass); int length = Array.getLength(property); Object wrapperArray = Array.newInstance(compClass, length); for (int i = 0; i < length; i++) { Array.set(wrapperArray, i, Array.get(property, i)); } arr = (Object[]) wrapperArray; } else { arr = (Object[]) property; } loopProperties(Arrays.asList(arr), propList); return wrapper; } else { if (Collection.class.isAssignableFrom(clazz)) { Collection<Object> coll = (Collection<Object>) property; loopProperties(coll, propList); return wrapper; } else { wrapper.setCollectionType(null); propList.add(ConnectorPropertyJPAEntity.getFromObject(property)); return wrapper; } } }
Source:
public void setSerial(int port) { this.localPort = port; serial = EMULATOR_SERIAL_PREFIX + port; }

Target:
public void setSerial(int port) { serial = EMULATOR_SERIAL_PREFIX + port; }
Source:
public void process(Element element, JCodeModel codeModel, EBeanHolder holder) throws JClassAlreadyExistsException { ExecutableElement executableElement = (ExecutableElement) element; UiThread annotation = element.getAnnotation(UiThread.class); Propagation propagation = annotation.propagation(); JMethod delegatingMethod = helper.overrideAnnotatedMethod(executableElement, holder); JBlock clonedBody = null; if (propagation == Propagation.REUSE) { clonedBody = cloneMethodBody(delegatingMethod); } JDefinedClass anonymousRunnableClass = helper.createDelegatingAnonymousRunnableClass(holder, delegatingMethod); { long delay = annotation.delay(); if (holder.handler == null) { JClass handlerClass = holder.classes().HANDLER; holder.handler = holder.generatedClass.field(JMod.PRIVATE, handlerClass, "handler_", JExpr._new(handlerClass)); } if (propagation == Propagation.REUSE) { addUIThreadCheck(delegatingMethod, clonedBody, codeModel); } if (delay == 0) { delegatingMethod.body().invoke(holder.handler, "post").arg(_new(anonymousRunnableClass)); } else { delegatingMethod.body().invoke(holder.handler, "postDelayed").arg(_new(anonymousRunnableClass)).arg(lit(delay)); } } }

Target:
public void process(Element element, JCodeModel codeModel, EBeanHolder holder) throws JClassAlreadyExistsException { ExecutableElement executableElement = (ExecutableElement) element; UiThread annotation = element.getAnnotation(UiThread.class); Propagation propagation = annotation.propagation(); JMethod delegatingMethod = helper.overrideAnnotatedMethod(executableElement, holder); JDefinedClass anonymousRunnableClass = helper.createDelegatingAnonymousRunnableClass(holder, delegatingMethod); { long delay = annotation.delay(); if (holder.handler == null) { JClass handlerClass = holder.classes().HANDLER; holder.handler = holder.generatedClass.field(JMod.PRIVATE, handlerClass, "handler_", JExpr._new(handlerClass)); } if (delay == 0) { if (propagation == Propagation.REUSE) { addUIThreadCheck(delegatingMethod, codeModel, holder); } delegatingMethod.body().invoke(holder.handler, "post").arg(_new(anonymousRunnableClass)); } else { delegatingMethod.body().invoke(holder.handler, "postDelayed").arg(_new(anonymousRunnableClass)).arg(lit(delay)); } } }
Source:
private void reportSLOs(final long startingNanos, final int totalSizeBytes, final int eventCount, final EventPublishResult eventPublishResult, final String eventTypeName, final Client client) { if (eventPublishResult.getStatus() == EventPublishingStatus.SUBMITTED) { final long msSpent = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startingNanos); final String applicationName = client.getClientId(); LOG.info("[SLO] [publishing-latency] time={} size={} count={} eventTypeName={} app={}", msSpent, totalSizeBytes, eventCount, eventTypeName, applicationName); nakadiKpiPublisher.publish(kpiBatchPublishedEventType, () -> new JSONObject() .put("event_type", eventTypeName) .put("app", applicationName) .put("app_hashed", nakadiKpiPublisher.hash(applicationName)) .put("number_of_events", eventCount) .put("batch_size", totalSizeBytes)); } }

Target:
private void reportSLOs(final long startingNanos, final int totalSizeBytes, final int eventCount, final EventPublishResult eventPublishResult, final String eventTypeName, final Client client) { if (eventPublishResult.getStatus() == EventPublishingStatus.SUBMITTED) { final long msSpent = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startingNanos); final String applicationName = client.getClientId(); LOG.info("[SLO] [publishing-latency] time={} size={} count={} eventTypeName={} app={}", msSpent, totalSizeBytes, eventCount, eventTypeName, applicationName); nakadiKpiPublisher.publish(kpiBatchPublishedEventType, () -> new JSONObject() .put("event_type", eventTypeName) .put("app", applicationName) .put("app_hashed", nakadiKpiPublisher.hash(applicationName)) .put("number_of_events", eventCount) .put("ms_spent", msSpent) .put("batch_size", totalSizeBytes)); } }
Source:
public void checkVertxHealthChecksBoosterProjectCommands() { consoles.executeCommandFromProjectExplorer( VERTX_HEALTH_CHECKS_BOOSTER, BUILD_GOAL, BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( VERTX_HEALTH_CHECKS_BOOSTER, RUN_GOAL, RUN_COMMAND, "[INFO] INFO: Succeeded in deploying verticle"); consoles.checkWebElementVisibilityAtPreviewPage(By.id("_vert_x_health_check_booster")); consoles.closeProcessTabWithAskDialog(RUN_COMMAND); consoles.executeCommandFromProcessesArea( "dev-machine", DEBUG_GOAL, DEBUG_COMMAND, "[INFO] Listening for transport dt_socket at address: 5005"); consoles.closeProcessTabWithAskDialog(DEBUG_COMMAND); }

Target:
public void checkVertxHealthChecksBoosterProjectCommands() { By textOnPreviewPage = By.id("_vert_x_health_check_booster"); consoles.executeCommandFromProjectExplorer( HEALTH_CHECKS_BOOSTER_PROJECT, BUILD_GOAL, BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( HEALTH_CHECKS_BOOSTER_PROJECT, RUN_GOAL, RUN_COMMAND, "[INFO] INFO: Succeeded in deploying verticle"); consoles.checkWebElementVisibilityAtPreviewPage(textOnPreviewPage); consoles.closeProcessTabWithAskDialog(RUN_COMMAND); consoles.executeCommandFromProcessesArea( "dev-machine", DEBUG_GOAL, DEBUG_COMMAND, "[INFO] Listening for transport dt_socket at address: 5005"); consoles.closeProcessTabWithAskDialog(DEBUG_COMMAND); }
Source:
public static Object[][] data() { return new Object[][] { { "generic", new GenericContainer<>(new RemoteDockerImage(IMAGE_FUTURE)), true }, { "anonymous generic", new GenericContainer(new RemoteDockerImage(IMAGE_FUTURE)) {}, true }, { "custom", new CustomContainer(), true }, { "anonymous custom", new CustomContainer() {}, true }, { "custom with containerIsCreated", new CustomContainerWithContainerIsCreated(), false }, }; }

Target:
public static Object[][] data() { return new Object[][] { { "generic", new GenericContainer<>(TINY_IMAGE), true }, { "anonymous generic", new GenericContainer(TINY_IMAGE) {}, true }, { "custom", new CustomContainer(), true }, { "anonymous custom", new CustomContainer() {}, true }, { "custom with containerIsCreated", new CustomContainerWithContainerIsCreated(), false }, }; }
Source:
public int getHstsMaxAge() { return hstsMaxAge; }

Target:
public Duration getHstsMaxAge() { return hstsMaxAge; }
Source:
protected boolean canDoAction() { if (getParameters().getParametersList().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } return updateParameters(); }

Target:
protected boolean canDoAction() { if (getParameters().getParametersList().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_DISKS_SPECIFIED); } return updateParameters(); }
Source:
public static Command<Set<Cookie>> getAllCookies() { return new Command<>(domainName + ".getAllCookies", ImmutableMap.of(), map("cookies", new TypeToken<Set<Cookie>>() {}.getType())); }

Target:
public static Command<Cookies> getAllCookies() { return new Command<>(DOMAIN_NAME + ".getAllCookies", ImmutableMap.of(), map("cookies", Cookies.class)); }
Source:
public static boolean initialize(Context context) { preferences = PreferenceManager.getDefaultSharedPreferences(context); if (CrashReporter.isReportingEnabled()) { reporter.initialize(context); Log.d(TAG, "INITIALIZED!"); return true; } Log.d(TAG, "INITIALIZATION FAILED! [ Report : " + isReportingEnabled() + "]"); return false; }

Target:
public static boolean initialize(Context context) { preferences = PreferenceManager.getDefaultSharedPreferences(context); if (isReportingEnabled()) { reporter.initialize(context); Log.d(TAG, "INITIALIZED!"); return true; } Log.d(TAG, "INITIALIZATION FAILED! [ Report : " + isReportingEnabled() + "]"); return false; }
Source:
public boolean isDecorated() { return decorated; }

Target:
public boolean isDecorated() { return !decorators.isEmpty(); }
Source:
private static ITmfTimeAligned getReferenceView(TmfTimeViewAlignmentInfo alignmentInfo, TmfView blackListedView) { IWorkbenchWindow workbenchWindow = getWorkbenchWindow(alignmentInfo.getShell()); if (workbenchWindow == null || workbenchWindow.getActivePage() == null) { return null; } IWorkbenchPage page = workbenchWindow.getActivePage(); int lowestTimeAxisOffset = Integer.MAX_VALUE; ITmfTimeAligned referenceView = null; for (IViewReference ref : page.getViewReferences()) { IViewPart view = ref.getView(false); if (view != blackListedView && isTimeAlignedView(view)) { if (isCandidateForReferenceView((TmfView) view, alignmentInfo, lowestTimeAxisOffset)) { referenceView = (ITmfTimeAligned) view; getClampedTimeAxisOffset(referenceView.getTimeViewAlignmentInfo()); break; } } } return referenceView; }

Target:
private static ITmfTimeAligned getReferenceView(TmfTimeViewAlignmentInfo alignmentInfo, TmfView blackListedView) { IWorkbenchWindow workbenchWindow = getWorkbenchWindow(alignmentInfo.getShell()); if (workbenchWindow == null || workbenchWindow.getActivePage() == null) { return null; } IWorkbenchPage page = workbenchWindow.getActivePage(); int lowestTimeAxisOffset = Integer.MAX_VALUE; ITmfTimeAligned referenceView = null; for (IViewReference ref : page.getViewReferences()) { IViewPart view = ref.getView(false); if (view != blackListedView && isTimeAlignedView(view)) { if (isCandidateForReferenceView((TmfView) view, alignmentInfo, lowestTimeAxisOffset)) { referenceView = (ITmfTimeAligned) view; lowestTimeAxisOffset = getClampedTimeAxisOffset(referenceView.getTimeViewAlignmentInfo()); } } } return referenceView; }
Source:
public void makeSortable() { makeSortable(new Comparator<T>() { SimpleStatusImageComparator imageComparator = new SimpleStatusImageComparator(); @Override public int compare(T o1, T o2) { return imageComparator.compare(getImage(o1), getImage(o2)); } }); }

Target:
public void makeSortable() { makeSortable(new Comparator<T>() { private final SimpleStatusImageComparator imageComparator = new SimpleStatusImageComparator(); @Override public int compare(T o1, T o2) { return imageComparator.compare(getImage(o1), getImage(o2)); } }); }
Source:
public ApplicationInfo createApplication(final String appId, final List<String> paths) throws InjectionException { final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); jcb.bindNamedParameter(ApplicationIdentifier.class, appId); jcb.bindNamedParameter(JarFilePath.class, paths.get(0)); final String groupId = ""; jcb.bindNamedParameter(GroupId.class, groupId); jcb.bindNamedParameter(PeriodicCheckpointPeriod.class, String.valueOf(checkpointPeriod)); final Injector injector = Tang.Factory.getTang().newInjector(jcb.build()); injector.bindVolatileInstance(MQTTResource.class, mqttSharedResource); injector.bindVolatileInstance(KafkaSharedResource.class, kafkaSharedResource); injector.bindVolatileInstance(NettySharedResource.class, nettySharedResource); injector.bindVolatileInstance(QueryInfoStore.class, planStore); final ApplicationInfo applicationInfo = injector.getInstance(ApplicationInfo.class); applicationMap.putIfAbsent(appId, applicationInfo); final Group group = injector.getInstance(Group.class); groupAllocationTableModifier.addEvent( new WritingEvent(WritingEvent.EventType.GROUP_ADD, new Tuple<>(applicationInfo, group))); groupMap.putIfAbsent(groupId, group); return applicationInfo; }

Target:
public ApplicationInfo createApplication(final String appId, final List<String> paths) throws InjectionException { final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); jcb.bindNamedParameter(ApplicationIdentifier.class, appId); jcb.bindNamedParameter(JarFilePath.class, paths.get(0)); final String groupId = ""; jcb.bindNamedParameter(GroupId.class, groupId); jcb.bindNamedParameter(PeriodicCheckpointPeriod.class, String.valueOf(checkpointPeriod)); final Injector injector = Tang.Factory.getTang().newInjector(jcb.build()); injector.bindVolatileInstance(MQTTResource.class, mqttSharedResource); injector.bindVolatileInstance(KafkaSharedResource.class, kafkaSharedResource); injector.bindVolatileInstance(NettySharedResource.class, nettySharedResource); injector.bindVolatileInstance(QueryInfoStore.class, planStore); final ApplicationInfo applicationInfo = injector.getInstance(ApplicationInfo.class); applicationMap.putIfAbsent(appId, applicationInfo); final Group group = injector.getInstance(Group.class); groupAllocationTableModifier.addEvent( new WritingEvent(WritingEvent.EventType.GROUP_ADD, new Tuple<>(applicationInfo, group))); return applicationInfo; }
Source:
private void checkoutCommit(RevCommit commit) throws IllegalStateException, IOException { try (RevWalk walk = new RevWalk(db)) { RevCommit head = walk.parseCommit(db.resolve(Constants.HEAD)); DirCacheCheckout dco = new DirCacheCheckout(db, head.getTree(), db.lockDirCache(), commit.getTree()); dco.setFailOnConflict(true); dco.checkout(); RefUpdate refUpdate = db.updateRef(Constants.HEAD, true); refUpdate.setNewObjectId(commit); refUpdate.setRefLogMessage("checkout: moving to " + head.getName(), false); refUpdate.forceUpdate(); } }

Target:
private void checkoutCommit(RevCommit commit) throws IllegalStateException, IOException { RevCommit head; try (RevWalk walk = new RevWalk(db)) { head = walk.parseCommit(db.resolve(Constants.HEAD)); DirCacheCheckout dco = new DirCacheCheckout(db, head.getTree(), db.lockDirCache(), commit.getTree()); dco.setFailOnConflict(true); dco.checkout(); } RefUpdate refUpdate = db.updateRef(Constants.HEAD, true); refUpdate.setNewObjectId(commit); refUpdate.setRefLogMessage("checkout: moving to " + head.getName(), false); refUpdate.forceUpdate(); }
Source:
public String getUserHomeLink() { switch(activityLog.getRoleWithoutMasquerade()) { case Const.ActivityLog.ROLE_STUDENT: return Url.addParamToUrl(Const.ActionURIs.STUDENT_HOME_PAGE, Const.ParamsNames.USER_ID, activityLog.getGoogleId()); case Const.ActivityLog.ROLE_INSTRUCTOR: return Url.addParamToUrl(Const.ActionURIs.INSTRUCTOR_HOME_PAGE, Const.ParamsNames.USER_ID, activityLog.getGoogleId()); default: return activityLog.getGoogleId(); } }

Target:
public String getUserHomeLink() { switch (activityLog.getRoleWithoutMasquerade()) { case Const.ActivityLog.ROLE_STUDENT: return Url.addParamToUrl(Const.ActionURIs.STUDENT_HOME_PAGE, Const.ParamsNames.USER_ID, activityLog.getGoogleId()); case Const.ActivityLog.ROLE_INSTRUCTOR: return Url.addParamToUrl(Const.ActionURIs.INSTRUCTOR_HOME_PAGE, Const.ParamsNames.USER_ID, activityLog.getGoogleId()); default: return null; } }
Source:
public static Request GroupCreateRequest(Id sender, String name, List<Id> nodes) { Objects.requireNonNull(sender); Objects.requireNonNull(name); Objects.requireNonNull(nodes); if(nodes.size() < 1) { throw new IllegalArgumentException(); } RequestBuilder builder = new RequestBuilder( MessageKind.GROUPCREATE, sender); builder.addField(Fields.NAME, name); builder.addField(Fields.NODES, nodes); return builder.request(); }

Target:
public static Request GroupCreateRequest(Id sender, String name, List<Id> nodes) { Objects.requireNonNull(sender); Objects.requireNonNull(name); Objects.requireNonNull(nodes); if(nodes.size() < 1) { throw new IllegalArgumentException("No nodes to add..."); } RequestBuilder builder = new RequestBuilder( MessageKind.GROUPCREATE, sender); builder.addField(Fields.NAME, name); builder.addField(Fields.NODES, nodes); return builder.request(); }
Source:
public ActionBuilderModule<DocumentSimilarity> instantiate(Configuration config, Agent agent, String actionSetId) { String thresholdStr = config.get(EXPORT_DOCUMENTSSIMILARITY_THRESHOLD); Float similarityThreshold = null; if (thresholdStr != null && !WorkflowRuntimeParameters.UNDEFINED_NONEMPTY_VALUE.equals(thresholdStr)) { similarityThreshold = Float.valueOf(thresholdStr); log.warn("setting documents similarity exporter threshold to: " + similarityThreshold); } return new DocumentSimilarityActionBuilderModule(provideTrustLevelThreshold(config), similarityThreshold, agent, actionSetId); }

Target:
public ActionBuilderModule<DocumentSimilarity> instantiate(Configuration config, Agent agent, String actionSetId) { Float similarityThreshold = null; String thresholdStr = WorkflowRuntimeParameters.getParamValue(EXPORT_DOCUMENTSSIMILARITY_THRESHOLD, config); if (thresholdStr != null) { similarityThreshold = Float.valueOf(thresholdStr); log.info("setting documents similarity exporter threshold to: " + similarityThreshold); } return new DocumentSimilarityActionBuilderModule(provideTrustLevelThreshold(config), similarityThreshold, agent, actionSetId); }
Source:
RestRequestMetricsGroup(String requestType, String resource) { blobMetrics = new RestRequestMetrics(AmbryBlobStorageService.class, requestType + resource, metricRegistry); blobSSLMetrics = new RestRequestMetrics(AmbryBlobStorageService.class, requestType + resource + SSL_SUFFIX, metricRegistry); encryptedBlobMetrics = new RestRequestMetrics(AmbryBlobStorageService.class, requestType + ENCRYPTED + resource, metricRegistry); encryptedBlobSSLMetrics = new RestRequestMetrics(AmbryBlobStorageService.class, requestType + ENCRYPTED + resource + SSL_SUFFIX, metricRegistry); }

Target:
RestRequestMetricsGroup(String requestType, String resource) { blobMetrics = new RestRequestMetrics(AmbryBlobStorageService.class, requestType + resource, metricRegistry); blobSslMetrics = new RestRequestMetrics(AmbryBlobStorageService.class, requestType + resource + SSL_SUFFIX, metricRegistry); blobEncryptedMetrics = new RestRequestMetrics(AmbryBlobStorageService.class, requestType + resource + ENCRYPTED, metricRegistry); blobSslEncryptedMetrics = new RestRequestMetrics(AmbryBlobStorageService.class, requestType + resource + SSL_SUFFIX + ENCRYPTED, metricRegistry); }
Source:
public Object invoke(String mthdName, boolean srvKeepBinary, Object[] args) throws IgniteCheckedException, NoSuchMethodException { if (proxy instanceof PlatformService) return ((PlatformService)proxy).invokeMethod(mthdName, srvKeepBinary, args); else { assert proxy instanceof GridServiceProxy; if (!srvKeepBinary) args = PlatformUtils.unwrapBinariesInArray(args); Method mtd = getMethod(serviceClass, mthdName, args); try { return ((GridServiceProxy)proxy).invokeMethod(mtd, args); } catch (Throwable t) { throw new IgniteCheckedException(t); } } }

Target:
public Object invoke(String mthdName, boolean srvKeepBinary, Object[] args) throws IgniteCheckedException, NoSuchMethodException { if (proxy instanceof PlatformService) return ((PlatformService)proxy).invokeMethod(mthdName, srvKeepBinary, args); else { assert proxy instanceof GridServiceProxy; if (!srvKeepBinary) args = PlatformUtils.unwrapBinariesInArray(args); Method mtd = getMethod(serviceClass, mthdName, args); try { return ((GridServiceProxy)proxy).invokeMethod(mtd, args); } catch (Throwable t) { throw IgniteUtils.cast(t); } } }
Source:
public void handleMessage(Message msg) { switch (msg.what) { case MSG_MEASURE: { if (mCached != null) { mMainHandler.obtainMessage(0, mCached).sendToTarget(); break; } synchronized (mLock) { if (mBound) { removeMessages(MSG_DISCONNECT); sendMessage(obtainMessage(MSG_CONNECTED, mDefaultContainer)); } else { Intent service = new Intent().setComponent(DEFAULT_CONTAINER_COMPONENT); mContext.bindServiceAsUser(service, mDefContainerConn, Context.BIND_AUTO_CREATE, UserHandle.OWNER); } } break; } case MSG_CONNECTED: { final IMediaContainerService imcs = (IMediaContainerService) msg.obj; measureExactStorage(imcs); break; } case MSG_DISCONNECT: { synchronized (mLock) { if (mBound) { mBound = false; mContext.unbindService(mDefContainerConn); } } if (null != getLooper()) { getLooper().quit(); } break; } case MSG_COMPLETED: { mCached = (MeasurementDetails) msg.obj; mMainHandler.obtainMessage(0, mCached).sendToTarget(); break; } case MSG_INVALIDATE: { mCached = null; break; } } }

Target:
public void handleMessage(Message msg) { switch (msg.what) { case MSG_MEASURE: { if (mCached != null) { mMainHandler.obtainMessage(0, mCached).sendToTarget(); break; } synchronized (mLock) { if (mBound) { removeMessages(MSG_DISCONNECT); sendMessage(obtainMessage(MSG_CONNECTED, mDefaultContainer)); } else { Intent service = new Intent().setComponent(DEFAULT_CONTAINER_COMPONENT); mContext.bindServiceAsUser(service, mDefContainerConn, Context.BIND_AUTO_CREATE, UserHandle.OWNER); } } break; } case MSG_CONNECTED: { final IMediaContainerService imcs = (IMediaContainerService) msg.obj; measureExactStorage(imcs); break; } case MSG_DISCONNECT: { synchronized (mLock) { if (mBound) { mBound = false; mContext.unbindService(mDefContainerConn); } } getLooper().quit(); break; } case MSG_COMPLETED: { mCached = (MeasurementDetails) msg.obj; mMainHandler.obtainMessage(0, mCached).sendToTarget(); break; } case MSG_INVALIDATE: { mCached = null; break; } } }
Source:
public List<ConfigOpacDoctype> getAllDoctypes() { return ConfigOpac.getAllDoctypes(); }

Target:
public List<SelectItem> getAllDoctypes() { return createProcessForm.getRuleset() .getStructuralElements(createProcessForm.getPriorityList()).entrySet() .stream().map(entry -> new SelectItem(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); }
Source:
protected void executeCommand() { boolean isDomainUpdatePossible = !Guid.isNullOrEmpty(getVdsId()); boolean isDomainUpdateRequired = isDomainUpdatePossible && doDomainsUseConnection(getConnection()); List<StorageDomain> updatedDomains = new ArrayList<>(); boolean hasConnectStorageSucceeded = false; if (isDomainUpdateRequired) { hasConnectStorageSucceeded = connectToStorage(); VDSReturnValue returnValueUpdatedStorageDomain = null; if (hasConnectStorageSucceeded) { changeStorageDomainStatusInTransaction(StorageDomainStatus.Locked); for (StorageDomain domain : domains) { returnValueUpdatedStorageDomain = getStatsForDomain(domain); if (returnValueUpdatedStorageDomain.getSucceeded()) { StorageDomain updatedStorageDomain = (StorageDomain) returnValueUpdatedStorageDomain.getReturnValue(); updatedDomains.add(updatedStorageDomain); } } if (!updatedDomains.isEmpty()) { updateStorageDomain(updatedDomains); } } } getStorageConnDao().update(getParameters().getStorageServerConnection()); if (isDomainUpdateRequired) { for (StorageDomain domain : domains) { for (StoragePoolIsoMap map : getStoragePoolIsoMap(domain)) { restoreStateAfterUpdate(map); } } if (hasConnectStorageSucceeded) { disconnectFromStorage(); } } setSucceeded(true); }

Target:
protected void executeCommand() { boolean isDomainUpdateRequired = !Guid.isNullOrEmpty(getVdsId()) && doDomainsUseConnection(getConnection()); List<StorageDomain> updatedDomains = new ArrayList<>(); boolean hasConnectStorageSucceeded = false; if (isDomainUpdateRequired) { hasConnectStorageSucceeded = connectToStorage(); VDSReturnValue returnValueUpdatedStorageDomain = null; if (hasConnectStorageSucceeded) { changeStorageDomainStatusInTransaction(StorageDomainStatus.Locked); for (StorageDomain domain : domains) { returnValueUpdatedStorageDomain = getStatsForDomain(domain); if (returnValueUpdatedStorageDomain.getSucceeded()) { StorageDomain updatedStorageDomain = (StorageDomain) returnValueUpdatedStorageDomain.getReturnValue(); updatedDomains.add(updatedStorageDomain); } } if (!updatedDomains.isEmpty()) { updateStorageDomain(updatedDomains); } } } getStorageConnDao().update(getParameters().getStorageServerConnection()); if (isDomainUpdateRequired) { for (StorageDomain domain : domains) { for (StoragePoolIsoMap map : getStoragePoolIsoMap(domain)) { restoreStateAfterUpdate(map); } } if (hasConnectStorageSucceeded) { disconnectFromStorage(); } } setSucceeded(true); }
Source:
public void updateDiseaseOccurrenceIsValidatedValues(int diseaseGroupId, DateTime modelRunPrepDate) { List<DiseaseOccurrence> occurrences = diseaseService.getDiseaseOccurrencesInValidation(diseaseGroupId); for (DiseaseOccurrence occurrence : occurrences) { boolean validated = occurrenceHasBeenInReviewForMoreThanAWeek(occurrence, modelRunPrepDate); if (occurrence.isValidated() != validated) { occurrence.setValidated(validated); diseaseService.saveDiseaseOccurrence(occurrence); } } }

Target:
public void updateDiseaseOccurrenceIsValidatedValues(int diseaseGroupId, DateTime modelRunPrepDate) { List<DiseaseOccurrence> occurrences = diseaseService.getDiseaseOccurrencesInValidation(diseaseGroupId); for (DiseaseOccurrence occurrence : occurrences) { boolean validated = occurrenceHasBeenInReviewForMoreThanAWeek(occurrence, modelRunPrepDate); if (occurrence.isValidated() != null && occurrence.isValidated() != validated) { occurrence.setValidated(validated); diseaseService.saveDiseaseOccurrence(occurrence); } } }
Source:
public DoubleSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, boolean outputRequired, LocalMemoryContext systemMemoryContext) { requireNonNull(filter, "filter is null"); checkArgument(filter.isPresent() || outputRequired, "filter must be present if outputRequired is false"); this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = filter.orElse(null); this.outputRequired = outputRequired; this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); nullsAllowed = this.filter == null || this.filter.testNull(); }

Target:
public DoubleSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, boolean outputRequired, LocalMemoryContext systemMemoryContext) { requireNonNull(filter, "filter is null"); checkArgument(filter.isPresent() || outputRequired, "filter must be present if outputRequired is false"); this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = filter.orElse(null); this.outputRequired = outputRequired; this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); nullsAllowed = this.filter == null || nonDeterministicFilter || this.filter.testNull(); }
Source:
public boolean close() { try { Files.copy(fxmlFile.toPath(), foriginalXmlFile.toPath(), REPLACE_EXISTING); } catch (IOException e) { Activator.logError(e.getMessage(), e); } fxmlFile.delete(); return super.close(); }

Target:
public boolean close() { if(modifsInStandby()) { MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), Messages.XmlFilePropertiesDialog_closingWindowDialogText, null, Messages.XmlFilePropertiesDialog_closingWindowDialogQuestion2, MessageDialog.QUESTION, new String[] { Messages.XmlFilePropertiesDialog_closingWindowDialogYes, Messages.XmlFilePropertiesDialog_closingWindowDialogNo }, 0); if(dialog.open() == 1) { return false; } } try { Files.copy(fXmlFile.toPath(), fOriginalXmlFile.toPath(), REPLACE_EXISTING); } catch (IOException e) { Activator.logError(e.getMessage(), e); } fXmlFile.delete(); return super.close(); }
Source:
public void initializeTests() throws Exception { coordinatorProps = new Properties(); notificationSystem = new MockNotificationSystem(9); plaintextCluster = new MockCluster(notificationSystem, SystemTime.getInstance()); plaintextCluster.startServers(); }

Target:
public void initializeTests() throws Exception { coordinatorProps = new Properties(); notificationSystem = new MockNotificationSystem(9); plaintextCluster = new MockCluster(notificationSystem, false, SystemTime.getInstance()); plaintextCluster.startServers(); }
Source:
public void vuapDefaultStateAutoplayIsMutredAfrerReplayIsNotMuted(Page page, String slot, String videoIframeSelector) { openPageWithVideoInLocalStorage(page, VuapVideos.PORVATA_VAST, VuapVideos.VAST_VIDEO); final AutoplayVuap vuap = new AutoplayVuap(driver, slot, videoIframeSelector); VuapAssertions.verifyVideoUnmuteAndMute(vuap); VuapAssertions.verifyVideoEndedAndReplyButtonDisplayed(vuap, MAX_AUTOPLAY_MOVIE_DURATION); vuap.replay(); vuap.clickOnSoundButton(); VuapAssertions.verifyVideoUnmuteAndMute(vuap); }

Target:
public void vuapDefaultStateAutoplayIsMutredAfrerReplayIsNotMuted(Page page, String slot, String videoIframeSelector) { openPageWithVideoInLocalStorage(page); final AutoplayVuap vuap = new AutoplayVuap(driver, slot, videoIframeSelector); VuapAssertions.verifyVideoUnmuteAndMute(vuap); VuapAssertions.verifyReplyButtonDisplayedAfterVideoEnds(vuap, MAX_AUTOPLAY_MOVIE_DURATION); vuap.replay(); vuap.mute(); VuapAssertions.verifyVideoUnmuteAndMute(vuap); }
Source:
public String getIssuerName() { issuerName = StringUtils.isEmpty(x509Cert.getIssuerDN().getName()) ? EMPTY_FIELD : x509Cert.getIssuerDN().getName(); return issuerName; }

Target:
public String getIssuerName() { return issuerName; }
Source:
public void shouldFailWithAdditionalInfosWhenReadingDocumentBlobContent() throws IOException { SimpleManagedBlob mock = Mockito.mock(SimpleManagedBlob.class); when(mock.getEncoding()).thenReturn("UTF-8"); when(mock.getKey()).thenReturn("anyKey:anyKey"); when(mock.getProviderId()).thenReturn("anyProvider:anyProvider"); when(mock.getMimeType()).thenReturn("text/html"); when(mock.getStream()).thenThrow(IOException.class); DocumentBlobHolder documentBlobHolder = createDocumentBlob(mock); try { cs.convert("html2text", documentBlobHolder, Collections.emptyMap()); } catch (ConversionException e) { assertTrue(e.getInfos().size() == 3); assertTrue(e.getInfos().get(0).contains("anyProvider:anyProvider")); assertTrue(e.getInfos().get(1).contains("anyKey:anyKey")); assertTrue(e.getInfos().get(2).contains(documentBlobHolder.getDocument().getId())); } }

Target:
public void shouldFailWithAdditionalInfosWhenReadingDocumentBlobContent() throws IOException { SimpleManagedBlob mock = Mockito.mock(SimpleManagedBlob.class); when(mock.getEncoding()).thenReturn("UTF-8"); when(mock.getKey()).thenReturn("anyKey:anyKey"); when(mock.getProviderId()).thenReturn("anyProvider:anyProvider"); when(mock.getMimeType()).thenReturn("text/html"); when(mock.getStream()).thenThrow(IOException.class); DocumentBlobHolder documentBlobHolder = createDocumentBlob(mock); try { cs.convert("html2text", documentBlobHolder, Collections.emptyMap()); fail("Should have raised a ConversionException"); } catch (ConversionException e) { assertEquals(2, e.getInfos().size()); assertTrue(e.getInfos().get(0).contains("anyProvider:anyProvider")); assertTrue(e.getInfos().get(0).contains("anyKey:anyKey")); assertTrue(e.getInfos().get(1).contains(documentBlobHolder.getDocument().getId())); } }
Source:
public void sortByOrderHint() { List<String> hints = Arrays.asList("0.03539970150419025", "0.9124532896017283", "0.4677879627352788", "0.9306522049331096", "0.8442774484430258", "0.3002734797783949", "0.9053018615787292", "0.5897829295233494", "0.9736635784904704", "0.393321565584442", "0.605741386570728", "0.6644442788442779", "0.8541807248539874", "0.9945130750802729", "0.12979277595041627"); List<String> sortedHints = new ArrayList<>(hints); Collections.sort(sortedHints, Comparator.comparingDouble(Double::valueOf)); withCategories(client(), hints.stream().map(CategoryQueryIntegrationTest::categoryWithHint).collect(Collectors.toList()), categories -> { PagedQueryResult<Category> res = client().executeBlocking(CategoryQuery.of().plusSort(m -> m.orderHint().sort().asc()).withLimit(500)); List<String> queryResultHints = res.getResults().stream().filter(cat -> categories.contains(cat)).map(cat -> cat.getOrderHint()).collect(Collectors.toList()); assertThat(queryResultHints).containsExactly(sortedHints.toArray(new String[sortedHints.size()])); }); }

Target:
public void sortByOrderHint() { final List<String> hints = Arrays.asList("0.03539970150419025", "0.9124532896017283", "0.4677879627352788", "0.9306522049331096", "0.8442774484430258", "0.3002734797783949", "0.9053018615787292", "0.5897829295233494", "0.9736635784904704", "0.393321565584442", "0.605741386570728", "0.6644442788442779", "0.8541807248539874", "0.9945130750802729", "0.12979277595041627"); List<String> sortedHints = new ArrayList<>(hints); Collections.sort(sortedHints, Comparator.comparingDouble(Double::valueOf)); withCategories(client(), hints.stream().map(CategoryQueryIntegrationTest::categoryWithHint).collect(Collectors.toList()), categories -> { PagedQueryResult<Category> res = client().executeBlocking(CategoryQuery.of().plusSort(m -> m.orderHint().sort().asc()).withLimit(500)); List<String> queryResultHints = res.getResults().stream().filter(cat -> categories.contains(cat)).map(cat -> cat.getOrderHint()).collect(Collectors.toList()); assertThat(queryResultHints).containsExactlyElementsOf(sortedHints); }); }
Source:
public ZooKeeper.States getState() throws KeeperException { return reporter.time(tag, "ensurePath", client::getState); }

Target:
public ZooKeeper.States getState() throws KeeperException { return reporter.time(tag, "getState", client::getState); }
Source:
public void testHistogramConfiguration() throws Exception { HistogramMetric histogramMetric = new HistogramMetric("test", null, new long[] {0, 50, 100, 250}); assertThrowsWithCause(() -> histogramMetric.configure(null), IgniteException.class); assertThrowsWithCause(() -> histogramMetric.configure(""), IgniteException.class); assertThrowsWithCause(() -> histogramMetric.configure("44,43"), IgniteException.class); assertThrowsWithCause(() -> histogramMetric.configure("-1000"), IgniteException.class); assertThrowsWithCause(() -> histogramMetric.configure("1,2,xx"), IgniteException.class); assertThrowsWithCause(() -> histogramMetric.configure("xx"), IgniteException.class); histogramMetric.configure("42,43 ,44, 45"); Object histogramHolder = getFieldValue(histogramMetric, "holder"); long[] bounds = getFieldValue(histogramHolder, "bounds"); assertTrue(Arrays.equals(new long[] {42, 43, 44, 45}, bounds)); }

Target:
public void testHistogramConfiguration() throws Exception { try (IgniteEx g = startGrid(0)) { MetricsMxBean bean = metricsBean(g); assertThrowsWithCause(() -> bean.configureHistogramMetric(null, BOUNDS), NullPointerException.class); assertThrowsWithCause( () -> bean.configureHistogramMetric(metricName(TX_METRICS, METRIC_SYSTEM_TIME_HISTOGRAM), null), NullPointerException.class); assertThrowsWithCause( () -> bean.configureHistogramMetric(metricName(TX_METRICS, METRIC_SYSTEM_TIME_HISTOGRAM), new long[0]), IllegalArgumentException.class); bean.configureHistogramMetric(metricName(TX_METRICS, METRIC_SYSTEM_TIME_HISTOGRAM), BOUNDS); HistogramMetric systemTime = g.context().metric().registry(TX_METRICS) .findMetric(METRIC_SYSTEM_TIME_HISTOGRAM); assertArrayEquals(BOUNDS, systemTime.bounds()); } }
Source:
public Iterable<EventData> receive(int batchSize) { long start = System.currentTimeMillis(); Iterable<EventData> receivedEvents = null; try { receivedEvents = receiver.receiveSync(batchSize); if (receivedEvents != null) { logger.debug("Batchsize: " + batchSize + ", Received event count: " + Iterables.size(receivedEvents)); } } catch (EventHubException e) { logger.error("Exception occured during receive" + e.toString()); return null; } long end = System.currentTimeMillis(); long millis = (end - start); receiveApiLatencyMean.update(millis); receiveApiCallCount.incr(); return receivedEvents; }

Target:
public Iterable<EventData> receive(int batchSize) { final long start = System.currentTimeMillis(); final Iterable<EventData> receivedEvents; try { receivedEvents = receiver.receiveSync(batchSize); if (receivedEvents != null) { final long end = System.currentTimeMillis(); final long millis = (end - start); receiveApiLatencyMean.update(millis); receiveApiCallCount.incr(); logger.debug("Batchsize: " + batchSize + ", Received event count: " + Iterables.size(receivedEvents)); } } catch (EventHubException e) { logger.error("Exception occured during receive: " + e.toString()); return null; } return receivedEvents == null ? this.emptyEventBatch : receivedEvents; }
Source:
public RangeResourceEntry(Long begin, Long end) { this.reservationType = reservationType; this.begin = begin; this.end = end; }

Target:
public RangeResourceEntry(Long begin, Long end) { this.begin = begin; this.end = end; }
Source:
public void shouldGetColumnInformation() { assertEquals(2, table.getColumnCount()); long columnKey = table.getColumnKey("lastName"); assertNotSame(-1, columnKey); assertEquals(RealmFieldType.STRING, table.getColumnType(columnKey)); }

Target:
public void shouldGetColumnInformation() { assertEquals(2, table.getColumnCount()); long columnKey = table.getColumnKey("lastName"); assertNotSame(Table.NO_MATCH, columnKey); assertEquals(RealmFieldType.STRING, table.getColumnType(columnKey)); }
Source:
public boolean equals(Object obj) { if (!(obj instanceof DependencyEvent)) { return false; } DependencyEvent other = (DependencyEvent) obj; return Objects.equals(fTrace, other.fTrace) && Objects.equals(fTimestamp, other.fTimestamp); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof DependencyEvent)) { return false; } DependencyEvent other = (DependencyEvent) obj; return Objects.equals(fTrace, other.fTrace) && Objects.equals(fTimestamp, other.fTimestamp); }
Source:
private void setHtmlTextOrHide(String value, TextView tv) { if (value != null) { tv.setText(Html.fromHtml(value)); } else { tv.setVisibility(View.GONE); } }

Target:
private void setHtmlTextOrHide(String value, TextView tv) { if (!TextUtils.isEmpty(value)) { tv.setText(Html.fromHtml(value)); } else { tv.setVisibility(View.GONE); } }
Source:
protected void executeQueryCommand() { List<GlusterVolumeEntity> eligibleVolumeList = new ArrayList<GlusterVolumeEntity>(); Guid masterVolumeId = getParameters().getVolumeId(); DbFacade dbFacadeInstance = getDbFacade(); List<VDSGroup> vdsGroups = dbFacadeInstance.getVdsGroupDao().getAll(); for (VDSGroup vdsGroup : vdsGroups) { if (vdsGroup.getId() != getGlusterVolumeDao().getById(masterVolumeId).getClusterId()) { List<GlusterVolumeEntity> volumes = getGlusterVolumeDao().getByClusterId(vdsGroup.getId()); for (GlusterVolumeEntity volume : volumes) { if (volume.getId() != masterVolumeId && volume.getStatus() == GlusterStatus.UP) { eligibleVolumeList.add(volume); } } } } getQueryReturnValue().setReturnValue(eligibleVolumeList); }

Target:
protected void executeQueryCommand() { List<GlusterVolumeEntity> eligibleVolumeList = new ArrayList<GlusterVolumeEntity>(); Guid masterVolumeId = getParameters().getVolumeId(); GlusterVolumeEntity masterVolume = getGlusterVolumeDao().getById(masterVolumeId); List<VDSGroup> vdsGroups = getDbFacade().getVdsGroupDao().getAll(); for (VDSGroup vdsGroup : vdsGroups) { if (vdsGroup.getId() != masterVolume.getClusterId() && vdsGroup.getcompatibility_version().equals(getDbFacade().getVdsGroupDao().get(masterVolume.getClusterId()).getcompatibility_version()) && vdsGroup.supportsGlusterService()) { List<GlusterVolumeEntity> volumes = getGlusterVolumeDao().getByClusterId(vdsGroup.getId()); for (GlusterVolumeEntity volume : volumes) { if (volume.getStatus() == GlusterStatus.UP && volume.getAdvancedDetails().getCapacityInfo().getUsedSize().equals(0L) && volume.getAdvancedDetails().getCapacityInfo().getFreeSize() >= masterVolume.getAdvancedDetails().getCapacityInfo().getUsedSize()) { eligibleVolumeList.add(volume); } } } } getQueryReturnValue().setReturnValue(eligibleVolumeList); }
Source:
public HelpLink getHelpLink() { return new HelpLink( "Reading statistical data using haven", "import_haven", false, true); }

Target:
public HelpLink getHelpLink() { return new HelpLink( "Reading data using haven", "import_haven", false, true); }
Source:
private static void setUpKeyStores() throws Exception { File workingDir = new File(WORKING_DIRECTORY_LOCATION); if (workingDir.exists() == false) { workingDir.mkdirs(); } SelfSignedX509CertificateAndSigningKey issuerSelfSignedX509CertificateAndSigningKey = createIssuer(); File trustFile = new File(workingDir, "ca.truststore"); KeyStore trustStore = createTrustStore(issuerSelfSignedX509CertificateAndSigningKey); File fireflyFile = new File(workingDir, "firefly.keystore"); KeyStore fireflyKeyStore = createFireflyKeyStore(issuerSelfSignedX509CertificateAndSigningKey); File localhostFile = new File(workingDir, "localhost.keystore"); KeyStore localhostKeyStore = createLocalhostKeyStore(issuerSelfSignedX509CertificateAndSigningKey); createTemporaryKeyStoreFile(trustStore, trustFile); createTemporaryKeyStoreFile(fireflyKeyStore, fireflyFile); createTemporaryKeyStoreFile(localhostKeyStore, localhostFile); File crlFile = new File(workingDir, "crl.pem"); X509CRLHolder crlHolder = createCRL(); createTemporaryCRLFile(crlHolder, crlFile); }

Target:
private static void setUpKeyStores() throws Exception { File workingDir = new File(WORKING_DIRECTORY_LOCATION); if (workingDir.exists() == false) { workingDir.mkdirs(); } SelfSignedX509CertificateAndSigningKey issuerSelfSignedX509CertificateAndSigningKey = createIssuer(); KeyStore trustStore = createTrustStore(issuerSelfSignedX509CertificateAndSigningKey); KeyStore fireflyKeyStore = createFireflyKeyStore(issuerSelfSignedX509CertificateAndSigningKey); KeyStore localhostKeyStore = createLocalhostKeyStore(issuerSelfSignedX509CertificateAndSigningKey); createTemporaryKeyStoreFile(trustStore, TRUST_FILE); createTemporaryKeyStoreFile(fireflyKeyStore, FIREFLY_FILE); createTemporaryKeyStoreFile(localhostKeyStore, LOCALHOST_FILE); X509CRLHolder crlHolder = createCRL(); createTemporaryCRLFile(crlHolder, CRL_FILE); }
Source:
public void shouldGetChangeInfo() throws Exception { StashPatchset patchset = new StashPatchset("a", "b", "c"); String url = StashConnector.createUrl(patchset, StashConnector.CHANGES_URL_FORMAT); stubFor(get(urlEqualTo(StashConnector.createUrl(patchset, StashConnector.CHANGES_URL_FORMAT))) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(getClass().getResourceAsStream("/stash-changes.json"))))); List<ReviewFile> files = fixture.listFiles(patchset); assertEquals(3, files.size()); verify(getRequestedFor(urlMatching(url))); }

Target:
public void shouldGetChangeInfo() throws Exception { StashPatchset patchset = new StashPatchset("a", "b", "c"); String url = StashConnector.createUrl(patchset, StashConnector.CHANGES_URL_FORMAT); stubFor(get(urlEqualTo(StashConnector.createUrl(patchset, StashConnector.CHANGES_URL_FORMAT))) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(getClass().getResourceAsStream("/stash-changes.json"))))); List<ReviewFile> files = fixture.listFiles(patchset); assertThat(files).hasSize(3); verify(getRequestedFor(urlMatching(url))); }
Source:
public void bookRoom(int roomNumber) throws Exception { Optional<Room> room = hotelDao.getById(roomNumber); if (room.isEmpty()) { throw new Exception("Room number: " + roomNumber + " does not exist"); } else { if (room.get().isBooked()) { throw new Exception("Room already booked!"); } else { Room updateRoomBooking = room.get(); updateRoomBooking.setBooked(true); hotelDao.update(updateRoomBooking); } } }

Target:
public void bookRoom(int roomNumber) throws Exception { var room = hotelDao.getById(roomNumber); if (room.isEmpty()) { throw new Exception("Room number: " + roomNumber + " does not exist"); } else { if (room.get().isBooked()) { throw new Exception("Room already booked!"); } else { var updateRoomBooking = room.get(); updateRoomBooking.setBooked(true); hotelDao.update(updateRoomBooking); } } }
Source:
@Test public void annotationsConflict() throws Exception { try { new Moshi.Builder().add(new AnnotationsConflictJsonAdapter()); fail(); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage()).contains("Conflicting @ToJson methods"); } }

Target:
@Test public void annotationsConflict() throws Exception { try { new Moshi.Builder().add(new AnnotationsConflictJsonAdapter()); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessageContaining("Conflicting @ToJson methods"); } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } IndexInfo other = (IndexInfo) obj; if (dropDuplicates != other.dropDuplicates) { return false; } if (indexFields == null) { if (other.indexFields != null) { return false; } } else if (!indexFields.equals(other.indexFields)) { return false; } if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } if (sparse != other.sparse) { return false; } if (unique != other.unique) { return false; } if (language == null) { if (other.language != null) { return false; } } else if (!language.equals(other.language)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } IndexInfo other = (IndexInfo) obj; if (dropDuplicates != other.dropDuplicates) { return false; } if (indexFields == null) { if (other.indexFields != null) { return false; } } else if (!indexFields.equals(other.indexFields)) { return false; } if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } if (sparse != other.sparse) { return false; } if (unique != other.unique) { return false; } if (!ObjectUtils.nullSafeEquals(language, other.language)) { return false; } return true; }