auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public InstructorStudentRecordsAjaxPageData(AccountAttributes account, StudentAttributes student, String sessionToken, List<FeedbackSessionResultsBundle> results, Map<String, Boolean> sessionSubmissionStatusMap) { super(account, student, sessionToken); this.resultsTables = new ArrayList<>(); for (int i = 0; i < results.size(); i++) { FeedbackSessionResultsBundle result = results.get(i); boolean submissionStatus = true; try { submissionStatus = sessionSubmissionStatusMap.get(result.getFeedbackSession().getFeedbackSessionName()); } catch (Exception e) { } String studentName = result.appendTeamNameToName(student.name, student.team); this.resultsTables.add(new FeedbackResultsTable(i, studentName, result, submissionStatus)); } }

Target:
public InstructorStudentRecordsAjaxPageData(AccountAttributes account, StudentAttributes student, String sessionToken, List<FeedbackSessionResultsBundle> results, Map<String, Boolean> sessionSubmissionStatusMap) { super(account, student, sessionToken); this.resultsTables = new ArrayList<>(); for (int i = 0; i < results.size(); i++) { FeedbackSessionResultsBundle result = results.get(i); boolean hasStudentSubmitted; if (sessionSubmissionStatusMap.containsKey(result.getFeedbackSession().getFeedbackSessionName())) { hasStudentSubmitted = sessionSubmissionStatusMap.get(result.getFeedbackSession().getFeedbackSessionName()); } else { hasStudentSubmitted = true; } String studentName = result.appendTeamNameToName(student.name, student.team); this.resultsTables.add(new FeedbackResultsTable(i, studentName, result, hasStudentSubmitted)); } }
Source:
private void sendNsdStateChangeBroadcast(boolean isEnabled) { final Intent intent = new Intent(NsdManager.ACTION_NSD_STATE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.putExtra(NsdManager.EXTRA_NSD_STATE, enabledMessage(isEnabled)); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); }

Target:
private void sendNsdStateChangeBroadcast(boolean isEnabled) { final Intent intent = new Intent(NsdManager.ACTION_NSD_STATE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); int nsdState = isEnabled ? NsdManager.NSD_STATE_ENABLED : NsdManager.NSD_STATE_DISABLED; intent.putExtra(NsdManager.EXTRA_NSD_STATE, nsdState); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); }
Source:
public AnnotationMetadata() { }

Target:
AnnotationMetadata() { }
Source:
private static void generateBubbleMergeWithSearchGraphJob(String jobName, String outputPath) throws IOException { PregelixJob job = BubbleMergeWithSearchVertex.getConfiguredJob(new GenomixJobConf(3), BubbleMergeWithSearchVertex.class); job.setVertexInputFormatClass(NodeToBubbleMergeWithSearchVertexInputFormat.class); job.setVertexOutputFormatClass(BubbleMergeWithSearchVertexToNodeOutputFormat.class); job.getConfiguration().setInt(GenomixJobConf.BUBBLE_MERGE_WITH_SEARCH_MAX_LENGTH, 100); job.getConfiguration().writeXml(new FileOutputStream(new File(outputPath))); }

Target:
private static void generateBubbleMergeWithSearchGraphJob(String jobName, String outputPath) throws IOException { PregelixJob job = BubbleMergeWithSearchVertex.getConfiguredJob(new GenomixJobConf(3), BubbleMergeWithSearchVertex.class); job.getConfiguration().setInt(GenomixJobConf.BUBBLE_MERGE_WITH_SEARCH_MAX_LENGTH, 100); job.getConfiguration().writeXml(new FileOutputStream(new File(outputPath))); }
Source:
private boolean sameResultAsLast(Session s, Value[] params, Value[] lastParams, long lastEval) { if (!cacheableChecked) { long max = getMaxDataModificationId(); noCache = max == Long.MAX_VALUE; cacheableChecked = true; } if (noCache) { return false; } Database db = s.getDatabase(); for (int i = 0; i < params.length; i++) { Value a = lastParams[i], b = params[i]; if (a.getType() != b.getType() || !db.areEqual(a, b)) { return false; } } if (!isEverything(ExpressionVisitor.DETERMINISTIC_VISITOR) || !isEverything(ExpressionVisitor.INDEPENDENT_VISITOR)) { return false; } return db.getModificationDataId() <= lastEval || getMaxDataModificationId() <= lastEval; }

Target:
private boolean sameResultAsLast(Session s, Value[] params, Value[] lastParams, long lastEval) { if (!cacheableChecked) { long max = getMaxDataModificationId(); noCache = max == Long.MAX_VALUE; cacheableChecked = true; } if (noCache) { return false; } Database db = s.getDatabase(); for (int i = 0; i < params.length; i++) { Value a = lastParams[i], b = params[i]; if (a.getType() != b.getType() || !db.areEqual(a, b)) { return false; } } if (!isEverything(ExpressionVisitor.DETERMINISTIC_VISITOR) || !isEverything(ExpressionVisitor.INDEPENDENT_VISITOR)) { return false; } if (db.getModificationDataId() > lastEval && getMaxDataModificationId() > lastEval) { return false; } return true; }
Source:
private int delayForSubscription() { if (!subscription.isBatchSubscription()) { return subscription.getSerialSubscriptionPolicy().getSendingDelay(); } else { return 0; } }

Target:
private int delayForSubscription() { return subscription.getSerialSubscriptionPolicy().getSendingDelay(); }
Source:
public void setUp() { registry = mock(SourcedEurekaRegistryImpl.class); retryableConnection = mock(RetryableConnection.class); channelSubject = ReplaySubject.create(); when(retryableConnection.getChannelObservable()).thenReturn(channelSubject); client = new MyInterestClient(registry, 0); }

Target:
public void setUp() { registry = mock(SourcedEurekaRegistry.class); retryableConnection = mock(RetryableConnection.class); channelSubject = ReplaySubject.create(); when(retryableConnection.getChannelObservable()).thenReturn(channelSubject); client = new MyInterestClient(registry, 0); }
Source:
public KeycloakConfiguration(final PlatformConfiguration platformConfiguration) { Assert.requireNonNull(platformConfiguration, "platformConfiguration"); this.realmName = platformConfiguration.getProperty(REALM_PROPERTY_NAME, REALM_PROPERTY_DEFAULT_VALUE); this.realmNames = platformConfiguration.getListProperty(REALM_PROPERTY_NAME, Collections.emptyList()); if(this.realmNames.isEmpty()){ this.realmNames.add(this.realmName); } this.applicationName = platformConfiguration.getProperty(APPLICATION_PROPERTY_NAME, APPLICATION_PROPERTY_DEFAULT_VALUE) ; this.authEndpoint = platformConfiguration.getProperty(AUTH_ENDPOINT_PROPERTY_NAME, AUTH_ENDPOINT_PROPERTY_DEFAULT_VALUE) + "/auth"; this.secureEndpoints.addAll(platformConfiguration.getListProperty(SECURE_ENDPOINTS_PROPERTY_NAME, Collections.emptyList())); this.securityActive = platformConfiguration.getBooleanProperty(SECURITY_ACTIVE_PROPERTY_NAME, false); this.loginEndpointActive = platformConfiguration.getBooleanProperty(LOGIN_ENDPOINTS_ACTIVE_PROPERTY_NAME, true); this.loginEndpoint = platformConfiguration.getProperty(LOGIN_ENDPOINTS_PROPERTY_NAME, LOGIN_ENDPOINTS_PROPERTY_DEFAULT_VALUE); }

Target:
public KeycloakConfiguration(final PlatformConfiguration platformConfiguration) { Assert.requireNonNull(platformConfiguration, "platformConfiguration"); this.realmName = platformConfiguration.getProperty(REALM_PROPERTY_NAME); this.realmNames = platformConfiguration.getListProperty(REALM_PROPERTY_NAME, Collections.emptyList()); if(this.realmName != null && !this.realmName.isEmpty()){ this.realmNames.add(this.realmName); } this.applicationName = platformConfiguration.getProperty(APPLICATION_PROPERTY_NAME, APPLICATION_PROPERTY_DEFAULT_VALUE) ; this.authEndpoint = platformConfiguration.getProperty(AUTH_ENDPOINT_PROPERTY_NAME, AUTH_ENDPOINT_PROPERTY_DEFAULT_VALUE) + "/auth"; this.secureEndpoints.addAll(platformConfiguration.getListProperty(SECURE_ENDPOINTS_PROPERTY_NAME, Collections.emptyList())); this.securityActive = platformConfiguration.getBooleanProperty(SECURITY_ACTIVE_PROPERTY_NAME, false); this.loginEndpointActive = platformConfiguration.getBooleanProperty(LOGIN_ENDPOINTS_ACTIVE_PROPERTY_NAME, true); this.loginEndpoint = platformConfiguration.getProperty(LOGIN_ENDPOINTS_PROPERTY_NAME, LOGIN_ENDPOINTS_PROPERTY_DEFAULT_VALUE); }
Source:
public synchronized Long getLogTail() { return logMetadata.getGlobalTail(); }

Target:
public synchronized long getLogTail() { return logMetadata.getGlobalTail(); }
Source:
private CacheEntry getIfPresent(ImmutableBytesPtr cacheId) { CacheEntry entry = getPersistentServerCaches().getIfPresent(cacheId); if (entry != null) { getServerCaches().put(cacheId, entry); }return getServerCaches().getIfPresent(cacheId); }

Target:
private CacheEntry getIfPresent(ImmutableBytesPtr cacheId) { CacheEntry entry = getPersistentServerCaches().getIfPresent(cacheId); if (entry != null) { return entry; } return getServerCaches().getIfPresent(cacheId); }
Source:
public HitbtcExchange(String clientKey, String clientSecret, String preferredFiatCurrency) { super(getSpecification(clientKey, clientSecret), preferredFiatCurrency); this.accountId = accountId; }

Target:
public HitbtcExchange(String clientKey, String clientSecret, String preferredFiatCurrency) { super(getSpecification(clientKey, clientSecret), preferredFiatCurrency); }
Source:
private static JCQueue createQueue(String name, int queueSize) { List<Integer> taskIds = new ArrayList<>(); taskIds.add(1000); return new JCQueue(name, queueSize, 0, 1, new WaitStrategyPark(0), "test", "test", taskIds, 1000, new StormMetricRegistry()); }

Target:
private static JCQueue createQueue(String name, int queueSize) { return new JCQueue(name, queueSize, 0, 1, new WaitStrategyPark(0), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry()); }
Source:
public static ExecutionResult executeCommandWithResult( final Logger logger, final String[] command, final File workingDir, final Map<String,String> environmentVars, final String applicationName, final String scopedInstancePath) throws IOException, InterruptedException { logger.fine( "Executing command: " + Arrays.toString( command )); ProcessBuilder pb = new ProcessBuilder( command ); if( workingDir != null ) pb.directory(workingDir); Map<String,String> env = pb.environment(); if( environmentVars != null && env != null ) { for( Map.Entry<String,String> entry : environmentVars.entrySet()) { if( entry.getKey() != null && entry.getValue() != null ) env.put( entry.getKey(), entry.getValue()); } } StringBuilder normalOutput = new StringBuilder(); StringBuilder errorOutput = new StringBuilder(); int exitValue = -1; Process process = pb.start(); logger.fine("Storing process [" + applicationName + "] [" + scopedInstancePath + "]"); ProcessStore.setProcess(applicationName, scopedInstancePath, process); new Thread( new OutputRunnable( process, true, errorOutput, logger )).start(); new Thread( new OutputRunnable( process, false, normalOutput, logger )).start(); exitValue = process.waitFor(); if( exitValue != 0 ) logger.warning( "Command execution returned a non-zero code. Code:" + exitValue ); ProcessStore.clearProcess(applicationName, scopedInstancePath); return new ExecutionResult( normalOutput.toString().trim(), errorOutput.toString().trim(), exitValue ); }

Target:
public static ExecutionResult executeCommandWithResult( final Logger logger, final String[] command, final File workingDir, final Map<String,String> environmentVars, final String applicationName, final String scopedInstancePath) throws IOException, InterruptedException { logger.fine( "Executing command: " + Arrays.toString( command )); ProcessBuilder pb = new ProcessBuilder( command ); if( workingDir != null ) pb.directory(workingDir); Map<String,String> env = pb.environment(); if( environmentVars != null && env != null ) { for( Map.Entry<String,String> entry : environmentVars.entrySet()) { if( entry.getKey() != null && entry.getValue() != null ) env.put( entry.getKey(), entry.getValue()); } } StringBuilder normalOutput = new StringBuilder(); StringBuilder errorOutput = new StringBuilder(); int exitValue = -1; Process process = pb.start(); logger.fine("Storing process [" + applicationName + "] [" + scopedInstancePath + "]"); ProcessStore.setProcess(applicationName, scopedInstancePath, process); try { new Thread( new OutputRunnable( process, true, errorOutput, logger )).start(); new Thread( new OutputRunnable( process, false, normalOutput, logger )).start(); exitValue = process.waitFor(); if( exitValue != 0 ) logger.warning( "Command execution returned a non-zero code. Code:" + exitValue ); } finally { ProcessStore.clearProcess(applicationName, scopedInstancePath); } return new ExecutionResult( normalOutput.toString().trim(), errorOutput.toString().trim(), exitValue ); }
Source:
public @Nullable Long getDuration() { Number begin = fBegin.getValue(); Number end = fEnd.getValue(); if (begin != null && end != null) { return end.longValue() - begin.longValue(); } return null; }

Target:
public @Nullable Long getDuration() { return fDuration; }
Source:
private static String toJson(String source) { Map<String, String> queryPairs = new HashMap<>(); Arrays.stream(source.split("&")) .forEach( p -> { int delimiterIndex = p.indexOf("="); queryPairs.put(p.substring(0, delimiterIndex), p.substring(delimiterIndex + 1)); }); return new Gson().toJson(queryPairs); }

Target:
private static String toJson(String source) { Map<String, String> queryPairs = new HashMap<>(); Arrays.stream(source.split("&")) .forEach( p -> { int delimiterIndex = p.indexOf("="); queryPairs.put(p.substring(0, delimiterIndex), p.substring(delimiterIndex + 1)); }); return gson.toJson(queryPairs); }
Source:
private Block2BlockwiseStatus clearBlock2Status(final KeyUri key) { int size; Block2BlockwiseStatus removedTracker; synchronized (block2Transfers) { removedTracker = block2Transfers.remove(key); size = block2Transfers.size(); } if (removedTracker != null) { LOGGER.debug("removing block2 tracker [{}], block2 transfers still in progress: {}", new Object[] { key, size }); removedTracker.setComplete(true); } return removedTracker; }

Target:
private Block2BlockwiseStatus clearBlock2Status(final KeyUri key) { int size; Block2BlockwiseStatus removedTracker; synchronized (block2Transfers) { removedTracker = block2Transfers.remove(key); size = block2Transfers.size(); } if (removedTracker != null) { LOGGER.debug("removing block2 tracker [{}], block2 transfers still in progress: {}", key, size); removedTracker.setComplete(true); } return removedTracker; }
Source:
public void startPortForwarding() { if(isPortForwarding(pod)) return; IPortForwardable portForwardable = pod.accept(new CapabilityVisitor<IPortForwardable, IPortForwardable>() { @Override public IPortForwardable visit(final IPortForwardable cap) { final MessageConsole console = ConsoleUtils.findMessageConsole(getMessageConsoleName()); consoleListener.setCapability(cap); ConsoleUtils.registerConsoleListener(consoleListener); MessageConsoleStream stream = console.newMessageStream(); stream.println("Starting port-forwarding..."); for (IPortForwardable.PortPair port : ports) { stream.println(NLS.bind("{0} {1} -> {2}", new Object {port.getName(), port.getLocalPort(), port.getRemotePort()})); } cap.forwardPorts(ports.toArray(new IPortForwardable.PortPair []{})); stream.println("done."); ConsoleUtils.displayConsoleView(console); firePropertyChange(PROPERTY_PORT_FORWARDING, false, getPortForwarding()); return cap; } }, null); if(portForwardable != null) { REGISTRY.put(pod, portForwardable); } firePropertyChange(PROPERTY_PORT_FORWARDING, false, getPortForwarding()); }

Target:
public void startPortForwarding() { if(isPortForwarding(pod)) return; IPortForwardable portForwardable = pod.accept(new CapabilityVisitor<IPortForwardable, IPortForwardable>() { @Override public IPortForwardable visit(final IPortForwardable cap) { final MessageConsole console = ConsoleUtils.findMessageConsole(getMessageConsoleName()); consoleListener.setCapability(cap); ConsoleUtils.registerConsoleListener(consoleListener); MessageConsoleStream stream = console.newMessageStream(); stream.println("Starting port-forwarding..."); for (IPortForwardable.PortPair port : ports) { stream.println(NLS.bind("{0} {1} -> {2}", new Object {port.getName(), port.getLocalPort(), port.getRemotePort()})); } cap.forwardPorts(ports.toArray(new IPortForwardable.PortPair []{})); stream.println("done."); ConsoleUtils.displayConsoleView(console); return cap; } }, null); if(portForwardable != null) { REGISTRY.put(pod, portForwardable); } firePropertyChange(PROPERTY_PORT_FORWARDING, false, getPortForwarding()); }
Source:
public Int getTotalNumDocuments(){ searcher = new IndexSearcher(reader); return searcher.getIndexReader().maxDoc(); }

Target:
public int getTotalNumDocuments(){ if (searcher == null) { searcher = new IndexSearcher(reader); } return searcher.getIndexReader().maxDoc(); }
Source:
public void testLoadGlobalMRUObjectsFromCache() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); Map<String, String> idToSubjects = new HashMap<String, String>(); idToSubjects = createRecordsOnServer(1, Constants.CASE); String[] ids = idToSubjects.keySet().toArray(new String[1]); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RETURN_CACHE_DATA_DONT_RELOAD, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size(), mruObjects.size()); } finally { deleteRecordsOnServer(ids, Constants.CASE); } }

Target:
public void testLoadGlobalMRUObjectsFromCache() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); Map<String, String> idToSubjects = createRecordsOnServer(1, Constants.CASE); Set<String> ids = idToSubjects.keySet(); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RETURN_CACHE_DATA_DONT_RELOAD, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size(), mruObjects.size()); } finally { deleteRecordsOnServer(ids, Constants.CASE); } }
Source:
public void simpleRedirectTestCase() throws IOException, GeneralSecurityException { TestHttpClient client = new TestHttpClient(); client.setSSLContext(DefaultServer.getClientSSLContext()); try { sendRequest(client, "/foo", null); sendRequest(client, "/foo+bar", null); sendRequest(client, "/foo+bar;aa", null); sendRequest(client, "/foo+bar;aa", "x=y"); sendRequest(client, "/foo+bar:aa", "x=%3Ablah"); } finally { client.getConnectionManager().shutdown(); } }

Target:
public void simpleRedirectTestCase() throws IOException, GeneralSecurityException { TestHttpClient client = new TestHttpClient(); HttpContext httpContext = new BasicHttpContext() { private final RequestConfig config = RequestConfig.copy(RequestConfig.DEFAULT).setNormalizeUri(false).build(); @Override public void setAttribute(final String id, final Object obj) { if ("http.request-config".equals(id)) return; super.setAttribute(id, obj); } @Override public Object getAttribute(final String id) { if ("http.request-config".equals(id)) return config; return super.getAttribute(id); } }; client.setSSLContext(DefaultServer.getClientSSLContext()); try { sendRequest(client, httpContext,"/foo", null); sendRequest(client, httpContext,"/foo+bar", null); sendRequest(client, httpContext,"/foo+bar;aa", null); sendRequest(client, httpContext,"/foo+bar;aa", "x=y"); sendRequest(client, httpContext,"/foo+bar%3Aaa", "x=%3Ablah"); } finally { client.getConnectionManager().shutdown(); } }
Source:
public void cancelSnapshotSyncInProgressAndRetry() throws Exception { observeSnapshotSync = true; initLogReplicationFSM(ReaderImplementation.TEST); ((TestSnapshotReader)snapshotReader).setBatchSize(BATCH_SIZE); limitSnapshotMessages = 2; writeToStream(); transitionAvailable.acquire(); transition(LogReplicationEventType.SNAPSHOT_SYNC_REQUEST, LogReplicationStateType.IN_SNAPSHOT_SYNC); transitionAvailable.acquire(); fsm.input(new LogReplicationEvent(LogReplicationEventType.REPLICATION_STOP)); while (fsm.getState().getType() != LogReplicationStateType.INITIALIZED) { } assertThat(fsm.getState().getType()).isEqualTo(LogReplicationStateType.INITIALIZED); ((TestDataSender) dataSender).reset(); observeSnapshotSync = false; Queue<LogReplicationEntry> listenerQueue = ((TestDataSender) dataSender).getEntryQueue(); fsm.input(new LogReplicationEvent(LogReplicationEventType.SNAPSHOT_SYNC_REQUEST)); for (int i = 0; i<(NUM_ENTRIES/(BATCH_SIZE * SnapshotSender.DEFAULT_SNAPSHOT_BATCH_SIZE)) + 1; i++) { } while (listenerQueue.size() < NUM_ENTRIES) { } assertThat(listenerQueue.size()).isEqualTo(NUM_ENTRIES); for (int i=0; i<NUM_ENTRIES; i++) { assertThat(listenerQueue.poll().getPayload()) .isEqualTo( String.format(PAYLOAD_FORMAT, i).getBytes()); } }

Target:
public void cancelSnapshotSyncInProgressAndRetry() throws Exception { observeSnapshotSync = true; initLogReplicationFSM(ReaderImplementation.TEST); ((TestSnapshotReader)snapshotReader).setBatchSize(BATCH_SIZE); limitSnapshotMessages = 2; writeToStream(); transitionAvailable.acquire(); transition(LogReplicationEventType.SNAPSHOT_SYNC_REQUEST, LogReplicationStateType.IN_SNAPSHOT_SYNC); transitionAvailable.acquire(); fsm.input(new LogReplicationEvent(LogReplicationEventType.REPLICATION_STOP)); while (fsm.getState().getType() != LogReplicationStateType.INITIALIZED) { } assertThat(fsm.getState().getType()).isEqualTo(LogReplicationStateType.INITIALIZED); ((TestDataSender) dataSender).reset(); observeSnapshotSync = false; Queue<LogReplicationEntry> listenerQueue = ((TestDataSender) dataSender).getEntryQueue(); transition(LogReplicationEventType.SNAPSHOT_SYNC_REQUEST, LogReplicationStateType.IN_SNAPSHOT_SYNC, true); for (int i = 0; i<(NUM_ENTRIES/(BATCH_SIZE * SnapshotSender.DEFAULT_SNAPSHOT_BATCH_SIZE)) + 1; i++) { transitionAvailable.acquire(); } while (listenerQueue.size() < NUM_ENTRIES) { } assertThat(listenerQueue.size()).isEqualTo(NUM_ENTRIES); for (int i=0; i<NUM_ENTRIES; i++) { assertThat(listenerQueue.poll().getPayload()) .isEqualTo( String.format(PAYLOAD_FORMAT, i).getBytes()); } }
Source:
protected S3ListResult listObjects(S3ListRequest request) throws IOException { incrementReadOperations(); incrementStatistic(OBJECT_LIST_REQUESTS); validateListArguments(request); return invoker.retryUntranslated( request.toString(), true, () -> { if (useListV1) { Preconditions.checkArgument(request.isV1()); return S3ListResult.v1(s3.listObjects(request.getV1())); } else { Preconditions.checkArgument(!request.isV1()); return S3ListResult.v2(s3.listObjectsV2(request.getV2())); } }); }

Target:
protected S3ListResult listObjects(S3ListRequest request) throws IOException { incrementReadOperations(); incrementStatistic(OBJECT_LIST_REQUESTS); validateListArguments(request); return invoker.retryUntranslated( request.toString(), true, () -> { if (useListV1) { return S3ListResult.v1(s3.listObjects(request.getV1())); } else { return S3ListResult.v2(s3.listObjectsV2(request.getV2())); } }); }
Source:
Cluster constructClusterDTO(final String id) { final String clusterId; if (StringUtils.isBlank(id)) { clusterId = UUID.randomUUID().toString(); } else { clusterId = id; } final Set<String> tags = new HashSet<>(); tags.add("foo"); tags.add("bar"); final Set<String> configList = new HashSet<>(); configList.add("config1"); configList.add("configs2"); final Set<String> dependenciesList = new HashSet<>(); dependenciesList.add("cluster-dep1"); dependenciesList.add("cluster-dep2"); return new Cluster.Builder("name", "user", "1.0", ClusterStatus.UP) .withId(clusterId) .withDescription("client Test") .withSetupFile("path to set up file") .withTags(tags) .withConfigs(configList) .withDependencies(dependenciesList) .build(); }

Target:
Cluster constructClusterDTO(final String id) { final String clusterId; if (StringUtils.isBlank(id)) { clusterId = UUID.randomUUID().toString(); } else { clusterId = id; } final Set<String> tags = Sets.newHashSet("foo", "bar"); final Set<String> configList = Sets.newHashSet("config1", "configs2"); final Set<String> dependenciesList = Sets.newHashSet("cluster-dep1", "cluster-dep2"); return new Cluster.Builder("name", "user", "1.0", ClusterStatus.UP) .withId(clusterId) .withDescription("client Test") .withSetupFile("path to set up file") .withTags(tags) .withConfigs(configList) .withDependencies(dependenciesList) .build(); }
Source:
ColumnWriteStoreBase( MessageType schema, PageWriteStore pageWriteStore, BloomFilterWriteStore bloomFilterWriteStore, ParquetProperties props) { this.props = props; this.thresholdTolerance = (long) (props.getPageSizeThreshold() * THRESHOLD_TOLERANCE_RATIO); Map<ColumnDescriptor, ColumnWriterBase> mcolumns = new TreeMap<>(); for (ColumnDescriptor path : schema.getColumns()) { PageWriter pageWriter = pageWriteStore.getPageWriter(path); if (props.getBloomFilterColumnExpectedNDVs() != null) { BloomFilterWriter bloomFilterWriter = bloomFilterWriteStore.getBloomFilterWriter(path); mcolumns.put(path, createColumnWriter(path, pageWriter, bloomFilterWriter, props)); } else { mcolumns.put(path, createColumnWriter(path, pageWriter, null, props)); } } this.columns = unmodifiableMap(mcolumns); this.rowCountForNextSizeCheck = props.getMinRowCountForPageSizeCheck(); columnWriterProvider = new ColumnWriterProvider() { @Override public ColumnWriter getColumnWriter(ColumnDescriptor path) { return columns.get(path); } }; }

Target:
ColumnWriteStoreBase( MessageType schema, PageWriteStore pageWriteStore, BloomFilterWriteStore bloomFilterWriteStore, ParquetProperties props) { this.props = props; this.thresholdTolerance = (long) (props.getPageSizeThreshold() * THRESHOLD_TOLERANCE_RATIO); Map<ColumnDescriptor, ColumnWriterBase> mcolumns = new TreeMap<>(); for (ColumnDescriptor path : schema.getColumns()) { PageWriter pageWriter = pageWriteStore.getPageWriter(path); if (props.getBloomFilterColumns() != null && props.getBloomFilterColumns().size() > 0) { BloomFilterWriter bloomFilterWriter = bloomFilterWriteStore.getBloomFilterWriter(path); mcolumns.put(path, createColumnWriter(path, pageWriter, bloomFilterWriter, props)); } else { mcolumns.put(path, createColumnWriter(path, pageWriter, null, props)); } } this.columns = unmodifiableMap(mcolumns); this.rowCountForNextSizeCheck = props.getMinRowCountForPageSizeCheck(); columnWriterProvider = new ColumnWriterProvider() { @Override public ColumnWriter getColumnWriter(ColumnDescriptor path) { return columns.get(path); } }; }
Source:
@Override public ICubeGenerator createCubeGenerator(ICubicWorldServer world) { return new BasicCubeGenerator(world) { Perlin perlin = new Perlin(); { perlin.setFrequency(0.180); perlin.setOctaveCount(1); perlin.setSeed((int) world.getSeed()); } @Override public ICubePrimer generateCube(int cubeX, int cubeY, int cubeZ) { ICubePrimer primer = new CubePrimer(); if(cubeY > 30) { return primer; } if(cubeX == 100 && cubeZ == 100) { return primer; } CubeCoords cubePos = new CubeCoords(cubeX, cubeY, cubeZ); for(BlockPos pos : BlockPos.getAllInBoxMutable(cubePos.getMinBlockPos(), cubePos.getMaxBlockPos())) { double currDensity = perlin.getValue(pos.getX(), pos.getY()*0.5, pos.getZ()); double aboveDensity = perlin.getValue(pos.getX(), (pos.getY()+1)*0.5, pos.getZ()); if(cubeY >= 16) { currDensity -= (pos.getY() - 16*16)/100; aboveDensity -= (pos.getY() + 1 - 16*16)/100; } if(currDensity > 0.5) { if(currDensity > 0.5 && aboveDensity <= 0.5) { primer.setBlockState(pos.getX(), pos.getY(), pos.getZ(), Blocks.GRASS.getDefaultState()); } else if(currDensity > aboveDensity && currDensity < 0.7) { primer.setBlockState(pos.getX(), pos.getY(), pos.getZ(), Blocks.DIRT.getDefaultState()); } else { primer.setBlockState(pos.getX(), pos.getY(), pos.getZ(), Blocks.STONE.getDefaultState()); } } } return primer; } @Override public void populate(Cube cube) { } @Override public Vec3i[] getPopRequirment(Cube cube) { return NO_POPULTOR_REQUIRMENT; } }; }

Target:
@Override public ICubeGenerator createCubeGenerator(ICubicWorldServer world) { return new BasicCubeGenerator(world) { Perlin perlin = new Perlin(); { perlin.setFrequency(0.180); perlin.setOctaveCount(1); perlin.setSeed((int) world.getSeed()); } @Override public ICubePrimer generateCube(int cubeX, int cubeY, int cubeZ) { ICubePrimer primer = new CubePrimer(); if(cubeY > 30) { return primer; } if(cubeX == 100 && cubeZ == 100) { return primer; } CubeCoords cubePos = new CubeCoords(cubeX, cubeY, cubeZ); for(BlockPos pos : BlockPos.getAllInBoxMutable(cubePos.getMinBlockPos(), cubePos.getMaxBlockPos())) { double currDensity = perlin.getValue(pos.getX(), pos.getY()*0.5, pos.getZ()); double aboveDensity = perlin.getValue(pos.getX(), (pos.getY()+1)*0.5, pos.getZ()); if(cubeY >= 16) { currDensity -= (pos.getY() - 16*16)/100; aboveDensity -= (pos.getY() + 1 - 16*16)/100; } if(currDensity > 0.5) { if(currDensity > 0.5 && aboveDensity <= 0.5) { primer.setBlockState(pos.getX(), pos.getY(), pos.getZ(), Blocks.GRASS.getDefaultState()); } else if(currDensity > aboveDensity && currDensity < 0.7) { primer.setBlockState(pos.getX(), pos.getY(), pos.getZ(), Blocks.DIRT.getDefaultState()); } else { primer.setBlockState(pos.getX(), pos.getY(), pos.getZ(), Blocks.STONE.getDefaultState()); } } } return primer; } @Override public void populate(Cube cube) { } @Override public Box getPopulationRequirement(Cube cube) { return NO_POPULATOR_REQUIREMENT; } }; }
Source:
private Integer getMaxBandwidth(MigrationPolicy migrationPolicy) { switch (getCluster().getMigrationBandwidthLimitType()) { case AUTO: return Optional.ofNullable(getAutoMaxBandwidth()) .map(bandwidth -> bandwidth / migrationPolicy.getMaxMigrations()) .orElse(null); case VDSM_CONFIG: return null; case CUSTOM: return getCluster().getCustomMigrationNetworkBandwidth() / migrationPolicy.getMaxMigrations(); default: throw new IllegalStateException("Unexpected enum item."); } }

Target:
private Integer getMaxBandwidth(MigrationPolicy migrationPolicy) { switch (getCluster().getMigrationBandwidthLimitType()) { case AUTO: return Optional.ofNullable(getAutoMaxBandwidth()) .map(bandwidth -> bandwidth / migrationPolicy.getMaxMigrations()) .orElse(null); case VDSM_CONFIG: return null; case CUSTOM: return getCluster().getCustomMigrationNetworkBandwidth() / migrationPolicy.getMaxMigrations(); default: throw new IllegalStateException( "Unexpected enum item: " + getCluster().getMigrationBandwidthLimitType()); } }
Source:
public Pair<VM, FullEntityOvfData> readVmFromOvf(String ovf) throws OvfReaderException { VM vm = new VM(); FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(vm); ovfManager.importVm(ovf, vm, fullEntityOvfData); vm.setImages((ArrayList) fullEntityOvfData.getDiskImages()); vm.setInterfaces(fullEntityOvfData.getInterfaces()); Map<Guid, List<DiskImage>> images = ImagesHandler .getImagesLeaf(fullEntityOvfData.getDiskImages()); for (Map.Entry<Guid, List<DiskImage>> entry : images.entrySet()) { List<DiskImage> list = entry.getValue(); vm.getDiskMap().put(entry.getKey(), list.get(list.size() - 1)); } for (LunDisk lunDisk : fullEntityOvfData.getLunDisks()) { vm.getDiskMap().put(lunDisk.getId(), lunDisk); } return new Pair<>(vm, fullEntityOvfData); }

Target:
public Pair<VM, FullEntityOvfData> readVmFromOvf(String ovf) throws OvfReaderException { VM vm = new VM(); FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(vm); ovfManager.importVm(ovf, vm, fullEntityOvfData); vm.setImages((ArrayList) fullEntityOvfData.getDiskImages()); vm.setInterfaces(fullEntityOvfData.getInterfaces()); Map<Guid, List<DiskImage>> images = ImagesHandler .getImagesLeaf(fullEntityOvfData.getDiskImages()); for (Map.Entry<Guid, List<DiskImage>> entry : images.entrySet()) { List<DiskImage> list = entry.getValue(); vm.getDiskMap().put(entry.getKey(), list.get(list.size() - 1)); } fullEntityOvfData.getLunDisks().forEach(lunDisk -> vm.getDiskMap().put(lunDisk.getId(), lunDisk)); return new Pair<>(vm, fullEntityOvfData); }
Source:
public T get(K key, String[] fields) throws GoraException { String[] avFields = getFieldsToQuery(fields); Object[] keyl = null; if (igniteMapping.getPrimaryKey().size() == 1) { keyl = new Object[]{key}; } else { } List<String> dbFields = new ArrayList<>(); for (String af : avFields) { dbFields.add(igniteMapping.getFields().get(af).getName()); } String selectQuery = IgniteSQLBuilder.selectGet(igniteMapping, dbFields); try (PreparedStatement stmt = connection.prepareStatement(selectQuery)) { IgniteSQLBuilder.fillSelectStatement(stmt, igniteMapping, keyl); ResultSet rs = stmt.executeQuery(); boolean data = rs.next(); T resp = null; if (data) { resp = newInstance(rs, fields); if (rs.next()) { LOG.warn("Multiple results for primary key in the schema {}, ignoring additional rows.", keyl, igniteMapping.getTableName()); } } rs.close(); return resp; } catch (SQLException | IOException ex) { throw new GoraException(ex); } }

Target:
public T get(K key, String[] fields) throws GoraException { String[] avFields = getFieldsToQuery(fields); Object[] keyl = null; if (igniteMapping.getPrimaryKey().size() == 1) { keyl = new Object[]{key}; } else { } List<String> dbFields = new ArrayList<>(); for (String af : avFields) { dbFields.add(igniteMapping.getFields().get(af).getName()); } String selectQuery = IgniteSQLBuilder.createSelectQueryGet(igniteMapping, dbFields); try (PreparedStatement stmt = connection.prepareStatement(selectQuery)) { IgniteSQLBuilder.fillSelectQuery(stmt, igniteMapping, keyl); ResultSet rs = stmt.executeQuery(); boolean data = rs.next(); T resp = null; if (data) { resp = newInstance(rs, fields); if (rs.next()) { LOG.warn("Multiple results for primary key in the schema {}, ignoring additional rows.", keyl, igniteMapping.getTableName()); } } rs.close(); return resp; } catch (SQLException | IOException ex) { throw new GoraException(ex); } }
Source:
private void reply(org.jgroups.blocks.Response response, Object retVal, ReplicableCommand command, Message req) { if (response != null) { if (trace) log.tracef("About to send back response %s for command %s", retVal, command); Buffer rsp_buf; boolean is_exception = false; try { rsp_buf = rsp_marshaller.objectToBuffer(retVal); } catch (Throwable t) { try { rsp_buf = rsp_marshaller.objectToBuffer(t); is_exception = true; } catch (Throwable tt) { log.errorMarshallingObject(tt, retVal); return; } } short flags = (short) (req.getFlags() | NO_FC.value() & ~Message.Flag.RSVP.value() & ~Message.Flag.SCOPED.value()); Message rsp = req.makeReply().setFlag(flags).setBuffer(rsp_buf); response.send(rsp, is_exception); } }

Target:
private void reply(org.jgroups.blocks.Response response, Object retVal, ReplicableCommand command, Message req) { if (response != null) { if (trace) log.tracef("About to send back response %s for command %s", retVal, command); Buffer rsp_buf; boolean is_exception = false; try { rsp_buf = rsp_marshaller.objectToBuffer(retVal); } catch (Throwable t) { try { rsp_buf = rsp_marshaller.objectToBuffer(t); is_exception = true; } catch (Throwable tt) { log.errorMarshallingObject(tt, retVal); return; } } short flags = (short) (req.getFlags() | REPLY_FLAGS_TO_SET & ~REPLY_FLAGS_TO_CLEAR); Message rsp = req.makeReply().setFlag(flags).setBuffer(rsp_buf); response.send(rsp, is_exception); } }
Source:
public void setProgressMonitor(ProgressMonitor monitor) { if (monitor == null) { monitor = NullProgressMonitor.INSTANCE; } this.monitor = monitor; }

Target:
public void setProgressMonitor(ProgressMonitor monitor) { this.monitor = monitor != null ? monitor : NullProgressMonitor.INSTANCE; }
Source:
public String getType(String path, long destination, boolean includeVicinityIssues){ String result = null; for (StashDiff diff : diffs) { if (StringUtils.equals(diff.getPath(), path) && (destination == 0)){ result = StashPlugin.CONTEXT_ISSUE_TYPE; break; } else{ if (StringUtils.equals(diff.getPath(), path) && ((diff.getDestination() == destination) || (includeVicinityIssues && Ranges.closed(diff.getSource() - PR_DIFF_COMMENT_OFFSET, diff.getDestination() + PR_DIFF_COMMENT_OFFSET).contains(destination)))) { result = diff.getType(); break; } } } return result; }

Target:
public String getType(String path, long destination, boolean includeVicinityIssues){ String result = null; for (StashDiff diff : diffs) { if (StringUtils.equals(diff.getPath(), path) && (destination == 0)){ result = StashPlugin.CONTEXT_ISSUE_TYPE; break; } else{ if (StringUtils.equals(diff.getPath(), path) && ((diff.getDestination() == destination) || includeVicinityIssuesForDiff(diff, destination, includeVicinityIssues))) { result = diff.getType(); break; } } } return result; }
Source:
public void testFileBatchInputFormatAvro() throws Exception { File fileAvro = temporaryFolder.newFolder("test2").toPath().resolve(fileName + "-test6.avro").toFile(); String outputDatasetName = "test-filesource-avro"; ApplicationManager appManager = createSourceAndDeployApp(fileAvro, "avro", outputDatasetName); org.apache.avro.Schema avroSchema = new org.apache.avro.Schema.Parser().parse(RECORD_SCHEMA.toString()); GenericRecord record = new GenericRecordBuilder(avroSchema) .set("i", Integer.MAX_VALUE) .set("l", Long.MAX_VALUE) .build(); DataSetManager<TimePartitionedFileSet> inputManager = getDataset("TestFile"); DatumWriter<GenericRecord> datumWriter = new GenericDatumWriter<>(avroSchema); DataFileWriter<GenericRecord> dataFileWriter = new DataFileWriter<>(datumWriter); dataFileWriter.create(avroSchema, fileAvro); dataFileWriter.append(record); dataFileWriter.close(); inputManager.flush(); workflowStartAndWait(appManager); List<StructuredRecord> input = ImmutableList.of( StructuredRecord.builder(RECORD_SCHEMA) .set("i", Integer.MAX_VALUE) .set("l", Long.MAX_VALUE) .build() ); DataSetManager<Table> outputManager = getDataset(outputDatasetName); List<StructuredRecord> output = MockSink.readOutput(outputManager); Assert.assertEquals(input, output); }

Target:
public void testFileBatchInputFormatAvro() throws Exception { File fileAvro = new File(temporaryFolder.newFolder(), "test.avro"); String outputDatasetName = "test-filesource-avro"; ApplicationManager appManager = createSourceAndDeployApp(fileAvro, "avro", outputDatasetName, RECORD_SCHEMA); org.apache.avro.Schema avroSchema = new org.apache.avro.Schema.Parser().parse(RECORD_SCHEMA.toString()); GenericRecord record = new GenericRecordBuilder(avroSchema) .set("i", Integer.MAX_VALUE) .set("l", Long.MAX_VALUE) .set("file", fileAvro.getAbsolutePath()) .build(); DataSetManager<TimePartitionedFileSet> inputManager = getDataset("TestFile"); DatumWriter<GenericRecord> datumWriter = new GenericDatumWriter<>(avroSchema); DataFileWriter<GenericRecord> dataFileWriter = new DataFileWriter<>(datumWriter); dataFileWriter.create(avroSchema, fileAvro); dataFileWriter.append(record); dataFileWriter.close(); inputManager.flush(); workflowStartAndWait(appManager); List<StructuredRecord> expected = ImmutableList.of( StructuredRecord.builder(RECORD_SCHEMA) .set("i", Integer.MAX_VALUE) .set("l", Long.MAX_VALUE) .set("file", fileAvro.toURI().toString()) .build() ); DataSetManager<Table> outputManager = getDataset(outputDatasetName); List<StructuredRecord> output = MockSink.readOutput(outputManager); Assert.assertEquals(output, expected); }
Source:
public boolean visit(IResourceDelta delta) { if (delta.getKind() == IResourceDelta.REMOVED || (delta.getFlags() | delta.getKind()) == (IResourceDelta.OPEN | IResourceDelta.CHANGED)) { return false; } IResourceDelta[] removedFiles = delta.getAffectedChildren(IResourceDelta.REMOVED); if (removedFiles.length <= 0) { return false; } boolean RPMsDeleted = false; for (IResourceDelta resourceDelta : removedFiles) { String extension = resourceDelta.getResource().getFileExtension(); if (extension != null && extension.equals(ICreaterepoConstants.RPM_FILE_EXTENSION)) { RPMsDeleted = true; break; } } if (!RPMsDeleted) { return false; } PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { refreshTree(); } }); return false; }

Target:
public boolean visit(IResourceDelta delta) { if (delta.getKind() == IResourceDelta.REMOVED || (delta.getFlags() | delta.getKind()) == (IResourceDelta.OPEN | IResourceDelta.CHANGED)) { return false; } IResourceDelta[] removedFiles = delta.getAffectedChildren(IResourceDelta.REMOVED); if (removedFiles.length <= 0) { return false; } boolean rpmsDeleted = false; for (IResourceDelta resourceDelta : removedFiles) { String extension = resourceDelta.getResource().getFileExtension(); if (extension != null && extension.equals(ICreaterepoConstants.RPM_FILE_EXTENSION)) { rpmsDeleted = true; break; } } if (!rpmsDeleted) { return false; } PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { refreshTree(); } }); return false; }
Source:
public UriSource(@JsonProperty(value = "uri", required = true) final String uri) throws URISyntaxException { URI parsedUri = URI.create(Objects.requireNonNull(uri, "Parameter uri to UriSource may not be null")); if (parsedUri.getScheme().equals("s3")) { parsedUri = new URI("s3a", parsedUri.getUserInfo(), parsedUri.getHost(), parsedUri.getPort(), parsedUri.getPath(), parsedUri.getQuery(), parsedUri.getFragment()); } this.uri = parsedUri.toString(); }

Target:
public UriSource(@JsonProperty(value = "uri", required = true) final String uri) throws URISyntaxException { parsedUri = URI.create(Objects.requireNonNull(uri, "Parameter uri to UriSource may not be null")); if (parsedUri.getScheme().equals("s3")) { parsedUri = new URI("s3a", parsedUri.getUserInfo(), parsedUri.getHost(), parsedUri.getPort(), parsedUri.getPath(), parsedUri.getQuery(), parsedUri.getFragment()); } }
Source:
private TokenParam extractIdentifierFromOtherResourceTypes(IBaseResource resource) { FhirTerser terser = myFhirContext.newTerser(); Identifier myIdentifier = (Identifier) terser.getSingleValueOrNull(resource, "identifier"); return new TokenParam(myIdentifier.getSystem(), myIdentifier.getValue()); }

Target:
private TokenParam extractIdentifierFromOtherResourceTypes(IBaseResource resource) { FhirTerser terser = myFhirContext.newTerser(); Identifier identifier = (Identifier) terser.getSingleValueOrNull(resource, "identifier"); if (identifier != null) { return new TokenParam(identifier.getSystem(), identifier.getValue()); } else { throw new UnsupportedOperationException("Resources in a package must have a url or identifier to be loaded by the package installer."); } }
Source:
boolean startBlobStore(PartitionId id) { BlobStore store = stores.get(id); if (store == null || store.isStarted() || !running) { return false; } try { store.start(); } catch (Exception e) { logger.error("Exception while starting store on disk {}", id, disk, e); return false; } return true; }

Target:
boolean startBlobStore(PartitionId id) { BlobStore store = stores.get(id); if (store == null || !running) { return false; } else if (store.isStarted()) { return true; } else { try { store.start(); } catch (Exception e) { logger.error("Exception while starting store on disk {}", id, disk, e); return false; } return true; } }
Source:
public void copyFile(File file) { File tmp = null; try { tmp = File.createTempFile("jenkins-acceptance-tests", "dir"); ZipUtil.pack(file, tmp); byte[] archive = IOUtils.toByteArray(new FileInputStream(tmp)); if (SystemUtils.IS_OS_WINDOWS) { addBatchStep("xcopy " + file.getAbsolutePath() + " %cd% /E"); } else { addShellStep(String.format( "base64 --decode << ENDOFFILE > archive.zip && unzip -o archive.zip \n%s\nENDOFFILE", new String(Base64.encodeBase64Chunked(archive)) )); } } catch (IOException e) { throw new AssertionError(e); } finally { if (tmp != null) { tmp.delete(); } } }

Target:
public void copyFile(File file) { File tmp = null; try { tmp = File.createTempFile("jenkins-acceptance-tests", "dir"); ZipUtil.pack(file, tmp); byte[] archive = IOUtils.toByteArray(new FileInputStream(tmp)); if (SystemUtils.IS_OS_WINDOWS) { if (!(controller instanceof LocalController)) { throw new AssumptionViolatedException("Copying files in Windows is only supported if a LocalController is in use. Test will be skipped."); } addBatchStep("xcopy " + file.getAbsolutePath() + " %cd% /E"); } else { addShellStep(String.format( "base64 --decode << ENDOFFILE > archive.zip && unzip -o archive.zip \n%s\nENDOFFILE", new String(Base64.encodeBase64Chunked(archive)) )); } } catch (IOException e) { throw new AssertionError(e); } finally { if (tmp != null) { tmp.delete(); } } }
Source:
public ConsumerInstalledProductDTO clone() { return super.clone(); }

Target:
public ConsumerInstalledProductDTO clone() { ConsumerInstalledProductDTO copy = super.clone(); Date startDate = this.getStartDate(); copy.startDate = startDate != null ? (Date) startDate.clone() : null; Date endDate = this.getEndDate(); copy.endDate = endDate != null ? (Date) endDate.clone() : null; return super.clone(); }
Source:
public StorageManager(StoreConfig storeConfig, DiskManagerConfig diskManagerConfig, ScheduledExecutorService scheduler, MetricRegistry registry, List<? extends ReplicaId> replicas, StoreKeyFactory keyFactory, MessageStoreRecovery recovery, MessageStoreHardDelete hardDelete, ReplicaStatusDelegate replicaStatusDelegate, Time time) throws StoreException { verifyConfigs(storeConfig, diskManagerConfig); metrics = new StorageManagerMetrics(registry); StoreMetrics storeMainMetrics = new StoreMetrics(registry); StoreMetrics storeUnderCompactionMetrics = new StoreMetrics("UnderCompaction", registry); List<String> stoppedReplicas = replicaStatusDelegate == null ? new ArrayList<>() : replicaStatusDelegate.getStoppedReplicas(); this.time = time; Map<DiskId, List<ReplicaId>> diskToReplicaMap = new HashMap<>(); for (ReplicaId replica : replicas) { DiskId disk = replica.getDiskId(); diskToReplicaMap.computeIfAbsent(disk, key -> new ArrayList<>()).add(replica); } for (Map.Entry<DiskId, List<ReplicaId>> entry : diskToReplicaMap.entrySet()) { DiskId disk = entry.getKey(); List<ReplicaId> replicasForDisk = entry.getValue(); DiskManager diskManager = new DiskManager(disk, replicasForDisk, storeConfig, diskManagerConfig, scheduler, metrics, storeMainMetrics, storeUnderCompactionMetrics, keyFactory, recovery, hardDelete, replicaStatusDelegate, stoppedReplicas, time); diskManagers.add(diskManager); for (ReplicaId replica : replicasForDisk) { partitionToDiskManager.put(replica.getPartitionId(), diskManager); } } }

Target:
public StorageManager(StoreConfig storeConfig, DiskManagerConfig diskManagerConfig, ScheduledExecutorService scheduler, MetricRegistry registry, List<? extends ReplicaId> replicas, StoreKeyFactory keyFactory, MessageStoreRecovery recovery, MessageStoreHardDelete hardDelete, ReplicaStatusDelegate replicaStatusDelegate, Time time) throws StoreException { verifyConfigs(storeConfig, diskManagerConfig); metrics = new StorageManagerMetrics(registry); StoreMetrics storeMainMetrics = new StoreMetrics(registry); StoreMetrics storeUnderCompactionMetrics = new StoreMetrics("UnderCompaction", registry); List<String> stoppedReplicas = replicaStatusDelegate == null ? Collections.emptyList() : replicaStatusDelegate.getStoppedReplicas(); this.time = time; Map<DiskId, List<ReplicaId>> diskToReplicaMap = new HashMap<>(); for (ReplicaId replica : replicas) { DiskId disk = replica.getDiskId(); diskToReplicaMap.computeIfAbsent(disk, key -> new ArrayList<>()).add(replica); } for (Map.Entry<DiskId, List<ReplicaId>> entry : diskToReplicaMap.entrySet()) { DiskId disk = entry.getKey(); List<ReplicaId> replicasForDisk = entry.getValue(); DiskManager diskManager = new DiskManager(disk, replicasForDisk, storeConfig, diskManagerConfig, scheduler, metrics, storeMainMetrics, storeUnderCompactionMetrics, keyFactory, recovery, hardDelete, replicaStatusDelegate, stoppedReplicas, time); diskManagers.add(diskManager); for (ReplicaId replica : replicasForDisk) { partitionToDiskManager.put(replica.getPartitionId(), diskManager); } } }