auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Timeline getTimelineForNight(@Scope(OAuthScope.SLEEP_TIMELINE) final AccessToken accessToken, @PathParam("date") final String night) { final DateTime targetDate = DateTimeUtil.ymdStringToDateTime(night); final Optional<TimelineResult> timeline = timelineProcessor.retrieveTimelinesFast(accessToken.accountId, targetDate); if(!timeline.isPresent()) { return Timeline.createEmpty(targetDate); } if (timeline.get().logV2.isPresent()) { final TimelineLogV2 logV2 = timeline.get().logV2.get(); final String partitionKey = logV2.getParitionKey(); timelineLogDAOV2.putAsync(partitionKey, logV2.toProtoBuf()); timelineLogDAO.putTimelineLog(accessToken.accountId, logV2.getAsV1Log()); } final TimelineResult timelineResult = timeline.get(); return Timeline.fromV1(timelineResult.timelines.get(0), timelineResult.notEnoughData); }

Target:
public Timeline getTimelineForNight(@Scope(OAuthScope.SLEEP_TIMELINE) final AccessToken accessToken, @PathParam("date") final String night) { final DateTime targetDate = DateTimeUtil.ymdStringToDateTime(night); final Optional<TimelineResult> timeline = timelineProcessor.retrieveTimelinesFast(accessToken.accountId, targetDate); if(!timeline.isPresent()) { return Timeline.createEmpty(targetDate); } if (timeline.get().logV2.isPresent()) { final TimelineLog logV2 = timeline.get().logV2.get(); final String partitionKey = logV2.getParitionKey(); timelineLogDAOV2.putAsync(partitionKey, logV2.toProtoBuf()); timelineLogDAO.putTimelineLog(accessToken.accountId, logV2.getAsV1Log()); } final TimelineResult timelineResult = timeline.get(); return Timeline.fromV1(timelineResult.timelines.get(0), timelineResult.notEnoughData); }
Source:
public void onAttachOrDetach(AttachEvent event) { if (!event.isAttached()) { handlers_.removeHandler(); if (documentChangedHandler_ != null) { documentChangedHandler_.removeHandler(); documentChangedHandler_ = null; } } else { handlers_ = new HandlerRegistrations( editor_.addEditorModeChangedHandler(this), editor_.addAttachHandler(this)); if (!highlightPatterns_.isEmpty()) { documentChangedHandler_ = editor_.addDocumentChangedHandler(this); synchronizeFrom(0); } } }

Target:
public void onAttachOrDetach(AttachEvent event) { handlers_.removeHandler(); if (!event.isAttached()) { if (documentChangedHandler_ != null) { documentChangedHandler_.removeHandler(); documentChangedHandler_ = null; } } else { handlers_ = new HandlerRegistrations( editor_.addEditorModeChangedHandler(this), editor_.addAttachHandler(this)); if (!highlightPatterns_.isEmpty()) { documentChangedHandler_ = editor_.addDocumentChangedHandler(this); synchronizeFrom(0); } } }
Source:
public Object execute(ApiDefinition apiDefinition, String objectId, ParamsMap paramsMap) throws MambuApiException { if (apiDefinition == null) { throw new IllegalArgumentException("ApiDefinition cannot be NULL"); } String urlString = makeUrl(apiDefinition, objectId); if (apiDefinition.getWithFullDetails()) { if (paramsMap == null) { paramsMap = new ParamsMap(); } paramsMap.put(APIData.FULL_DETAILS, "true"); } Method method = apiDefinition.getMethod(); ContentType contentType = apiDefinition.getContentType(); String jsonResponse = mambuAPIService.executeRequest(urlString, paramsMap, method, contentType); Class<?> returnClass = apiDefinition.getReturnClass(); ApiReturnFormat returnFormat = apiDefinition.getApiReturnFormat(); Object result = null; switch (returnFormat) { case OBJECT: result = getObject(jsonResponse, returnClass); break; case COLLECTION: Type collectionType = getCollectionType(returnClass); result = getCollection(jsonResponse, collectionType); break; case BOOLEAN: result = getBoolean(jsonResponse); break; case RESPONSE_STRING: result = jsonResponse; break; } return result; }

Target:
public <R> R execute(ApiDefinition apiDefinition, String objectId, ParamsMap paramsMap) throws MambuApiException { if (apiDefinition == null) { throw new IllegalArgumentException("ApiDefinition cannot be NULL"); } String apiUrlPath = getApiPath(apiDefinition, objectId); if (apiDefinition.getWithFullDetails()) { if (paramsMap == null) { paramsMap = new ParamsMap(); } paramsMap.put(APIData.FULL_DETAILS, "true"); } Method method = apiDefinition.getMethod(); ContentType contentType = apiDefinition.getContentType(); String jsonResponse = mambuAPIService.executeRequest(apiUrlPath, paramsMap, method, contentType); Class<?> returnClass = apiDefinition.getReturnClass(); ApiReturnFormat returnFormat = apiDefinition.getApiReturnFormat(); R result = null; switch (returnFormat) { case OBJECT: result = getObject(jsonResponse, returnClass); break; case COLLECTION: Type collectionType = getCollectionType(returnClass); result = getCollection(jsonResponse, collectionType); break; case BOOLEAN: result = (R) getBoolean(jsonResponse); break; case RESPONSE_STRING: result = (R) jsonResponse; break; } return result; }
Source:
private void addAuthorizedAddress(SocketAddress address) { synchronized (authorizedAddressesSyncRoot) { if (authorizedAddresses.contains(address)) { return; } logger.info("Adding allowed address: " + address); Set<SocketAddress> newSet = Collections.newSetFromMap( new ConcurrentHashMap<SocketAddress, Boolean>()); newSet.addAll(authorizedAddresses); newSet.add(address); authorizedAddresses = newSet; } }

Target:
private void addAuthorizedAddress(SocketAddress address) { synchronized (authorizedAddressesSyncRoot) { if (authorizedAddresses.contains(address)) { return; } logger.info("Adding allowed address: " + address); Set<SocketAddress> newSet = new HashSet<>(); newSet.addAll(authorizedAddresses); newSet.add(address); authorizedAddresses = newSet; } }
Source:
public <T> T parseProcessed(final Class<T> type) throws LightblueResponseParseException { if (hasError()) { throw new LightblueErrorResponseException("Error returned in response: " + getText()); } try { JsonNode errorCode = json.path("errorCode"); if (errorCode != null && !errorCode.isNull() && !errorCode.isMissingNode()){ throw new LightblueResponseParseException("Error parsing lightblue response: Error returned. JSON returned:" + json.toString() + "\n"); } JsonNode processedNode = json.path("processed"); if (processedNode == null || processedNode.isNull() || processedNode.isMissingNode() || (processedNode.isArray() && !((ArrayNode) processedNode).iterator().hasNext())) { if (type.isArray()) { return (T) Array.newInstance(type.getComponentType(), 0); } return null; } return mapper.readValue(processedNode.traverse(), type); } catch (RuntimeException | IOException e) { throw new LightblueResponseParseException("Error parsing lightblue response: " + getText() + "\n", e); } }

Target:
public <T> T parseProcessed(final Class<T> type) throws LightblueResponseParseException { if (hasError()){ throw new LightblueErrorResponseException("Error parsing lightblue response: Error returned. JSON returned:" + json.toString() + "\n"); } try { JsonNode processedNode = json.path("processed"); if (processedNode == null || processedNode.isNull() || processedNode.isMissingNode() || (processedNode.isArray() && !((ArrayNode) processedNode).iterator().hasNext())) { if (type.isArray()) { return (T) Array.newInstance(type.getComponentType(), 0); } return null; } return mapper.readValue(processedNode.traverse(), type); } catch (RuntimeException | IOException e) { throw new LightblueResponseParseException("Error parsing lightblue response: " + json.toString() + "\n", e); } }
Source:
public ListenableFuture<List<ChunkInfo>> commit() { checkState(!committed, "already committed"); committed = true; flush(); return whenAllComplete(futures).call(() -> { for (ChunkInfo chunk : chunks) { writeChunk(chunk.getChunkId()); } return ImmutableList.copyOf(chunks); }, commitExecutor); }

Target:
public ListenableFuture<List<ChunkInfo>> commit() { checkState(!committed, "already committed"); committed = true; flush(); return whenAllSucceed(chunkStoreJobs).call(() -> { for (ChunkInfo chunk : chunks) { writeChunk(chunk.getChunkId()); } return ImmutableList.copyOf(chunks); }, commitExecutor); }
Source:
private static void extractNamespaces(RouteDefinition route, Map<String, String> namespaces) { Iterator<ExpressionNode> it = filterTypeInOutputs(route.getOutputs(), ExpressionNode.class); while (it.hasNext()) { ExpressionNode en = it.next(); ExpressionDefinition ed = en.getExpression(); NamespaceAware na = null; Expression exp = ed.getExpressionValue(); if (exp != null && exp instanceof NamespaceAware) { na = (NamespaceAware) exp; } else if (ed instanceof NamespaceAware) { na = (NamespaceAware) ed; } if (na != null) { Map<String, String> map = na.getNamespaces(); if (map != null && !map.isEmpty()) { namespaces.putAll(map); } } } }

Target:
private static void extractNamespaces(RouteDefinition route, Map<String, String> namespaces) { Iterator<ExpressionNode> it = filterTypeInOutputs(route.getOutputs(), ExpressionNode.class); while (it.hasNext()) { NamespaceAware na = getNamespaceAwareFromExpression(it.next()); if (na != null) { Map<String, String> map = na.getNamespaces(); if (map != null && !map.isEmpty()) { namespaces.putAll(map); } } } }
Source:
public void testExecuteQueryCommand() { GetDiskImageByDiskAndImageIdsParameters params = getQueryParameters(); when(params.getDiskId()).thenReturn(diskId); when(params.getImageId()).thenReturn(imageId); when(diskImageDao.getDiskImageByDiskAndImageIds(diskId, imageId)).thenReturn(diskImage); GetDiskImageByDiskAndImageIdsQuery<GetDiskImageByDiskAndImageIdsParameters> query = getQuery(); query.executeQueryCommand(); DiskImage returnDiskImage = query.getQueryReturnValue().getReturnValue(); assertTrue(returnDiskImage.equals(diskImage)); }

Target:
public void testExecuteQueryCommand() { GetDiskImageByDiskAndImageIdsParameters params = getQueryParameters(); when(params.getDiskId()).thenReturn(diskId); when(params.getImageId()).thenReturn(imageId); when(diskImageDao.getDiskImageByDiskAndImageIds(diskId, imageId)).thenReturn(diskImage); GetDiskImageByDiskAndImageIdsQuery<GetDiskImageByDiskAndImageIdsParameters> query = getQuery(); query.executeQueryCommand(); DiskImage returnDiskImage = query.getQueryReturnValue().getReturnValue(); assertEquals(returnDiskImage, diskImage); }
Source:
protected List<?> createOperationSet() { List<?> selection = getSelectedObjects(); if (selection.isEmpty() || !(selection.get(0) instanceof IGraphicalEditPart)) { selection = Collections.EMPTY_LIST; } else { selection = ToolUtilities.getSelectionWithoutDependants(selection); selection = Lists.newArrayList(Iterables.filter(selection, Predicates.not(Predicates.instanceOf(ConnectionEditPart.class)))); if (selection.size() < 3) { selection = Collections.EMPTY_LIST; } else { EditPart parent = ((EditPart) selection.get(0)).getParent(); int sideOfFirstSelection = PositionConstants.NONE; if (selection.get(0) instanceof IBorderItemEditPart) { sideOfFirstSelection = ((IBorderItemEditPart) selection.get(0)).getBorderItemLocator().getCurrentSideOfParent(); if (!isHorizontalAxisAuthorizedForBorderNode(sideOfFirstSelection) && !isVerticalAxisAuthorizedForBorderNode(sideOfFirstSelection)) { selection = Collections.EMPTY_LIST; } } for (int i = 1; i < selection.size(); i++) { EditPart part = (EditPart) selection.get(i); if (part.getParent() != parent) { selection = Collections.EMPTY_LIST; break; } else if (sideOfFirstSelection != PositionConstants.NONE && !isABorderNodeOnSameAxis(part, sideOfFirstSelection)) { selection = Collections.EMPTY_LIST; break; } else if (part instanceof IGraphicalEditPart) { EditPartQuery containerLayoutQuery = new EditPartQuery((IGraphicalEditPart) part); if (containerLayoutQuery.isFreeFormContainerChildrenPresentation()) { selection = Collections.EMPTY_LIST; break; } } } } } return selection; }

Target:
protected List<?> createOperationSet() { List<?> selection = getSelectedObjects(); if (selection.isEmpty() || !(selection.get(0) instanceof IGraphicalEditPart)) { selection = Collections.EMPTY_LIST; } else { selection = ToolUtilities.getSelectionWithoutDependants(selection); selection = Lists.newArrayList(Iterables.filter(selection, Predicates.not(Predicates.instanceOf(ConnectionEditPart.class)))); if (selection.size() < 3) { selection = Collections.EMPTY_LIST; } else { EditPart parent = ((EditPart) selection.get(0)).getParent(); int sideOfFirstSelection = PositionConstants.NONE; if (selection.get(0) instanceof IBorderItemEditPart) { sideOfFirstSelection = ((IBorderItemEditPart) selection.get(0)).getBorderItemLocator().getCurrentSideOfParent(); if (!isHorizontalAxisAuthorizedForBorderNode(sideOfFirstSelection) && !isVerticalAxisAuthorizedForBorderNode(sideOfFirstSelection)) { selection = Collections.EMPTY_LIST; } } for (int i = 1; i < selection.size(); i++) { EditPart part = (EditPart) selection.get(i); if (part.getParent() != parent) { selection = Collections.EMPTY_LIST; break; } else if (sideOfFirstSelection != PositionConstants.NONE && !isABorderNodeOnSameAxis(part, sideOfFirstSelection)) { selection = Collections.EMPTY_LIST; break; } else if (part instanceof IGraphicalEditPart) { EditPartQuery containerLayoutQuery = new EditPartQuery((IGraphicalEditPart) part); if (!containerLayoutQuery.isFreeFormContainerChildrenPresentation()) { selection = Collections.EMPTY_LIST; break; } } } } } return selection; }
Source:
public ValidationResult memoryOptimizationConfiguration(){ return ValidationResult.failWith(EngineMessage.CLUSTER_TO_ALLOW_MEMORY_OPTIMIZATION_YOU_MUST_ALLOW_KSM_AND_BALLOONING) .when((cluster.getMaxVdsMemoryOverCommit() > 100 || cluster.getMaxVdsMemoryOverCommit() <=0) && !(cluster.isEnableKsm() || cluster.isEnableBallooning())); }

Target:
public ValidationResult memoryOptimizationConfiguration(){ return ValidationResult.failWith(EngineMessage.CLUSTER_TO_ALLOW_MEMORY_OPTIMIZATION_YOU_MUST_ALLOW_KSM_OR_BALLOONING) .when((cluster.getMaxVdsMemoryOverCommit() > 100 || cluster.getMaxVdsMemoryOverCommit() <=0) && !(cluster.isEnableKsm() || cluster.isEnableBallooning())); }
Source:
private static BackgroundHiveSplitLoader backgroundHiveSplitLoader( List<LocatedFileStatus> files, TupleDomain<HiveColumnHandle> compactEffectivePredicate, Optional<HiveBucketFilter> hiveBucketFilter, Table table, Optional<HiveBucketHandle> bucketHandle) { List<HivePartitionMetadata> hivePartitionMetadatas = ImmutableList.of( new HivePartitionMetadata( new HivePartition(new SchemaTableName("testSchema", "table_name")), Optional.empty(), ImmutableMap.of(), false)); ConnectorSession connectorSession = new TestingConnectorSession( new HiveSessionProperties(new HiveClientConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE)), new OrcFileWriterConfig()).getSessionProperties()); return new BackgroundHiveSplitLoader( table, hivePartitionMetadatas, compactEffectivePredicate, createBucketSplitInfo(bucketHandle, hiveBucketFilter), connectorSession, new TestingHdfsEnvironment(), new NamenodeStats(), new TestingDirectoryLister(files), EXECUTOR, 2, false); }

Target:
private static BackgroundHiveSplitLoader backgroundHiveSplitLoader( List<LocatedFileStatus> files, TupleDomain<HiveColumnHandle> compactEffectivePredicate, Optional<HiveBucketFilter> hiveBucketFilter, Table table, Optional<HiveBucketHandle> bucketHandle) { List<HivePartitionMetadata> hivePartitionMetadatas = ImmutableList.of( new HivePartitionMetadata( new HivePartition(new SchemaTableName("testSchema", "table_name")), Optional.empty(), ImmutableMap.of(), false)); ConnectorSession connectorSession = new TestingConnectorSession( new HiveSessionProperties(new HiveClientConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE)), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties()); return new BackgroundHiveSplitLoader( table, hivePartitionMetadatas, compactEffectivePredicate, createBucketSplitInfo(bucketHandle, hiveBucketFilter), connectorSession, new TestingHdfsEnvironment(), new NamenodeStats(), new TestingDirectoryLister(files), EXECUTOR, 2, false); }
Source:
public void run() { long iteration = 0; long count = 0; while (!testContext.isStopped()) { sleepRandom(random, maxPublicationDelayNanos); int index = random.nextInt(topics.length); ITopic topic = topics[index]; long msg = nextMessage(); count += msg; topic.publish(msg); if (iteration % logFrequency == 0) { log.info(Thread.currentThread().getName() + " At iteration: " + iteration); } if (iteration % performanceUpdateFrequency == 0) { operations.addAndGet(performanceUpdateFrequency); } iteration++; } for (ITopic topic : topics) { topic.publish(-1l); } totalExpectedCounter.addAndGet(count); }

Target:
public void run() { long iteration = 0; long count = 0; while (!testContext.isStopped()) { sleepRandomNanos(random, maxPublicationDelayNanos); ITopic topic = getRandomTopic(); long msg = nextMessage(); count += msg; topic.publish(msg); if (iteration % logFrequency == 0) { log.info(Thread.currentThread().getName() + " At iteration: " + iteration); } if (iteration % performanceUpdateFrequency == 0) { operations.addAndGet(performanceUpdateFrequency); } iteration++; } totalExpectedCounter.addAndGet(count); }
Source:
private void createFloatAccessor() { accessors.put(Float.class, new Accessor<Float>() { @Override public Float get(String key, Float defaultValue) { return preferences.getFloat(key, (defaultValue == null) ? 0f : defaultValue); } @Override public void put(String key, Float value) { editor.putFloat(key, value).apply(); } }); }

Target:
private void createFloatAccessor() { accessors.put(Float.class, new Accessor<Float>() { @Override public Float get(String key) { return preferences.getFloat(key, 0f); } @Override public void put(String key, Float value) { editor.putFloat(key, value).apply(); } }); }
Source:
public void testFilterWithString() { mockFilterObserver.setName("St"); assert mockFilterObserver.getFilteredInstalledApplications().size() == 1; }

Target:
public void testFilterWithString() { mockFilterObserver.setName("St"); assertEquals(1, mockFilterObserver.getFilteredInstalledApplications().size()); }
Source:
public boolean createEObjectDescriptions(EObject eObject, IAcceptor<IEObjectDescription> acceptor) { if (eObject instanceof PatternModel) { } else if (eObject instanceof Pattern) { QualifiedName qualifiedName = getQualifiedNameProvider().getFullyQualifiedName(eObject); if (qualifiedName != null) { acceptor.accept(EObjectDescription.create(qualifiedName, eObject, getUserData((Pattern) eObject))); } return false; } return super.createEObjectDescriptions(eObject, acceptor); }

Target:
public boolean createEObjectDescriptions(EObject eObject, IAcceptor<IEObjectDescription> acceptor) { if (eObject instanceof Pattern) { QualifiedName qualifiedName = getQualifiedNameProvider().getFullyQualifiedName(eObject); if (qualifiedName != null) { acceptor.accept(EObjectDescription.create(qualifiedName, eObject, getUserData((Pattern) eObject))); } return false; } return super.createEObjectDescriptions(eObject, acceptor); }
Source:
private static void copySenderMessages(ExecutionCourse executionCourseFrom, ExecutionCourse executionCourseTo) { if (executionCourseFrom.getSender() != null) { ExecutionCourseSender courseSenderTo = ExecutionCourseSender.newInstance(executionCourseTo); courseSenderTo.getMessagesSet().addAll(executionCourseFrom.getSender().getMessagesSet()); executionCourseFrom.getSender().delete(); } }

Target:
private static void copySenderMessages(ExecutionCourse executionCourseFrom, ExecutionCourse executionCourseTo) { if (executionCourseFrom.getSender() != null) { ExecutionCourseSender courseSenderTo = ExecutionCourseSender.newInstance(executionCourseTo); courseSenderTo.getMessagesSet().addAll(executionCourseFrom.getSender().getMessagesSet()); executionCourseFrom.getSender().getMessagesSet().stream().forEach(m -> m.getRecipientsSet().clear()); executionCourseFrom.getSender().delete(); } }
Source:
private void handleException(Exception e, HttpServletResponse resp) throws IOException { if (e instanceof InvalidRequestException || e instanceof CodecException) { LOG.warn("Invalid request", e); resp.setStatus(HttpServletResponse.SC_BAD_REQUEST); resp.getWriter().append("Invalid request:").append(e.getMessage()).flush(); } else if (e instanceof RequestRejectedException) { LOG.warn("Request rejected", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Request rejected:").append(e.getMessage()).flush(); } else if (e instanceof RequestCanceledException) { LOG.warn("Request cancelled", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Request cancelled:").append(e.getMessage()).flush(); } else if (e instanceof InvalidResponseException) { LOG.warn("Invalid response", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Invalid Response:").append(e.getMessage()).flush(); } else if (e instanceof InterruptedException) { LOG.warn("Thread Interrupted", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Thread Interrupted:").append(e.getMessage()).flush(); } else if (e instanceof ClientSleepingException) { LOG.warn("Client is sleeping", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Client is sleeping:").append(e.getMessage()).flush(); } else { LOG.warn("Unexpected exception", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Unexpected exception:").append(e.getMessage()).flush(); } }

Target:
private void handleException(Exception e, HttpServletResponse resp) throws IOException { if (e instanceof InvalidRequestException || e instanceof CodecException || e instanceof ClientSleepingException) { LOG.warn("Invalid request", e); resp.setStatus(HttpServletResponse.SC_BAD_REQUEST); resp.getWriter().append("Invalid request:").append(e.getMessage()).flush(); } else if (e instanceof RequestRejectedException) { LOG.warn("Request rejected", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Request rejected:").append(e.getMessage()).flush(); } else if (e instanceof RequestCanceledException) { LOG.warn("Request cancelled", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Request cancelled:").append(e.getMessage()).flush(); } else if (e instanceof InvalidResponseException) { LOG.warn("Invalid response", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Invalid Response:").append(e.getMessage()).flush(); } else if (e instanceof InterruptedException) { LOG.warn("Thread Interrupted", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Thread Interrupted:").append(e.getMessage()).flush(); } else { LOG.warn("Unexpected exception", e); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); resp.getWriter().append("Unexpected exception:").append(e.getMessage()).flush(); } }
Source:
private ProgramEnrollmentListResult prepareProgramEnrollmentListResult(List<ProgramEnrollment> programEnrollments, Map<String, String> lookupFields) { ProgramEnrollmentListResult result = new ProgramEnrollmentListResult(); String programName = lookupFields.get(PROGRAM_NAME); String patientUuid = lookupFields.get(PATIENT_UUID); result.setResults(filterPrograms(programEnrollments, programName, lookupFields.get(ACTIVE_PROGRAM))); if (result.getNumberOfPrograms() > 1) { LOGGER.warn(String.format("Multiple program enrollment found with the patient UUID \"%s\" and program name" + " \"%s\".", patientUuid, programName)); } return result; }

Target:
private ProgramEnrollmentListResult prepareProgramEnrollmentListResult(List<ProgramEnrollment> programEnrollments, Map<String, String> lookupFields) { ProgramEnrollmentListResult result = new ProgramEnrollmentListResult(); String programName = lookupFields.get(PROGRAM_NAME); result.setResults(filterPrograms(programEnrollments, programName, lookupFields.get(ACTIVE_PROGRAM))); return result; }
Source:
byte[] readEntryFromStream(JarInputStream jarIn) throws IOException { int totalRead = 0; while (jarIn.available() == 1) { int bytesToRead = m_array.length - totalRead; assert (bytesToRead > 0); int readSize = jarIn.read(m_array, totalRead, bytesToRead); if (readSize < 0) { break; } totalRead += readSize; if (readSize == bytesToRead && (jarIn.available() == 1)) { byte[] tmpArray = new byte[2 * m_array.length]; System.arraycopy(m_array, 0, tmpArray, 0, totalRead); m_array = tmpArray; } } byte trimmedBytes[] = new byte[totalRead]; System.arraycopy(m_array, 0, trimmedBytes, 0, totalRead); return trimmedBytes; }

Target:
byte[] readEntryFromStream(JarInputStream jarIn) throws IOException { int totalRead = 0; while (jarIn.available() == 1) { int bytesToRead = m_array.length - totalRead; assert (bytesToRead > 0); int readSize = jarIn.read(m_array, totalRead, bytesToRead); if (readSize > 0) { totalRead += readSize; if (readSize == bytesToRead && (jarIn.available() == 1)) { byte[] tmpArray = new byte[2 * m_array.length]; System.arraycopy(m_array, 0, tmpArray, 0, totalRead); m_array = tmpArray; } } } byte trimmedBytes[] = new byte[totalRead]; System.arraycopy(m_array, 0, trimmedBytes, 0, totalRead); return trimmedBytes; }
Source:
public void setParentNames(String names) { parents = new ArrayList<NameKey>(); for (String n : names) parents.add(new NameKey(n)); }

Target:
public void setParentNames(String names) { parents = new ArrayList<NameKey>(names.length); for (String n : names) { parents.add(new NameKey(n)); } }
Source:
public String getCallbackAddress() { String addr = this.getCallbackParam().getRemoteAddress(); boolean isSecure = this.getCallbackParam().isSecure(); String schema = isSecure ? "https" : "http"; if (addr.contains(":")) { return schema + "://[" + addr + "]:" + actualPort + "/"; } return schema + "://" + addr + ":" + actualPort + "/"; }

Target:
public String getCallbackAddress() { String addr = this.getCallbackParam().getRemoteAddress(); boolean ipv6 = addr.contains(":"); String hostname = ipv6 ? "[" + addr + "]" : addr; boolean isSecure = this.getCallbackParam().isSecure(); String scheme = isSecure ? "https" : "http"; return scheme + "://" + hostname + ":" + actualPort + "/"; }
Source:
protected Object readResolve() { buildLock = new ReentrantReadWriteLock(); return this; }

Target:
protected Object readResolve() { buildLock = new ReentrantLock(); return this; }
Source:
private static BatteryField getMjBattery (Class c) { if (!MjBatteries.containsKey(c)) { for (Field f : c.getDeclaredFields()) { MjBattery battery = f.getAnnotation (MjBattery.class); if (battery != null) { try{ c.getMethod(f.getName() + "_$eq", double.class); f.setAccessible(true); }catch(NoSuchMethodException e){ } if (!f.isAccessible()) { continue; } BatteryField bField = new BatteryField(); bField.field = f; bField.battery = battery; if (f.getType().equals(double.class)) { bField.kind = BatteryKind.Value; } else if (f.getType().isPrimitive()) { throw new RuntimeException( "MJ battery needs to be object or double type"); } else { bField.kind = BatteryKind.Container; } MjBatteries.put(c, bField); return bField; } } MjBatteries.put(c, null); return null; } else { return MjBatteries.get(c); } }

Target:
private static BatteryField getMjBattery (Class c) { if (!MjBatteries.containsKey(c)) { for (Field f : c.getDeclaredFields()) { MjBattery battery = f.getAnnotation (MjBattery.class); if (battery != null) { for (Method method : c.getMethods()) { if (method.getName().equals(f.getName() + "_$eq")) { f.setAccessible(true); break; } } if (f.isAccessible() || Modifier.isPublic(f.getModifiers())) { BatteryField bField = new BatteryField(); bField.field = f; bField.battery = battery; if (f.getType().equals(double.class)) { bField.kind = BatteryKind.Value; } else if (f.getType().isPrimitive()) { throw new RuntimeException( "MJ battery needs to be object or double type"); } else { bField.kind = BatteryKind.Container; } MjBatteries.put(c, bField); return bField; } } } MjBatteries.put(c, null); return null; } else { return MjBatteries.get(c); } }
Source:
private void purgeObjectContentAndDb(RepoObject repoObject, ElementFilter elementFilter) throws RepoException { try { try (InputStream content = getObjectInputStream(repoObject)){ if (content == null){ throw new RepoException(RepoException.Type.ObjectNotFound); } } catch (IOException e) { throw new RepoException(e); } if (sqlService.markObjectPurged(repoObject.getKey(), repoObject.getBucketName(), elementFilter.getVersion(), elementFilter.getVersionChecksum(), elementFilter.getTag()) == 0 ){ throw new RepoException(RepoException.Type.ObjectNotFound); } if (sqlService.countUsedAndDeletedObjectsReference(repoObject.getBucketName(), repoObject.getChecksum()) == 0 ){ Boolean removed = objectStore.deleteObject(repoObject); if (Boolean.FALSE.equals(removed)){ throw new RepoException(RepoException.Type.ObjectNotFound); } } } catch (SQLException e) { throw new RepoException(e); } }

Target:
private void purgeObjectContentAndDb(RepoObject repoObject, ElementFilter elementFilter) throws RepoException { try { try (InputStream content = getObjectInputStream(repoObject)){ if (content == null){ throw new RepoException(RepoException.Type.ObjectNotFound); } } catch (IOException e) { throw new RepoException(e); } int objectPurged = sqlService.markObjectPurged(repoObject.getKey(), repoObject.getBucketName(), elementFilter.getVersion(), elementFilter.getVersionChecksum(), elementFilter.getTag()); if (objectPurged == 0){ throw new RepoException(RepoException.Type.ObjectNotFound); } if (sqlService.countUsedAndDeletedObjectsReference(repoObject.getBucketName(), repoObject.getChecksum()) == 0 ){ Boolean removed = objectStore.deleteObject(repoObject); if (!removed){ throw new RepoException(RepoException.Type.ObjectNotFound); } } } catch (SQLException e) { throw new RepoException(e); } }
Source:
public void manipulateTaskDataConcurrently() throws Exception { File file = newTaskDataZipFile(); TaskData data = newTaskData(); List<Throwable> failures = runConcurrently( store -> store.getTaskDataState(file), store -> store.discardEdits(file), store -> store.putEdits(file, data), store -> store.putTaskData(file, data, true, true), store -> store.setTaskData(file, data), store -> store.putTaskData(file, TEST_STATE), store -> store.deleteTaskData(file)); assertNoFailures(failures); }

Target:
public void manipulateTaskDataConcurrently() throws Exception { File file = newTaskDataZipFile(); for (int i = 0; i <= 10; i++) { List<Throwable> failures = runConcurrently( getTaskDataState(file), discardEdits(file), putEdits(file), putTaskData(file), setTaskData(file), putTaskDataState(file), deleteTaskData(file)); assertNoFailures(failures); } }
Source:
public AuditLogType getAuditLogTypeValue() { return getSucceeded() ? AuditLogType.USER_UPDATED_MOM_POLICIES : null; }

Target:
public AuditLogType getAuditLogTypeValue() { return getSucceeded() ? AuditLogType.USER_UPDATED_MOM_POLICIES : AuditLogType.USER_FAILED_TO_UPDATE_MOM_POLICIES; }
Source:
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { switch (requestCode) { case RequestCodes.CRED_HINT: if (resultCode == Activity.RESULT_OK) { handleCredential((Credential) data.getParcelableExtra(Credential.EXTRA_KEY)); } else { startAuthMethodChoice(); } break; case RequestCodes.AUTH_PICKER_FLOW: case RequestCodes.EMAIL_FLOW: case RequestCodes.PHONE_FLOW: case RequestCodes.PROVIDER_FLOW: IdpResponse response = IdpResponse.fromResultIntent(data); if (response == null) { setResult(Resource.<IdpResponse>forFailure(new UserCancellationException())); } else if (response.isSuccessful()) { setResult(Resource.forSuccess(response)); } else { if (response.getError().getErrorCode() == ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT) { setResult(Resource.<IdpResponse>forFailure(new FirebaseAuthAnonymousUpgradeException( ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT, response))); } else { setResult(Resource.<IdpResponse>forFailure(response.getError())); } } } }

Target:
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { switch (requestCode) { case RequestCodes.CRED_HINT: if (resultCode == Activity.RESULT_OK) { handleCredential((Credential) data.getParcelableExtra(Credential.EXTRA_KEY)); } else { startAuthMethodChoice(); } break; case RequestCodes.AUTH_PICKER_FLOW: case RequestCodes.EMAIL_FLOW: case RequestCodes.PHONE_FLOW: case RequestCodes.PROVIDER_FLOW: IdpResponse response = IdpResponse.fromResultIntent(data); if (response == null) { setResult(Resource.<IdpResponse>forFailure(new UserCancellationException())); } else if (response.isSuccessful()) { setResult(Resource.forSuccess(response)); } else if (response.getError().getErrorCode() == ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT) { handleMergeFailure(response); } else { setResult(Resource.<IdpResponse>forFailure(response.getError())); } } }
Source:
public void put(@Nonnull User user, @Nonnull String accessToken) { Log.debug("Populating the cache for username: " + user.getId()); try { user.addProperty(new GithubAccessTokenProperty(accessToken)); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public static void put(@Nonnull User user, @Nonnull String accessToken) { Log.debug("Populating the cache for username: " + user.getId()); try { user.addProperty(new GithubAccessTokenProperty(accessToken)); } catch (IOException e) { Log.warn("Received an exception when trying to add the GitHub access token to the user: " + user.getId(), e); } }
Source:
private void initDimensionHandlers() { for (String dim : availableDimensions) { if (Strings.isNullOrEmpty(dim)) { continue; } ColumnCapabilities capabilities = getColumn(dim).getCapabilities(); DimensionHandler handler = DimensionHandlerUtils.getHandlerFromCapabilities(dim, capabilities, null); dimensionHandlers.put(dim, handler); } }

Target:
private void initDimensionHandlers() { for (String dim : availableDimensions) { ColumnCapabilities capabilities = getColumn(dim).getCapabilities(); DimensionHandler handler = DimensionHandlerUtils.getHandlerFromCapabilities(dim, capabilities, null); dimensionHandlers.put(dim, handler); } }
Source:
private List<ResponseOutput> buildResponses( List<FeedbackResponseAttributes> responses, FeedbackSessionResultsBundle bundle) { Map<String, List<FeedbackResponseAttributes>> responsesMap = new HashMap<>(); for (FeedbackResponseAttributes response : responses) { responsesMap.computeIfAbsent(response.recipient, k -> new ArrayList<>()).add(response); } List<ResponseOutput> output = new ArrayList<>(); responsesMap.forEach((recipient, responsesForRecipient) -> { String recipientName = removeAnonymousHash(bundle.getNameForEmail(recipient)); String recipientTeam = bundle.getTeamNameForEmail(recipient); for (FeedbackResponseAttributes response : responsesForRecipient) { String giverName = removeAnonymousHash(bundle.getGiverNameForResponse(response)); String giverEmail = response.giverEmail; String giverTeam = bundle.getTeamNameForEmail(response.giver); output.add(new ResponseOutput(giverName, giverTeam, giverEmail, response.giverSection, recipientName, recipientTeam, response.recipientSection, response.responseDetails)); } }); return output; }

Target:
private List<ResponseOutput> buildResponses( List<FeedbackResponseAttributes> responses, FeedbackSessionResultsBundle bundle) { Map<String, List<FeedbackResponseAttributes>> responsesMap = new HashMap<>(); for (FeedbackResponseAttributes response : responses) { responsesMap.computeIfAbsent(response.recipient, k -> new ArrayList<>()).add(response); } List<ResponseOutput> output = new ArrayList<>(); responsesMap.forEach((recipient, responsesForRecipient) -> { String recipientName = removeAnonymousHash(bundle.getNameForEmail(recipient)); String recipientTeam = bundle.getTeamNameForEmail(recipient); for (FeedbackResponseAttributes response : responsesForRecipient) { String giverName = removeAnonymousHash(bundle.getGiverNameForResponse(response)); Map<String, Set<String>> teamNameToMembersEmailTable = bundle.rosterTeamNameMembersTable; String relatedGiverEmail = teamNameToMembersEmailTable.containsKey(response.giver) ? teamNameToMembersEmailTable.get(response.giver).iterator().next() : response.giver; String giverTeam = bundle.getTeamNameForEmail(response.giver); output.add(new ResponseOutput(giverName, giverTeam, relatedGiverEmail, response.giverSection, recipientName, recipientTeam, response.recipientSection, response.responseDetails)); } }); return output; }
Source:
public static List<Query> createProvidedQueriesForBusinessObject(final BusinessObject businessObject) { final List<Query> queries = new ArrayList<Query>(); final Set<String> queryNames = new HashSet<String>(); if (!containsQuertWithName(businessObject, getQueryName(Field.PERSISTENCE_ID))) { final Query query = createQueryForPersistenceId(businessObject); queries.add(query); queryNames.add(query.getName()); } for (final UniqueConstraint uc : businessObject.getUniqueConstraints()) { final Query query = createQueryForUniqueConstraint(businessObject, uc); queryNames.add(query.getName()); queries.add(query); } for (final Field f : businessObject.getFields()) { if (f instanceof SimpleField) { if (f.isCollection() == null || !f.isCollection()) { final String potentialConflictingQueryName = createQueryNameForField(f); if (!queryNames.contains(potentialConflictingQueryName)) { final Query query = createQueryForField(businessObject, f); queries.add(query); } } } } queries.add(createSelectAllQueryForBusinessObject(businessObject)); return queries; }

Target:
public static List<Query> createProvidedQueriesForBusinessObject(final BusinessObject businessObject) { final List<Query> queries = new ArrayList<Query>(); final Set<String> queryNames = new HashSet<String>(); if (!containsQueryWithName(businessObject, getQueryName(Field.PERSISTENCE_ID))) { final Query query = createQueryForPersistenceId(businessObject); queries.add(query); queryNames.add(query.getName()); } for (final UniqueConstraint uc : businessObject.getUniqueConstraints()) { final Query query = createQueryForUniqueConstraint(businessObject, uc); queryNames.add(query.getName()); queries.add(query); } for (final Field f : businessObject.getFields()) { if (f instanceof SimpleField) { if (f.isCollection() == null || !f.isCollection()) { final String potentialConflictingQueryName = createQueryNameForField(f); if (!queryNames.contains(potentialConflictingQueryName)) { final Query query = createQueryForField(businessObject, f); queries.add(query); } } } } queries.add(createSelectAllQueryForBusinessObject(businessObject)); return queries; }
Source:
public void testOTAForFactoryClockSyncIssueNoPillsHighUptime() { BaseResourceTestHelper.stubGetClientDetails(this.oAuthTokenStore, Optional.of(BaseResourceTestHelper.getAccessToken())); BaseResourceTestHelper.stubKeyFromKeyStore(this.keyStore, SENSE_ID, Optional.of(KEY)); BaseResourceTestHelper.stubGetHeader(this.httpServletRequest, HelloHttpHeader.SENSE_ID, SENSE_ID); stubGetUserInfo(this.mergedUserInfoDynamoDB, userInfoList); stubGetOTAWindowStart(otaConfiguration, 11); stubGetOTAWindowEnd(otaConfiguration, 20); stubGetPopulatedFirmwareFileListForGroup(this.firmwareUpdateStore, FeatureFlipper.OTA_RELEASE, FW_VERSION_0_9_22_RC7, fileList); final List<String> groups = Lists.newArrayList(); groups.add(FeatureFlipper.OTA_RELEASE); stubGetGroups(groupFlipper, groups); stubGetFeatureActive(featureFlipper, FeatureFlipper.ENABLE_OTA_UPDATES, groups, true); stubGetFeatureActive(featureFlipper, FeatureFlipper.OTA_RELEASE, groups, true); final byte[] data = this.receiveResource.receiveBatchSenseData(generateValidProtobufWithSignature(KEY, 3600, FW_VERSION_0_9_22_RC7, FUTURE_UNIX_TIMESTAMP)); final byte[] protobufBytes = Arrays.copyOfRange(data, 16 + 32, data.length); final OutputProtos.SyncResponse syncResponse; try { syncResponse = OutputProtos.SyncResponse.parseFrom(protobufBytes); assertThat(syncResponse.hasResetMcu(), is(true)); assertThat(syncResponse.getResetMcu(), is(false)); assertThat(syncResponse.getFilesCount(), is(1)); } catch (InvalidProtocolBufferException e) { e.printStackTrace(); assertThat(true, is(false)); } }

Target:
public void testOTAForFactoryClockSyncIssueNoPillsHighUptime() { BaseResourceTestHelper.stubGetClientDetails(oAuthTokenStore, Optional.of(BaseResourceTestHelper.getAccessToken())); BaseResourceTestHelper.stubKeyFromKeyStore(keyStore, SENSE_ID, Optional.of(KEY)); BaseResourceTestHelper.stubGetHeader(httpServletRequest, HelloHttpHeader.SENSE_ID, SENSE_ID); stubGetUserInfo(mergedUserInfoDynamoDB, userInfoList); stubGetOTAWindowStart(otaConfiguration, 11); stubGetOTAWindowEnd(otaConfiguration, 20); stubGetPopulatedFirmwareFileListForGroup(firmwareUpdateStore, FeatureFlipper.OTA_RELEASE, FW_VERSION_0_9_22_RC7, fileList); final List<String> groups = Lists.newArrayList(FeatureFlipper.OTA_RELEASE); stubGetGroups(groupFlipper, groups); stubGetFeatureActive(featureFlipper, FeatureFlipper.ENABLE_OTA_UPDATES, groups, true); stubGetFeatureActive(featureFlipper, FeatureFlipper.OTA_RELEASE, groups, true); final byte[] data = receiveResource.receiveBatchSenseData(generateValidProtobufWithSignature(KEY, 3600, FW_VERSION_0_9_22_RC7, FUTURE_UNIX_TIMESTAMP)); final byte[] protobufBytes = Arrays.copyOfRange(data, 16 + 32, data.length); final OutputProtos.SyncResponse syncResponse; try { syncResponse = OutputProtos.SyncResponse.parseFrom(protobufBytes); assertThat(syncResponse.hasResetMcu(), is(true)); assertThat(syncResponse.getResetMcu(), is(false)); assertThat(syncResponse.getFilesCount(), is(1)); } catch (InvalidProtocolBufferException e) { e.printStackTrace(); assertThat(true, is(false)); } }
Source:
private EquivalenceUpdater<Container> rteVodContainerUpdater(Set<Publisher> acceptablePublishers) { return ContentEquivalenceUpdater.<Container> builder() .withExcludedUris(excludedUrisFromProperties()) .withGenerator(TitleSearchGenerator.create(searchResolver, Container.class, acceptablePublishers, DEFAULT_EXACT_TITLE_MATCH_SCORE) ) .withScorers(ImmutableSet.of( new TitleMatchingContainerScorer(DEFAULT_EXACT_TITLE_MATCH_SCORE), new ContainerHierarchyMatchingScorer( contentResolver, Score.negativeOne(), new SubscriptionCatchupBrandDetector(contentResolver) ) )) .withCombiner(new RequiredScoreFilteringCombiner<Container>( new NullScoreAwareAveragingCombiner<Container>(), TitleMatchingContainerScorer.NAME, ScoreThreshold.greaterThanOrEqual(DEFAULT_EXACT_TITLE_MATCH_SCORE)) ) .withFilter(this.filtersForRTE()) .withExtractor(PercentThresholdAboveNextBestMatchEquivalenceExtractor.atLeastNTimesGreater(1.5)) .withHandler(containerResultHandlers(acceptablePublishers)) .build(); }

Target:
private EquivalenceUpdater<Container> rteVodContainerUpdater( Set<Publisher> acceptablePublishers ) { return ContentEquivalenceUpdater.<Container> builder() .withExcludedUris(excludedUrisFromProperties()) .withGenerator(TitleSearchGenerator.create( searchResolver, Container.class, acceptablePublishers, DEFAULT_EXACT_TITLE_MATCH_SCORE ) ) .withScorers(ImmutableSet.of( new TitleMatchingContainerScorer(DEFAULT_EXACT_TITLE_MATCH_SCORE), new ContainerHierarchyMatchingScorer( contentResolver, Score.negativeOne(), new SubscriptionCatchupBrandDetector(contentResolver) ) )) .withCombiner(new RequiredScoreFilteringCombiner<Container>( new NullScoreAwareAveragingCombiner<Container>(), TitleMatchingContainerScorer.NAME, ScoreThreshold.greaterThanOrEqual(DEFAULT_EXACT_TITLE_MATCH_SCORE)) ) .withFilter(filtersForRTE()) .withExtractor( PercentThresholdAboveNextBestMatchEquivalenceExtractor .atLeastNTimesGreater(1.5) ) .withHandler(containerResultHandlers(acceptablePublishers)) .build(); }
Source:
protected synchronized long generateTime() { Logger.d(TAG, "Generating a time for schedule of MQ"); fixNowAndGetAllowedWindow(); Calendar startIfToday = (Calendar) now.clone(); startIfToday.set(Calendar.HOUR_OF_DAY, startAllowedHour); Calendar startIfTodayLast = (Calendar) startIfToday.clone(); startIfToday.add(Calendar.HOUR_OF_DAY, -3); startIfToday.set(Calendar.MINUTE, startAllowedMinute); Calendar startIfTomorrow = (Calendar) startIfToday.clone(); startIfTomorrow.add(Calendar.DAY_OF_YEAR, 1); long scheduledTime; if (now.before(startIfToday)) { Logger.d(TAG, "now < morning time today - 3 -> scheduling today"); scheduledTime = startIfToday.getTimeInMillis(); } else if (now.after(startIfToday) && now.before(startIfTodayLast) && statusManager.isLastMQNotifLongAgo()) { Logger.d(TAG, "morning time today > now > morning time today - 3 -> scheduling today and now"); scheduledTime = now.getTimeInMillis(); } else { Logger.d(TAG, "now > morning time today -> scheduling tomorrow"); scheduledTime = startIfTomorrow.getTimeInMillis(); } long delay = scheduledTime - now.getTimeInMillis(); logDelay(delay); return nowUpTime + delay; }

Target:
protected synchronized long generateTime() { Logger.d(TAG, "Generating a time for schedule of MQ"); fixNowAndGetAllowedWindow(); Calendar startIfToday = (Calendar) now.clone(); startIfToday.set(Calendar.HOUR_OF_DAY, startAllowedHour); Calendar startIfTodayLast = (Calendar) startIfToday.clone(); startIfTodayLast.add(Calendar.HOUR_OF_DAY, 3); startIfToday.add(Calendar.HOUR_OF_DAY, -3); startIfToday.set(Calendar.MINUTE, startAllowedMinute); Calendar startIfTomorrow = (Calendar) startIfToday.clone(); startIfTomorrow.add(Calendar.DAY_OF_YEAR, 1); long scheduledTime; if (now.before(startIfToday)) { Logger.d(TAG, "now < morning time today - 3 -> scheduling today"); scheduledTime = startIfToday.getTimeInMillis(); } else if (now.after(startIfToday) && now.before(startIfTodayLast) && statusManager.isLastMQNotifLongAgo()) { Logger.d(TAG, "morning time today + 3 > now > morning time today - 3 -> scheduling today and now"); scheduledTime = now.getTimeInMillis() + 10 * 1000; } else { Logger.d(TAG, "now > morning time today + 3 -> scheduling tomorrow"); scheduledTime = startIfTomorrow.getTimeInMillis(); } long delay = scheduledTime - now.getTimeInMillis(); logDelay(delay); return nowUpTime + delay; }
Source:
public void testGraphQLTimeZoneDeserialize() { TimeZone expectedTz = TimeZone.getTimeZone("EST"); String input = "EST"; TimeZoneSerde timeZoneScalar = new TimeZoneSerde(); SerdeCoercing timeZoneSerde = new SerdeCoercing("", timeZoneScalar); Object actualTz = timeZoneSerde.parseLiteral(new StringValue(input)); assertEquals(expectedTz, actualTz); }

Target:
public void testGraphQLTimeZoneDeserialize() { TimeZone expectedTz = TimeZone.getTimeZone("EST"); String input = "EST"; TimeZoneSerde timeZoneSerde = new TimeZoneSerde(); SerdeCoercing serdeCoercing = new SerdeCoercing("", timeZoneSerde); Object actualTz = serdeCoercing.parseLiteral(new StringValue(input)); assertEquals(expectedTz, actualTz); }