auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Statistics toParquetStatistics( org.apache.parquet.column.statistics.Statistics stats, int truncateLength) { Statistics formatStats = new Statistics(); if (!stats.isEmpty() && stats.isSmallerThan(MAX_STATS_SIZE)) { formatStats.setNull_count(stats.getNumNulls()); if (stats.hasNonNullValue()) { byte[] min; byte[] max; if (stats instanceof BinaryStatistics && truncateLength != Integer.MAX_VALUE) { BinaryTruncator truncator = BinaryTruncator.getTruncator(stats.type()); min = tuncateMin(truncator, truncateLength, stats.getMinBytes()); max = tuncateMax(truncator, truncateLength, stats.getMaxBytes()); } else { min = stats.getMinBytes(); max = stats.getMaxBytes(); } if (sortOrder(stats.type()) == SortOrder.SIGNED || Arrays.equals(min, max)) { formatStats.setMin(min); formatStats.setMax(max); } if (isMinMaxStatsSupported(stats.type()) || Arrays.equals(min, max)) { formatStats.setMin_value(min); formatStats.setMax_value(max); } } } return formatStats; }

Target:
public static Statistics toParquetStatistics( org.apache.parquet.column.statistics.Statistics stats, int truncateLength) { Statistics formatStats = new Statistics(); if (!stats.isEmpty() && withinLimit(stats, truncateLength)) { formatStats.setNull_count(stats.getNumNulls()); if (stats.hasNonNullValue()) { byte[] min; byte[] max; if (stats instanceof BinaryStatistics && truncateLength != Integer.MAX_VALUE) { BinaryTruncator truncator = BinaryTruncator.getTruncator(stats.type()); min = tuncateMin(truncator, truncateLength, stats.getMinBytes()); max = tuncateMax(truncator, truncateLength, stats.getMaxBytes()); } else { min = stats.getMinBytes(); max = stats.getMaxBytes(); } if (sortOrder(stats.type()) == SortOrder.SIGNED || Arrays.equals(min, max)) { formatStats.setMin(min); formatStats.setMax(max); } if (isMinMaxStatsSupported(stats.type()) || Arrays.equals(min, max)) { formatStats.setMin_value(min); formatStats.setMax_value(max); } } } return formatStats; }
Source:
public void testCheckNullCiphersAndMacs() throws Exception { final GitSSHService sshService = new GitSSHService(); final File certDir = createTempDirectory(); String idleTimeout = "10000"; sshService.setup(certDir, null, idleTimeout, "RSA", mock(ReceivePackFactory.class), mock(JGitFileSystemProvider.RepositoryResolverImpl.class), executorService, null, null); sshService.start(); assertTrue(sshService.isRunning()); List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames(); List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames(); assertThat(ciphersReaded).hasSize(7); assertThat(ciphersReaded.containsAll(Arrays.asList("aes128-ctr", "aes192-cbc", "aes192-ctr", "aes256-cbc", "aes256-ctr", "arcfour128", "arcfour256"))); assertThat(macsReaded).hasSize(6); assertThat(macsReaded.containsAll(Arrays.asList("HmacMD5", "HmacMD5", "HmacSHA1", "HmacSHA1", "HmacSHA256", "HmacSHA512"))); assertThat(sshService.getSshServer().getProperties().get(SshServer.IDLE_TIMEOUT)).isEqualTo(idleTimeout); sshService.stop(); assertFalse(sshService.isRunning()); }

Target:
public void testCheckNullCiphersAndMacs() throws Exception { final GitSSHService sshService = new GitSSHService(); final File certDir = createTempDirectory(); String idleTimeout = "10000"; sshService.setup(certDir, null, idleTimeout, "RSA", mock(ReceivePackFactory.class), mock(JGitFileSystemProvider.RepositoryResolverImpl.class), executorService, null, null); sshService.start(); assertTrue(sshService.isRunning()); List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames(); List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames(); assertThat(ciphersReaded).hasSize(7); checkCiphersName(ciphersReaded); assertThat(macsReaded).hasSize(6); checkMacsName(macsReaded); assertThat(sshService.getSshServer().getProperties().get(SshServer.IDLE_TIMEOUT)).isEqualTo(idleTimeout); sshService.stop(); assertFalse(sshService.isRunning()); }
Source:
public void testFallRiseFallObservingFallingEdge() { Latch latch = new Latch(true, Latch.EdgeType.FallingEdge); LatchTestObserver latchTestObserver = new LatchTestObserver(); latch.addObserver(latchTestObserver); latch.setValue(false); assertEquals(latchTestObserver.getLastUpdateEdgeType(), Latch.EdgeType.FallingEdge); latch.setValue(true); assertEquals(latchTestObserver.getLastUpdateEdgeType(), Latch.EdgeType.FallingEdge); latch.setValue(false); assertEquals(latchTestObserver.getNumTimesUpdated(), 2); }

Target:
public void testFallRiseFallObservingFallingEdge() { Latch latch = new Latch(true, Latch.EdgeType.FallingEdge); latch.addObserver(latchTestObserver); verifyEdgeType(null); verifyTimesUpdateWasCalled(0); latch.setValue(false); verifyEdgeType(Latch.EdgeType.FallingEdge); verifyTimesUpdateWasCalled(1); latch.setValue(true); verifyEdgeType(Latch.EdgeType.FallingEdge); verifyTimesUpdateWasCalled(1); latch.setValue(false); verifyTimesUpdateWasCalled(2); }
Source:
protected Document resolveParentReference(DocumentRef docRef) { if (docRef == null) { throw new IllegalArgumentException("null docRref"); } Object ref = docRef.reference(); if (ref == null) { throw new IllegalArgumentException("null reference"); } int type = docRef.type(); switch (type) { case DocumentRef.ID: return getSession().getDocumentByUUID((String) ref).getParent(); case DocumentRef.INSTANCE: return getSession().getDocumentByUUID(((DocumentModel) ref).getId()).getParent(); case DocumentRef.PATH: Document parentDoc = null; String docPath = (String) ref; if (!"/".equals(docPath)) { String parentPath = docPath.substring(0, docPath.lastIndexOf('/')); if ("".equals(parentPath)) { parentPath = "/"; } parentDoc = resolveReference(new PathRef(parentPath)); } return parentDoc; default: throw new IllegalArgumentException("Invalid type: " + type); } }

Target:
protected Document resolveParentReference(DocumentRef docRef) { if (docRef != null && docRef.type() == DocumentRef.PATH && docRef.reference() != null) { String docPath = (String) docRef.reference(); if ("/".equals(docPath)) { return null; } String parentPath = docPath.substring(0, docPath.lastIndexOf('/')); if (parentPath.isEmpty()) { parentPath = "/"; } return resolveReference(new PathRef(parentPath)); } return resolveReference(docRef).getParent(); }
Source:
private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Community").build(); Collection col = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection").build(); String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/core/collections/" + col.getID(), expectedStatus); }

Target:
private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Community").build(); Collection col = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection").build(); context.restoreAuthSystemState(); String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/core/collections/" + col.getID(), expectedStatus); }
Source:
public List<PatchLineComment> byPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws OrmException { if (!migration.readComments()) { return db.patchComments().byPatchSet(psId).toList(); } List<PatchLineComment> comments = Lists.newArrayList(); comments.addAll(publishedByPatchSet(db, notes, psId)); Set<String> refNames = getRefNamesAllUsers(RefNames.REFS_USER); for (String refName : refNames) { String suffix = Integer.toString(notes.getChangeId().get()); if (!refName.endsWith(suffix)) { continue; } String[] parts = refName.split(RefNames.DRAFTS); if (parts.length != 2) { continue; } Account.Id account = Account.Id.fromRefPart(parts[0]); comments.addAll(draftByPatchSetAuthor(db, psId, account, notes)); } return comments; }

Target:
public List<PatchLineComment> byPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws OrmException { if (!migration.readComments()) { return db.patchComments().byPatchSet(psId).toList(); } List<PatchLineComment> comments = Lists.newArrayList(); comments.addAll(publishedByPatchSet(db, notes, psId)); Set<String> refNames = getRefNamesAllUsers(RefNames.REFS_USER); Iterable<String> filtered = Iterables.filter(refNames, new IsDraftRefForChange(notes.getChangeId())); for (String refName : filtered) { Account.Id account = Account.Id.fromRefPart(refName); comments.addAll(draftByPatchSetAuthor(db, psId, account, notes)); } return comments; }
Source:
public void setModelFile(String modelFile) { this.modelFile = modelFile; }}

Target:
public void setModelFile(String modelFile) { this.modelFile = modelFile; }
Source:
public void initialConfigs() throws Exception { setApiConfigs(apiConfig); initialise0OAuthApplication(); }

Target:
public void initialConfigs() throws Exception { setApiConfigs(apiConfig); initializeOAuthApplication(); }
Source:
private void attemptAddRoutes() { Set<String> inputTransformerIds = InputTransformerIds.getTransformerIds(); synchronized (initState) { try { cdmServiceWaiter.waitFor(inputTransformerIds); } catch (InterruptedException e) { LOGGER.debug( "Interrupted while waiting for input transformers. CDM route will not be started.", e); Thread.currentThread().interrupt(); return; } if (!initState.isInputTransformersReady()) { LOGGER.warn("Not all input transformers were found, starting up CDM route anyways"); } if (!initState.isConfigDeleted()) { LOGGER.trace( "Attempting to add routes for content directory monitor watching {}", monitoredDirectory); try { RouteBuilder routeBuilder = createRouteBuilder(); verifyCamelComponentIsAvailable("content"); verifyCamelComponentIsAvailable("catalog"); camelContext.addRoutes(routeBuilder); initState.setRoutesStarted(true); setRouteCollection(routeBuilder); } catch (Exception e) { LOGGER.info("Unable to configure Camel route.", e); INGEST_LOGGER.warn("Unable to configure Camel route.", e); } finally { if (LOGGER.isDebugEnabled()) { dumpCamelContext("after attemptAddRoutes()"); } } } else { LOGGER.warn( "Config was deleted while waiting for input transformers, camel routes won't be started"); } } }

Target:
private void attemptAddRoutes() { try { waitForInputTransformers(); } catch (InterruptedException e) { LOGGER.warn( "Interrupted while waiting for InputTransformers, CDM route will not be started, but the configuration may still exist. The configuration should be deleted and remade or the system should be restarted."); Thread.currentThread().interrupt(); return; } LOGGER.trace( "Attempting to add routes for content directory monitor watching {}", monitoredDirectory); try { routeBuilder = createRouteBuilder(); verifyCamelComponentIsAvailable("content"); verifyCamelComponentIsAvailable("catalog"); camelContext.addRoutes(routeBuilder); } catch (Exception e) { LOGGER.warn( "Unable to configure Camel route. Resources will not be ingested. CDM configuration may still exist and should be deleted and remade or the system should be restarted.", e); } finally { if (LOGGER.isDebugEnabled()) { dumpCamelContext("after attemptAddRoutes()"); } } }
Source:
protected void migrateCommentsFromPropertyToSecured(CoreSession session, CommentManager commentManager, IdRef commentIdRef) { DocumentModel commentDocModel = session.getDocument(commentIdRef); String parentId = (String) commentDocModel.getPropertyValue(COMMENT_PARENT_ID); if (StringUtils.isEmpty(parentId)) { log.warn( "The comment document model with IdRef: cannot be migrated, because his 'comment:parentId' is not defined", commentIdRef); return; } DocumentRef parentDocRef = new IdRef(parentId); if (!session.exists(parentDocRef)) { log.warn( "The comment document model with IdRef: cannot be migrated, because his parent: cannot be found", commentIdRef, parentId); return; } DocumentModel parentDocModel = session.getDocument(parentDocRef); DocumentRef destination = new PathRef(commentManager.getLocationOfCommentCreation(session, parentDocModel)); session.move(commentIdRef, destination, null); commentDocModel.putContextData(DISABLE_NOTIFICATION_SERVICE, TRUE); ACP acp = session.getACP(commentIdRef); acp.removeACL(LOCAL_ACL); session.setACP(commentIdRef, acp, true); session.saveDocument(commentDocModel); session.save(); }

Target:
protected void migrateCommentsFromPropertyToSecured(CoreSession session, CommentManager commentManager, IdRef commentIdRef) { DocumentModel commentDocModel = session.getDocument(commentIdRef); String parentId = (String) commentDocModel.getPropertyValue(COMMENT_PARENT_ID); if (StringUtils.isEmpty(parentId)) { log.warn( "The comment document model with IdRef: cannot be migrated, because its 'comment:parentId' is not defined", commentIdRef); return; } DocumentRef parentDocRef = new IdRef(parentId); if (!session.exists(parentDocRef)) { log.warn( "The comment document model with IdRef: cannot be migrated, because its parent: cannot be found", commentIdRef, parentId); return; } DocumentModel parentDocModel = session.getDocument(parentDocRef); DocumentRef destination = new PathRef(commentManager.getLocationOfCommentCreation(session, parentDocModel)); session.move(commentIdRef, destination, null); commentDocModel.putContextData(DISABLE_NOTIFICATION_SERVICE, TRUE); ACP acp = session.getACP(commentIdRef); acp.removeACL(LOCAL_ACL); session.setACP(commentIdRef, acp, true); session.saveDocument(commentDocModel); session.save(); }
Source:
protected Values compute() { final Values values = this.execContext.getValues(); final Processor<In, Out> process = this.node.processor; final MetricRegistry registry = this.node.metricRegistry; final String name = String.format("%s.compute(): %s", ProcessorGraphNode.class.getName(), process.getClass()); Timer.Context timerContext = registry.timer(name).time(); try { In inputParameter = ProcessorUtils.populateInputParameter(process, values); Out output; try { LOGGER.debug("Executing process: " + process); output = process.execute(inputParameter, this.execContext.getContext()); LOGGER.debug("Succeeded in executing process: " + process); } catch (Exception e) { if (this.execContext.getContext().isCanceled()) { throw new CancellationException(); } else { LOGGER.error("Error while executing process: " + process, e); throw ExceptionUtils.getRuntimeException(e); } } if (output != null) { ProcessorUtils.writeProcessorOutputToValues(output, process, values); } } finally { this.execContext.finished(this.node); final long processorTime = TimeUnit.MILLISECONDS.convert( timerContext.stop(), TimeUnit.NANOSECONDS); LOGGER.info("Time taken to run processor: '{}' was ms", process.getClass(), processorTime); } if (this.execContext.getContext().isCanceled()) { throw new CancellationException(); } executeDependencyProcessors(); return values; }

Target:
protected Values compute() { final Values values = this.execContext.getValues(); final Processor<In, Out> process = this.node.processor; final MetricRegistry registry = this.node.metricRegistry; final String name = String.format("%s.compute(): %s", ProcessorGraphNode.class.getName(), process.getClass()); Timer.Context timerContext = registry.timer(name).time(); try { In inputParameter = ProcessorUtils.populateInputParameter(process, values); Out output; try { LOGGER.debug("Executing process: {}", process); output = process.execute(inputParameter, this.execContext.getContext()); LOGGER.debug("Succeeded in executing process: {}", process); } catch (Exception e) { if (this.execContext.getContext().isCanceled()) { throw new CancellationException(); } else { LOGGER.error("Error while executing process: " + process, e); throw ExceptionUtils.getRuntimeException(e); } } if (output != null) { ProcessorUtils.writeProcessorOutputToValues(output, process, values); } } finally { this.execContext.finished(this.node); final long processorTime = TimeUnit.MILLISECONDS.convert( timerContext.stop(), TimeUnit.NANOSECONDS); LOGGER.info("Time taken to run processor: '{}' was ms", process.getClass(), processorTime); } if (this.execContext.getContext().isCanceled()) { throw new CancellationException(); } executeDependencyProcessors(); return values; }
Source:
public void testClientInvalidHeader() throws Exception { start(new EmptyHttpServlet()); Session session = newClient(new Session.Listener.Adapter()); HttpFields.Mutable requestFields = HttpFields.build() .put(":custom", "special"); MetaData.Request metaData = newRequest("GET", requestFields); HeadersFrame request = new HeadersFrame(metaData, null, true); FuturePromise<Stream> promise = new FuturePromise<>(); session.newStream(request, promise, new Stream.Listener.Adapter()); ExecutionException x = assertThrows(ExecutionException.class, () -> promise.get(5, TimeUnit.SECONDS)); assertThat(x.getCause(), instanceOf(HpackException.StreamException.class)); }

Target:
public void testClientInvalidHeader() throws Exception { start(new EmptyHttpServlet()); Session session = newClient(new Session.Listener.Adapter()); HttpFields requestFields = HttpFields.build() .put(":custom", "special"); MetaData.Request metaData = newRequest("GET", requestFields); HeadersFrame request = new HeadersFrame(metaData, null, true); FuturePromise<Stream> promise = new FuturePromise<>(); session.newStream(request, promise, new Stream.Listener.Adapter()); ExecutionException x = assertThrows(ExecutionException.class, () -> promise.get(5, TimeUnit.SECONDS)); assertThat(x.getCause(), instanceOf(HpackException.StreamException.class)); }
Source:
public void setHtmlFilenameFormat(String htmlFilenameFormat) { this.htmlFilenameFormat = htmlFilenameFormat; }

Target:
public void setHtmlFilenameFormat(String htmlFilenameFormat) { if (htmlFilenameFormat != null && htmlFilenameFormat.indexOf("$1") == -1) { throw new IllegalArgumentException("Illegal file name format pattern. Use \"$1\" to indicate name."); } this.htmlFilenameFormat = htmlFilenameFormat; }
Source:
public final Connection createConnection() throws AmqpException { synchronized (this.connectionMonitor) { if (this.cacheMode == CacheMode.CHANNEL) { if (this.connection == null) { this.connection = new ChannelCachingConnectionProxy(super.createBareConnection()); getConnectionListener().onCreate(connection); } return this.connection; } else if (this.cacheMode == CacheMode.CONNECTION) { ChannelCachingConnectionProxy connection = null; while (connection == null) { connection = this.idleConnections.poll(); if (connection != null) { if (!connection.isOpen()) { if (logger.isDebugEnabled()) { logger.debug("Removing closed connection '" + connection + "'"); } connection.notifyCloseIfNecessary(); this.openConnections.remove(connection); connection = null; } } if (connection == null) { connection = new ChannelCachingConnectionProxy(super.createBareConnection()); getConnectionListener().onCreate(connection); if (logger.isDebugEnabled()) { logger.debug("Adding new connection '" + connection + "'"); } this.openConnections.add(connection); } else { if (logger.isDebugEnabled()) { logger.debug("Obtained connection '" + connection + "' from cache"); } } return connection; } } } return null; }

Target:
public final Connection createConnection() throws AmqpException { synchronized (this.connectionMonitor) { if (this.cacheMode == CacheMode.CHANNEL) { if (this.connection == null) { this.connection = new ChannelCachingConnectionProxy(super.createBareConnection()); getConnectionListener().onCreate(connection); } return this.connection; } else if (this.cacheMode == CacheMode.CONNECTION) { ChannelCachingConnectionProxy connection = null; while (connection == null && !this.idleConnections.isEmpty()) { connection = this.idleConnections.poll(); if (connection != null) { if (!connection.isOpen()) { if (logger.isDebugEnabled()) { logger.debug("Removing closed connection '" + connection + "'"); } connection.notifyCloseIfNecessary(); this.openConnections.remove(connection); connection = null; } } } if (connection == null) { connection = new ChannelCachingConnectionProxy(super.createBareConnection()); getConnectionListener().onCreate(connection); if (logger.isDebugEnabled()) { logger.debug("Adding new connection '" + connection + "'"); } this.openConnections.add(connection); } else { if (logger.isDebugEnabled()) { logger.debug("Obtained connection '" + connection + "' from cache"); } } return connection; } } return null; }
Source:
protected void updateClusters(Guid storagePoolId) { INewAsyncCallback callback = new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { ImportExportRepoImageBaseModel model = (ImportExportRepoImageBaseModel) target; List<VDSGroup> clusters = (List<VDSGroup>) returnValue; model.getCluster().setItems(clusters); model.getCluster().setIsEmpty(clusters.isEmpty()); model.updateControlsAvailability(); stopProgress(); } }; startProgress(null); if (storagePoolId != null) { AsyncDataProvider.getClusterList(new AsyncQuery(this, callback), storagePoolId); } else { AsyncDataProvider.getClusterList(new AsyncQuery(this, callback)); } }

Target:
protected void updateClusters(Guid storagePoolId) { INewAsyncCallback callback = new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { ImportExportRepoImageBaseModel model = (ImportExportRepoImageBaseModel) target; List<VDSGroup> clusters = AsyncDataProvider.filterClustersWithoutArchitecture((List<VDSGroup>) returnValue); model.getCluster().setItems(clusters); model.getCluster().setIsEmpty(clusters.isEmpty()); model.updateControlsAvailability(); stopProgress(); } }; startProgress(null); if (storagePoolId != null) { AsyncDataProvider.getClusterList(new AsyncQuery(this, callback), storagePoolId); } else { AsyncDataProvider.getClusterList(new AsyncQuery(this, callback)); } }
Source:
public void before() { MessageSourceService as = mock(MessageSourceService.class); PowerMockito.stub(PowerMockito.method(Context.class, "getMessageSourceService")).toReturn(as); }

Target:
public void before() { MessageSourceService as = mock(MessageSourceService.class); mockStatic(Context.class); when(Context.getMessageSourceService()).thenReturn(as); }
Source:
public ContainerManager(ZKDatabase zkDb, RequestProcessor requestProcessor, int checkIntervalMs, int maxPerMinute) { this(zkDb, requestProcessor, checkIntervalMs, maxPerMinute, Integer.MAX_VALUE); }

Target:
public ContainerManager(ZKDatabase zkDb, RequestProcessor requestProcessor, int checkIntervalMs, int maxPerMinute) { this(zkDb, requestProcessor, checkIntervalMs, maxPerMinute, Long.MAX_VALUE); }
Source:
private ArrayAdapter<String> createArrayAdapter(Context context) { ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item); arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); arrayAdapter.add(context.getString(R.string.tnf_mime_media)); arrayAdapter.add(context.getString(R.string.tnf_well_known_http)); arrayAdapter.add(context.getString(R.string.tnf_well_known_https)); arrayAdapter.add(context.getString(R.string.tnf_well_known_sms)); arrayAdapter.add(context.getString(R.string.tnf_well_known_tel)); arrayAdapter.add(context.getString(R.string.tnf_well_known_mailto)); arrayAdapter.add(context.getString(R.string.tnf_external_type)); arrayAdapter.add(context.getString(R.string.tnf_empty)); return arrayAdapter; }

Target:
private ArrayAdapter<String> createArrayAdapter(Context context) { ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item); arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); arrayAdapter.addAll( context.getString(R.string.tnf_mime_media), context.getString(R.string.tnf_well_known_http), context.getString(R.string.tnf_well_known_https), context.getString(R.string.tnf_well_known_sms), context.getString(R.string.tnf_well_known_tel), context.getString(R.string.tnf_well_known_mailto), context.getString(R.string.tnf_external_type), context.getString(R.string.tnf_empty)); return arrayAdapter; }
Source:
private Vector<String> suggestLibraries() { String projectDir = myBuilder.getContext().getProjectFileDirectory(); Vector<String> libraries = new Vector<>(); List<String> hxmls = HaxeHxmlDetectionStep.findHxmlFiles(projectDir); for(String hxml:hxmls) { try { List<HXMLData> dataList = HXMLData.load(projectDir, hxml); for(HXMLData data:dataList) { for(String lib:data.getLibraries()) { if(!libraries.contains(lib)) { libraries.add(lib); } } } } catch (HXMLData.HXMLDataException e) { } } return libraries; }

Target:
private Set<String> suggestLibraries() { String projectDir = myBuilder.getContext().getProjectFileDirectory(); Set<String> result = new HashSet<>(); List<String> hxmls = HaxeHxmlDetectionStep.findHxmlFiles(projectDir); for(String hxml:hxmls) { try { List<HXMLData> dataList = HXMLData.load(projectDir, hxml); for(HXMLData data:dataList) { result.addAll(data.getLibraries()); } } catch (HXMLData.HXMLDataException e) { } } return result; }
Source:
private String getOtherInfo(String resourceIdentifier, String param) { return Constant.messages.getString( MESSAGE_PREFIX + resourceIdentifier + ".otherinfo", param); }

Target:
private static String getOtherInfo(String resourceIdentifier, String param) { return Constant.messages.getString( MESSAGE_PREFIX + resourceIdentifier + ".otherinfo", param); }
Source:
protected void finished(Description description) { try { TestUtils.deleteTargetTestClassFolder(description); } catch (Exception e) { } }

Target:
protected void finished(Description description) { TestUtils.deleteTargetTestClassFolderQuietly(description); }
Source:
public static Metric create(final List<MetricData> data, final String id, final MetricName name, final String type, final String unit) { return new AutoValue_Metric(data, id, name, type, unit); }

Target:
public static Metric create(final List<MetricData> data, final String id, final MetricName name, final String type, final String unit) { return new AutoValue_Metric(data == null ? ImmutableList.<MetricData> of() : ImmutableList.copyOf(data), id, name, type, unit); }
Source:
public String getImageFilePath() { return pathTextField.getText(); }

Target:
String getImageFilePath() { return pathTextField.getText(); }
Source:
public void testHighlightReconciler() { IDocumentProvider dp = editor.getDocumentProvider(); IAnnotationModel annotationModel = dp.getAnnotationModel(editor.getEditorInput()); new DisplayHelper() { @Override protected boolean condition() { Iterator<Annotation> annotationIterator=annotationModel.getAnnotationIterator(); while (annotationIterator.hasNext()) { Annotation ann = annotationIterator.next(); if (ann.getType().indexOf(ANNOTATION_TYPE) > -1) { return true; } } return false; } }.waitForCondition(Display.getDefault().getActiveShell().getDisplay(), 2000); List<Annotation> annotationList = new ArrayList<>(); Iterator<Annotation> annotationIterator=annotationModel.getAnnotationIterator(); while (annotationIterator.hasNext()) { Annotation ann = annotationIterator.next(); if (ann.getType().indexOf(ANNOTATION_TYPE) > -1) { annotationList.add(ann); } } Assert.assertTrue("file does not have highlighting", annotationList.size() == 1); }

Target:
public void testHighlightReconciler() { IDocumentProvider dp = editor.getDocumentProvider(); IAnnotationModel am = dp.getAnnotationModel(editor.getEditorInput()); new DisplayHelper() { @Override protected boolean condition() { return getAnnotationsFromAnnotationModel(am).size() == 1; } }.waitForCondition(Display.getDefault().getActiveShell().getDisplay(), 2000); Assert.assertTrue("file does not have highlighting", getAnnotationsFromAnnotationModel(am).size() == 1); }
Source:
public void testSendInstances() throws InterruptedException { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); processor.processMessage( new MsgCmdSendInstances()); Assert.assertEquals( 0, this.client.messagesForTheDm.size()); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getTomcatVm(); processor.processMessage( new MsgCmdSendInstances()); Assert.assertEquals( InstanceHelpers.buildHierarchicalList( app.getTomcatVm()).size(), this.client.messagesForTheDm.size()); for( int i=1; i<3; i++ ) Assert.assertEquals( "Index " + i, MsgNotifInstanceChanged.class, this.client.messagesForTheDm.get( i ).getClass()); }

Target:
public void testSendInstances() { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); processor.processMessage( new MsgCmdSendInstances()); Assert.assertEquals( 0, this.client.messagesForTheDm.size()); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getTomcatVm(); processor.processMessage( new MsgCmdSendInstances()); Assert.assertEquals( InstanceHelpers.buildHierarchicalList( app.getTomcatVm()).size(), this.client.messagesForTheDm.size()); for( int i=1; i<3; i++ ) Assert.assertEquals( "Index " + i, MsgNotifInstanceChanged.class, this.client.messagesForTheDm.get( i ).getClass()); }
Source:
private List<CertificateDTO> listKeyStore(String portName) throws CertificateManagerException { ListKeyStoresRequestMessageType message = new ListKeyStoresRequestMessageType(); ConfigAssertionType assertion = buildConfigAssertion(getKeyStorePassKey()); message.setConfigAssertion(assertion); ListKeyStoresResponseMessageType response; try { response = (ListKeyStoresResponseMessageType) getClient().invokePort(EntityConfigAdminPortType.class, portName, message); } catch (Exception e) { throw new CertificateManagerException("Error while fetching certificates.", e); } return soapResponseToDTO(response.getCertList()); }

Target:
private List<CertificateDTO> listKeyStore(String portName) throws CertificateManagerException { ListKeyStoresRequestMessageType message = new ListKeyStoresRequestMessageType(); ConfigAssertionType assertion = buildConfigAssertion(); message.setConfigAssertion(assertion); ListKeyStoresResponseMessageType response; try { response = (ListKeyStoresResponseMessageType) getClient().invokePort(EntityConfigAdminPortType.class, portName, message); } catch (Exception e) { throw new CertificateManagerException("Error while fetching certificates.", e); } return soapResponseToDTO(response.getCertList()); }
Source:
private byte[] getKeepAlivePayload() { DatabaseVersion version; try { version = JMXUtils.getLocalMBeanProxy(JMXUtils.SPLICEMACHINE_VERSION, DatabaseVersion.class); } catch (Exception e) { throw new RuntimeException(e); } OlapMessage.KeepAlive message = OlapMessage.KeepAlive.newBuilder().setTime(System.currentTimeMillis()) .setMajor(version.getMajorVersionNumber()) .setMinor(version.getMinorVersionNumber()) .setPatch(version.getPatchVersionNumber()) .setSprint(version.getSprintVersionNumber()) .setImplementation(version.getImplementationVersion()).build(); return message.toByteArray(); }

Target:
private byte[] getKeepAlivePayload() { OlapMessage.KeepAlive message = OlapMessage.KeepAlive.newBuilder(keepAlivePrototype) .setTime(System.currentTimeMillis()) .build(); return message.toByteArray(); }
Source:
protected boolean isExpenditureSubFund(String subFundGroupCode) { if(StringUtils.isNotBlank(subFundGroupCode)){ Collection<String> acceptedValuesForExpenditureSubFundCodes = parameterService.getParameterValuesAsString(KFSConstants.OptionalModuleNamespaces.CONTRACTS_AND_GRANTS, CUKFSParameterKeyConstants.ALL_COMPONENTS, CUKFSParameterKeyConstants.ContractsGrantsParameterConstants.CG_INVOICING_EXCLUDE_EXPENSES_SUB_FUNDS); if(CollectionUtils.isNotEmpty(acceptedValuesForExpenditureSubFundCodes)){ return acceptedValuesForExpenditureSubFundCodes.stream().filter(acceptedValue -> acceptedValue.equalsIgnoreCase(subFundGroupCode)).count() > 0; } } return false; }

Target:
protected boolean isExpenditureSubFund(String subFundGroupCode) { if (StringUtils.isNotBlank(subFundGroupCode)) { Collection<String> acceptedValuesForExpenditureSubFundCodes = parameterService.getParameterValuesAsString(KFSConstants.OptionalModuleNamespaces.ACCOUNTS_RECEIVABLE, CUKFSParameterKeyConstants.ALL_COMPONENTS, CuArParameterKeyConstants.CG_INVOICING_EXCLUDE_EXPENSES_SUB_FUNDS); if (CollectionUtils.isNotEmpty(acceptedValuesForExpenditureSubFundCodes)) { return acceptedValuesForExpenditureSubFundCodes.stream().anyMatch(subFundGroupCode::equalsIgnoreCase); } } return false; }
Source:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); if (getView() != null) { for (Entry<Class<? extends Message>, ManualRequestEditorDialog> dialogue : dialogues.entrySet()) { extensionHook.getHookMenu().addToolsMenuItem(dialogue.getValue().getMenuItem()); extensionHook.addOptionsChangedListener(httpSendEditorDialog); } extensionHook.addSessionListener(this); } }

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); if (getView() != null) { for (Entry<Class<? extends Message>, ManualRequestEditorDialog> dialogue : dialogues.entrySet()) { extensionHook.getHookMenu().addToolsMenuItem(dialogue.getValue().getMenuItem()); } extensionHook.addSessionListener(this); extensionHook.addOptionsChangedListener(httpSendEditorDialog); } }
Source:
private final void importRows(List<T> rows) { final Map<String, T> rowsToImport = rows.stream().filter(getRowFilter()).collect(Collectors.toMap(getRowIdMapper(), row -> row)); final Map<String, C> existingComponents = loadComponents(rowsToImport.keySet()).stream().collect(Collectors.toMap(getComponentIdMapper(), c -> c)); final Collection<C> componentsToAttach = newHashSet(); for (Entry<String, T> rowToImport : rowsToImport.entrySet()) { final String componentId = rowToImport.getKey(); C component = existingComponents.get(componentId); final T row = rowToImport.getValue(); if (component == null) { component = getOrCreate(componentId, componentsToAttach); } else if (skipCurrentRow(row, component)) { getLogger().warn("Not importing component '{}|{}' with effective time '{}'; it should have been filtered from the input file.", row.getClass().getSimpleName(), getRowIdMapper().apply(row), EffectiveTimes.format(row.getEffectiveTime(), DateFormats.SHORT)); continue; } applyRow(component, row, componentsToAttach); } attach(componentsToAttach); }

Target:
private final void importRows(List<T> rows) { final Map<String, T> rowsToImport = rows.stream().filter(getRowFilter()).collect(Collectors.toMap(getRowIdMapper(), row -> row)); final Map<String, C> existingComponents = loadComponents(rowsToImport.keySet()).stream().collect(Collectors.toMap(getComponentIdMapper(), c -> c)); final Collection<C> componentsToAttach = newHashSet(); for (final String componentId : rowsToImport.keySet()) { final T row = rowsToImport.get(componentId); C component = existingComponents.get(componentId); if (component == null) { component = getOrCreateNew(componentId, componentsToAttach); } else if (skipCurrentRow(row, component)) { getLogger().warn("Not importing component '{}|{}' with effective time '{}'; it should have been filtered from the input file.", row.getClass().getSimpleName(), getRowIdMapper().apply(row), EffectiveTimes.format(row.getEffectiveTime(), DateFormats.SHORT)); continue; } applyRow(component, row, componentsToAttach); } attach(componentsToAttach); }
Source:
static HashMap<String, String> urlFormDecodeData(String parameters, String delimiter) { final HashMap<String, String> result = new HashMap<>(); if (!StringExtensions.isNullOrBlank(parameters)) { StringTokenizer parameterTokenizer = new StringTokenizer(parameters, delimiter); while (parameterTokenizer.hasMoreTokens()) { String pair = parameterTokenizer.nextToken(); String[] elements = pair.split("="); String value = null; String key = null; if (elements.length == 2) { try { key = StringExtensions.urlFormDecode(elements[0].trim()); value = StringExtensions.urlFormDecode(elements[1].trim()); } catch (UnsupportedEncodingException e) { Logger.i(TAG, ADALError.ENCODING_IS_NOT_SUPPORTED.getDescription(), e.getMessage(), null); } } else if (elements.length == 1) { try { key = StringExtensions.urlFormDecode(elements[0].trim()); value = ""; } catch (UnsupportedEncodingException e) { Logger.i(TAG, ADALError.ENCODING_IS_NOT_SUPPORTED.getDescription(), e.getMessage(), null); } } if (!StringExtensions.isNullOrBlank(key)) { result.put(key, value); } } } return result; }

Target:
static HashMap<String, String> urlFormDecodeData(String parameters, String delimiter) { final HashMap<String, String> result = new HashMap<>(); if (!StringExtensions.isNullOrBlank(parameters)) { StringTokenizer parameterTokenizer = new StringTokenizer(parameters, delimiter); while (parameterTokenizer.hasMoreTokens()) { String pair = parameterTokenizer.nextToken(); String[] elements = pair.split("="); String value = null; String key = null; if (elements.length == 2) { try { key = StringExtensions.urlFormDecode(elements[0].trim()); value = StringExtensions.urlFormDecode(elements[1].trim()); } catch (UnsupportedEncodingException e) { Logger.i(TAG, ADALError.ENCODING_IS_NOT_SUPPORTED.getDescription(), e.getMessage(), null); continue; } } else if (elements.length == 1) { try { key = StringExtensions.urlFormDecode(elements[0].trim()); value = ""; } catch (UnsupportedEncodingException e) { Logger.i(TAG, ADALError.ENCODING_IS_NOT_SUPPORTED.getDescription(), e.getMessage(), null); continue; } } if (!StringExtensions.isNullOrBlank(key)) { result.put(key, value); } } } return result; }
Source:
public EhcacheClientEntity(EntityClientEndpoint<EhcacheEntityMessage, EhcacheEntityResponse> endpoint) { this.endpoint = endpoint; this.messageFactory = new LifeCycleMessageFactory(); endpoint.setDelegate(new EndpointDelegate() { @Override public void handleMessage(EntityResponse messageFromServer) { if (messageFromServer instanceof EhcacheEntityResponse) { fireResponseEvent((EhcacheEntityResponse) messageFromServer); } } @Override public byte[] createExtendedReconnectData() { for (ReconnectListener reconnectListener : reconnectListeners) { reconnectListener.onHandleReconnect(reconnectData); } return reconnectDataCodec.encode(reconnectData); } @Override public void didDisconnectUnexpectedly() { fireDisconnectionEvent(); } }); }

Target:
public EhcacheClientEntity(EntityClientEndpoint<EhcacheEntityMessage, EhcacheEntityResponse> endpoint) { this.endpoint = endpoint; this.messageFactory = new LifeCycleMessageFactory(); endpoint.setDelegate(new EndpointDelegate() { @Override public void handleMessage(EntityResponse messageFromServer) { if (messageFromServer instanceof EhcacheEntityResponse) { fireResponseEvent((EhcacheEntityResponse) messageFromServer); } } @Override public byte[] createExtendedReconnectData() { synchronized (lock) { ReconnectMessage reconnectMessage = new ReconnectMessage(clientId, caches); for (ReconnectListener reconnectListener : reconnectListeners) { reconnectListener.onHandleReconnect(reconnectMessage); } return reconnectMessageCodec.encode(reconnectMessage); } } @Override public void didDisconnectUnexpectedly() { fireDisconnectionEvent(); } }); }
Source:
public List<String> getSupportedProducts() { return Arrays.asList(SupportedProduct.ALL); }

Target:
public List<String> getSupportedProducts() { return Arrays.asList(SupportedProduct.DI); }
Source:
public void setContent( Metadata d, boolean readOnly ) { this.data = d; tags.clear(); this.readOnly = readOnly; loadData(); if (readOnly) { addTags.setVisible( false ); } else { addTags.addClickHandler( new ClickHandler() { @Override public void onClick( ClickEvent clickEvent ) { String text = newTags.getText(); if (text != null) { String[] tags = text.split( " " ); for (String tag : tags) { addTag( tag ); } newTags.setText( "" ); } } } ); } }

Target:
public void setContent( Metadata d, boolean readOnly ) { this.data = d; this.readOnly = readOnly; view.setReadOnly(readOnly); loadData(); }
Source:
private long producerId(long producerTimestamp, int producerPid) { long longPid = producerPid; longPid = longPid << 48; return longPid ^ producerTimestamp; }

Target:
private long producerId(long producerTimestamp, int producerPid) { long longPid = (long) producerPid << 48; return longPid ^ producerTimestamp; }
Source:
public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("hive.parquet.writer.block-size", "256MB") .put("hive.parquet.writer.page-size", "2MB") .build(); ParquetFileWriterConfig expected = new ParquetFileWriterConfig() .setBlockSize(new DataSize(256, MEGABYTE)) .setPageSize(new DataSize(2, MEGABYTE)); assertFullMapping(properties, expected); }

Target:
public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("hive.parquet.writer.block-size", "234MB") .put("hive.parquet.writer.page-size", "11MB") .build(); ParquetFileWriterConfig expected = new ParquetFileWriterConfig() .setBlockSize(new DataSize(234, MEGABYTE)) .setPageSize(new DataSize(11, MEGABYTE)); assertFullMapping(properties, expected); }
Source:
public void run(String[] args) throws Exception { try { options = parser.parse(args); } catch (OptionException e) { Utils.exitWithError(log, e.getMessage() + ". Use --help to get overview of the help options."); System.exit(1); } if (options.has(help)) { parser.printHelpOn(System.out); System.exit(0); } if (options.has(propertiesFile)) { File f = Utils.newFile(options.valueOf(propertiesFile)); aws.setProperites(f); } if (options.has(scale)) { int count = options.valueOf(scale); aws.scaleInstanceCountTo(count); System.exit(0); } if (options.has(makeLB)) { String name = options.valueOf(makeLB); aws.createLoadBalancer(name); System.exit(0); } if (options.has(agentsToLB)) { String name = options.valueOf(agentsToLB); aws.addAgentsToLoadBalancer(name); System.exit(0); } }

Target:
public void run(String[] args) throws Exception { try { options = parser.parse(args); } catch (OptionException e) { exitWithError(log, e.getMessage() + ". Use --help to get overview of the help options."); } if (options.has(help)) { parser.printHelpOn(System.out); System.exit(0); } if (options.has(propertiesFile)) { File f = newFile(options.valueOf(propertiesFile)); aws.setProperties(f); } if (options.has(scale)) { int count = options.valueOf(scale); aws.scaleInstanceCountTo(count); System.exit(0); } if (options.has(makeLB)) { String name = options.valueOf(makeLB); aws.createLoadBalancer(name); System.exit(0); } if (options.has(agentsToLB)) { String name = options.valueOf(agentsToLB); aws.addAgentsToLoadBalancer(name); System.exit(0); } }
Source:
private boolean processJobDir(final Job job) throws GenieException, IOException { log.debug("Got a job finished event. Will process job directory."); boolean result = false; final String jobId = job.getId(); final String jobWorkingDir = this.baseWorkingDir + JobConstants.FILE_PATH_DELIMITER + jobId; final File jobDir = new File(jobWorkingDir); if (jobDir.exists()) { if (this.deleteDependencies) { this.deleteApplicationDependencies(jobId, jobWorkingDir); } if (!Strings.isNullOrEmpty(job.getArchiveLocation())) { log.debug("Archiving job directory"); final String localArchiveFile = jobWorkingDir + JobConstants.FILE_PATH_DELIMITER + "genie/logs/" + jobId + ".tar.gz"; final CommandLine commandLine = new CommandLine("sudo"); commandLine.addArgument("tar"); commandLine.addArgument("-c"); commandLine.addArgument("-z"); commandLine.addArgument("-f"); commandLine.addArgument(localArchiveFile); commandLine.addArgument("./"); this.executor.setWorkingDirectory(jobDir); log.debug("Archive command : {}", commandLine.toString()); executor.execute(commandLine); this.genieFileTransferService.putFile(localArchiveFile, job.getArchiveLocation()); if (this.deleteArchiveFile) { log.debug("Deleting archive file"); try { Files.deleteIfExists(Paths.get(localArchiveFile)); } catch (Exception e) { log.error("Failed to delete archive file for job: {}", jobId, e); this.archiveFileDeletionFailure.increment(); } } result = true; } } return result; }

Target:
private boolean processJobDir(final Job job) throws GenieException, IOException { log.debug("Got a job finished event. Will process job directory."); boolean result = false; final Optional<String> oJobId = job.getId(); if (oJobId.isPresent()) { final String jobId = oJobId.get(); final File jobDir = new File(this.baseWorkingDir, jobId); if (jobDir.exists()) { if (this.deleteDependencies) { this.deleteApplicationDependencies(jobId, jobDir); } final Optional<String> archiveLocation = job.getArchiveLocation(); if (archiveLocation.isPresent() && !Strings.isNullOrEmpty(archiveLocation.get())) { log.debug("Archiving job directory"); final File localArchiveFile = new File(jobDir, "genie/logs/" + jobId + ".tar.gz"); final CommandLine commandLine = new CommandLine("sudo"); commandLine.addArgument("tar"); commandLine.addArgument("-c"); commandLine.addArgument("-z"); commandLine.addArgument("-f"); commandLine.addArgument(localArchiveFile.getCanonicalPath()); commandLine.addArgument("./"); this.executor.setWorkingDirectory(jobDir); log.debug("Archive command : {}", commandLine.toString()); this.executor.execute(commandLine); this.genieFileTransferService.putFile(localArchiveFile.getCanonicalPath(), archiveLocation.get()); if (this.deleteArchiveFile) { log.debug("Deleting archive file"); try { if (!localArchiveFile.delete()) { log.error("Failed to delete archive file for job: {}", jobId); this.archiveFileDeletionFailure.increment(); } } catch (final Exception e) { log.error("Failed to delete archive file for job: {}", jobId, e); this.archiveFileDeletionFailure.increment(); } } result = true; } } } return result; }
Source:
public Set<String> getCryptoCurrencies() { Set<String> result = new HashSet<String>(); result.add(Currencies.BTC); result.add(Currencies.SYS); result.add(Currencies.BCH); result.add(Currencies.BTX); result.add(Currencies.LTC); result.add(Currencies.ETH); result.add(Currencies.DASH); result.add(Currencies.XMR); result.add(Currencies.POT); result.add(Currencies.FLASH); result.add(Currencies.BTCP); result.add(Currencies.EFL); result.add(Currencies.BSD); result.add(Currencies.BTDX); result.add(Currencies.MEC); result.add(Currencies.BURST); return result; }

Target:
public Set<String> getCryptoCurrencies() { Set<String> result = new HashSet<String>(); result.add(Currencies.BTC); result.add(Currencies.SYS); result.add(Currencies.BCH); result.add(Currencies.BTX); result.add(Currencies.LTC); result.add(Currencies.ETH); result.add(Currencies.DASH); result.add(Currencies.XMR); result.add(Currencies.POT); result.add(Currencies.FLASH); result.add(Currencies.BTCP); result.add(Currencies.EFL); result.add(Currencies.BSD); result.add(Currencies.BTDX); result.add(Currencies.MEC); result.add(Currencies.BURST); result.add(Currencies.DOGE); return result; }
Source:
public void testSpelUnauthorizedType() throws ValidationException { SpelValidator validator = new SpelValidator("T(Runtime).exec('hostname').waitFor() instanceof T(Integer)"); String value = "MyString123"; validator.validate(value, new ModelValidatorContext(context)); }

Target:
public void testSpelUnauthorizedType() throws ValidationException { SpelValidator validator = new SpelValidator("new x.y.z.Object().toString() instanceof T(String)"); String value = "value"; validator.validate(value, new ModelValidatorContext(context)); }
Source:
public DateAddTest() { c1 = Calendar.getInstance(); c1.setTimeZone(TimeZone.getTimeZone("UTC")); c1.set(2000, 2, 3, 4, 5, 6); c1.set(Calendar.MILLISECOND, 7); c1.setMinimalDaysInFirstWeek(4); c1.setFirstDayOfWeek(Calendar.MONDAY); addedDate = Calendar.getInstance(); addedDate.setTimeZone(TimeZone.getTimeZone("UTC")); addedDate.set(2000, 2, 3, 4, 5, 6); addedDate.set(Calendar.MILLISECOND, 7); addedDate.setMinimalDaysInFirstWeek(4); addedDate.setFirstDayOfWeek(Calendar.MONDAY); lastModified = Calendar.getInstance(); lastModified.setTimeZone(TimeZone.getTimeZone("UTC")); lastModified.set(2000, 2, 3, 4, 5, 6); lastModified.set(Calendar.MILLISECOND, 7); lastModified.setMinimalDaysInFirstWeek(4); lastModified.setFirstDayOfWeek(Calendar.MONDAY); }

Target:
public DateAddTest() { c1 = Calendar.getInstance(); c1.set(2000, 2, 3, 4, 5, 6); c1.set(Calendar.MILLISECOND, 7); c1.setMinimalDaysInFirstWeek(4); c1.setFirstDayOfWeek(Calendar.MONDAY); addedDate = Calendar.getInstance(); addedDate.set(2000, 2, 3, 4, 5, 6); addedDate.set(Calendar.MILLISECOND, 7); addedDate.setMinimalDaysInFirstWeek(4); addedDate.setFirstDayOfWeek(Calendar.MONDAY); lastModified = Calendar.getInstance(); lastModified.set(2000, 2, 3, 4, 5, 6); lastModified.set(Calendar.MILLISECOND, 7); lastModified.setMinimalDaysInFirstWeek(4); lastModified.setFirstDayOfWeek(Calendar.MONDAY); }