auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public FoundIndication scan(Run build) throws IOException { String currentfile = build.getLogFile().getName(); BufferedReader reader = null; try { <START> reader = new BufferedReader(new InputStreamReader(build.getLogInputStream(), Charsets.UTF_8)); <END> return scanMultiLineOneFile(build, reader, currentfile); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to close the reader. ", e); } } } }</code><technical_language>Run a getCharSet() method, I feel one. I.e.: new InputStreamReader(build.getLogInputStream(), build.getCharSet())</technical_language>

Target:
public FoundIndication scan(Run build) throws IOException { String currentfile = build.getLogFile().getName(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(build.getLogInputStream(), build.getCharset())); return scanMultiLineOneFile(build, reader, currentfile); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to close the reader. ", e); } } } }
Source:
<code>public String mapOrganizationName(String name) { final Predicate<Map.Entry<String, String>> matcher; if (customMappingEnabled) { if (matchPrefix) { matcher = e -> name.startsWith(e.getKey()); } else { matcher = e -> name.equals(e.getKey()); } } else { <START> matcher = e -> false; <END> } return sortedOrganizationMappings.stream() .filter(matcher) .findFirst() .map(Map.Entry::getValue) .orElse(name); }</code><technical_language>just: return name</technical_language>

Target:
public String mapOrganizationName(String name) { if (!customMappingEnabled) { return name; } final Predicate<Map.Entry<String, String>> matcher; if (matchPrefix) { matcher = e -> name.startsWith(e.getKey()); } else { matcher = e -> name.equals(e.getKey()); } return sortedOrganizationMappings.stream() .filter(matcher) .findFirst() .map(Map.Entry::getValue) .orElse(name); }
Source:
<code>public String getData() throws IOException { int thisProduct =0, thisUser =0; Files.deleteIfExists(Paths.get("Result.csv")); File result = new File("Result.csv"); InputStream fileReader = new GZIPInputStream(new FileInputStream(this.file)); BufferedReader br = new BufferedReader(new InputStreamReader(fileReader)); FileWriter fileWriter = new FileWriter(result); BufferedWriter bw = new BufferedWriter(fileWriter); String line; String[] sp; String key, value; while((line = br.readLine()) != null) { if (line.length() >= 0) { sp = line.split(" "); key = sp[0]; if (key.equals("product/productId:")) { value = sp[1]; if (!HashProduct.containsKey(value)){ HashProduct.put(value,products); InvertedHashProduct.put(products,value); thisProduct = HashProduct.get(value); products++; }else{ thisProduct = HashProduct.get(value); } }else if (key.equals("review/userId:")){ value = sp[1]; if (!HashUser.containsKey(value)){ HashUser.put(value, users); thisUser = HashUser.get(value); users++; }else{ thisUser = HashUser.get(value); } }else if (key.equals("review/score:")){ String score = sp[1]; bw.write(thisUser + "," + thisProduct + "," + score + "\n"); reviews ++; } } } <START> br.close(); <END> bw.close(); return null; }</code><technical_language>I this is in a finally block. heard try-catch-with-resources? please investigate it</technical_language>

Target:
private void getData() throws IOException { int thisProduct =0, thisUser =0; Files.deleteIfExists(Paths.get("Result.csv")); File result = new File("Result.csv"); InputStream fileReader = new GZIPInputStream(new FileInputStream(this.file)); FileWriter fileWriter = new FileWriter(result); String line; String[] sp; String key, value; try (BufferedReader br = new BufferedReader(new InputStreamReader(fileReader)); BufferedWriter bw = new BufferedWriter(fileWriter)) { System.out.println("Reading File: "+this.file); while((line = br.readLine()) != null) { if (line.length() >= 0) { sp = line.split(":"); key = sp[0]; if ("product/productId".equals(key)) { value = sp[1].trim(); if (!HashProduct.containsKey(value)){ HashProduct.put(value,products); InvertedHashProduct.put(products,value); thisProduct = HashProduct.get(value); products++; }else{ thisProduct = HashProduct.get(value); } }else if ("review/userId".equals(key)){ value = sp[1].trim(); if (!HashUser.containsKey(value)){ HashUser.put(value, users); thisUser = HashUser.get(value); users++; }else{ thisUser = HashUser.get(value); } }else if ("review/score".equals(key)){ String score = sp[1].trim(); bw.write(thisUser + "," + thisProduct + "," + score + "\n"); reviews ++; } } } } catch (FileNotFoundException e) { e.printStackTrace(); } }
Source:
<code>public static <ValueT> Async<ValueT> constant(final ValueT val) { return new Async<ValueT>() { @Override public Registration onSuccess(Handler<? super ValueT> successHandler) { successHandler.handle(val); return Registration.EMPTY; } @Override public Registration onResult(Handler<? super ValueT> successHandler, Handler<Throwable> failureHandler) { return onSuccess(successHandler); } @Override public Registration onFailure(Handler<Throwable> failureHandler) { return Registration.EMPTY; } @Override public <ResultT> Async<ResultT> map(final Function<? super ValueT, ? extends ResultT> success) { <START> Function<? super ValueT, ResultT> newFunction = new Function<ValueT, ResultT>() { <END> @Override public ResultT apply(ValueT value) { return success.apply(value); } }; return Asyncs.map(this, newFunction); } @Override public <ResultT> Async<ResultT> then(Function<? super ValueT, Async<ResultT>> success) { return Asyncs.select(this, success); } }; }</code><technical_language>change Asyncs.map() signature instead of creating functions</technical_language>

Target:
public static <ValueT> Async<ValueT> constant(final ValueT val) { return new Async<ValueT>() { @Override public Registration onSuccess(Handler<? super ValueT> successHandler) { successHandler.handle(val); return Registration.EMPTY; } @Override public Registration onResult(Handler<? super ValueT> successHandler, Handler<Throwable> failureHandler) { return onSuccess(successHandler); } @Override public Registration onFailure(Handler<Throwable> failureHandler) { return Registration.EMPTY; } @Override public <ResultT> Async<ResultT> map(final Function<? super ValueT, ? extends ResultT> success) { return Asyncs.map(this, success); } @Override public <ResultT> Async<ResultT> flatMap(Function<? super ValueT, Async<ResultT>> success) { return Asyncs.select(this, success); } }; }
Source:
<code>public void deleteMessages(Map<SystemStreamPartition, String> offsets) { if (deleteCommittedMessages) { Map<TopicPartition, RecordsToDelete> recordsToDelete = offsets.entrySet() .stream() .collect(Collectors.toMap(entry -> new TopicPartition(entry.getKey().getStream(), entry.getKey().getPartition().getPartitionId()), entry -> RecordsToDelete.beforeOffset(Long.parseLong(entry.getValue()) + 1))); <START> adminClient.deleteRecords(recordsToDelete).all().whenComplete((ignored, exception) -> { <END> if (exception != null) { LOG.error("Delete message failed for SSPs due to {}", offsets.keySet(), exception); } }); deleteMessageCalled = true; } }</code><technical_language>double check, whenComplete is async, right</technical_language>

Target:
public void deleteMessages(Map<SystemStreamPartition, String> offsets) { if (deleteCommittedMessages) { Map<TopicPartition, RecordsToDelete> recordsToDelete = offsets.entrySet() .stream() .collect(Collectors.toMap(entry -> new TopicPartition(entry.getKey().getStream(), entry.getKey().getPartition().getPartitionId()), entry -> RecordsToDelete.beforeOffset(Long.parseLong(entry.getValue()) + 1))); adminClient.deleteRecords(recordsToDelete).all().whenComplete((ignored, exception) -> { if (exception != null) { LOG.error("Delete message failed for SSPs " + offsets.keySet() + " due to", exception); } }); deleteMessageCalled = true; } }
Source:
<code><START> public final synchronized ByteBuffer next() { <END> seq += inc; if (seq >= maxSeq) { randomizePrefix(); resetSequential(); } byte[] b = new byte[totalLen]; System.arraycopy(pre, 0, b, 0, preLen); int i = b.length; for (long l = seq; i > preLen; l /= base) { i--; b[i] = (byte) (l % base + (byte)'0'); } return ByteBuffer.wrap(b); }</code><technical_language>This break existing users... deprecate, add nextByteBuffer()</technical_language>

Target:
public final String next() { return StandardCharsets.US_ASCII.decode(getInstance().nextBuffer()).toString(); }
Source:
<code>public void testCurrentSize() throws Exception { Neo4jItemReader<String> itemReader = new Neo4jItemReaderBuilder<String>().sessionFactory(this.sessionFactory) .targetType(String.class).startStatement("n=node(*)").orderByStatement("n.age").pageSize(50).name("bar") <START> .returnStatement("m").currentItemCount(5).maxItemCount(5).build(); <END> when(this.sessionFactory.openSession()).thenReturn(this.session); when(this.session.query(String.class, "START n=node(*) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", null)) .thenReturn(result); when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator()); assertNull("The expected value was not returned by reader.", itemReader.read()); itemReader = new Neo4jItemReaderBuilder<String>().sessionFactory(this.sessionFactory).targetType(String.class) .startStatement("n=node(*)").orderByStatement("n.age").pageSize(50).name("bar").returnStatement("m") .currentItemCount(0).maxItemCount(1).build(); assertEquals("The expected value was not returned by reader.", "foo", itemReader.read()); assertNull("The expected value was not should be null.", itemReader.read()); }</code><technical_language>Formatting. fix merge</technical_language>

Target:
public void testCurrentSize() throws Exception { Neo4jItemReader<String> itemReader = new Neo4jItemReaderBuilder<String>() .sessionFactory(this.sessionFactory) .targetType(String.class) .startStatement("n=node(*)") .orderByStatement("n.age") .pageSize(50).name("bar") .returnStatement("m") .currentItemCount(0) .maxItemCount(1) .build(); when(this.sessionFactory.openSession()).thenReturn(this.session); when(this.session.query(String.class, "START n=node(*) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", null)) .thenReturn(result); when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator()); assertEquals("The expected value was not returned by reader.", "foo", itemReader.read()); assertNull("The expected value was not should be null.", itemReader.read()); }
Source:
<code>protected void reset(int retainFlags) { finishDelayedFreeFlags(); retainFlags |= PARSED | retainOnReset; final int clearFlags = ~retainFlags; final FIFORevQueue q = new FIFORevQueue(); for (RevCommit c : roots) { if ((c.flags & clearFlags) == 0) continue; c.flags &= retainFlags; c.reset(); q.add(c); } for (;;) { final RevCommit c = q.next(); if (c == null) break; if (c.parents == null) continue; for (RevCommit p : c.parents) { if ((p.flags & clearFlags) == 0) continue; p.flags &= retainFlags; p.reset(); q.add(p); } } roots.clear(); <START> queue = new DateRevQueue(firstParent); <END> pending = new StartGenerator(this); }</code><technical_language>I value, consistent sorting (that is reset either)</technical_language>

Target:
protected void reset(int retainFlags) { finishDelayedFreeFlags(); retainFlags |= PARSED | retainOnReset; final int clearFlags = ~retainFlags; final FIFORevQueue q = new FIFORevQueue(); for (RevCommit c : roots) { if ((c.flags & clearFlags) == 0) continue; c.flags &= retainFlags; c.reset(); q.add(c); } for (;;) { final RevCommit c = q.next(); if (c == null) break; if (c.parents == null) continue; for (RevCommit p : c.parents) { if ((p.flags & clearFlags) == 0) continue; p.flags &= retainFlags; p.reset(); q.add(p); } } roots.clear(); firstParent = false; queue = new DateRevQueue(firstParent); pending = new StartGenerator(this); }
Source:
<code>public void actionPerformed(ActionEvent e) { setContinue(true); setBreakAll(false); setBreakRequest(false); setBreakResponse(false); <START> setBreakOnJavaScript(isBreakOnJavaScript); setBreakOnCSSAndFonts(isBreakOnCSSAndFonts); setBreakOnMultimedia(isBreakOnMultimedia); setOnlyBreakOnScope(isOnlyBreakOnScope); <END> }</code><technical_language>needed</technical_language>

Target:
public void actionPerformed(ActionEvent e) { if (!breakPanel.isValidState()) { return; } setContinue(true); setBreakAll(false); setBreakRequest(false); setBreakResponse(false); }
Source:
<code><START> @Override public MapColor shade(MapShade newShading) { <END> return this.baseColor.shade(newShading); }</code><technical_language>Annotations a new line</technical_language>

Target:
public MapColor shade(MapShade newShading) { return this.baseColor.shade(newShading); }
Source:
<code>private String computeDigest() { StringBuilder buf = new StringBuilder("rule [" + getRule() + "] rels ["); for (int i = 0; i < rels.length; i++) { if (i > 0) { <START> buf.append(", "); <END> } buf.append("#" + rels[i].getId()); } buf.append("]"); return buf.toString(); }</code><technical_language>changing digest is computed anyway, simplify this buf.append(',');</technical_language>

Target:
private String computeDigest() { StringBuilder buf = new StringBuilder("rule [" + getRule() + "] rels ["); for (int i = 0; i < rels.length; i++) { if (i > 0) { buf.append(','); } buf.append('#').append(rels[i].getId()); } buf.append(']'); return buf.toString(); }
Source:
<code>public int getFontSize() { <START> return fontSize; <END> }</code><technical_language>remove fontSize/fontName call new methods instead (e.g. getFontSize(FontUtils.FontType.general))</technical_language>

Target:
public int getFontSize() { return getFontSize(FontUtils.FontType.general); }
Source:
<code>public InterruptedException shutDownAll() { pools.forEach( ( group, pool ) -> pool.cancelAllJobs() ); pools.forEach( ( group, pool ) -> pool.shutDown() ); <START> return pools.values().stream().reduce( null, <END> ( e, p ) -> Exceptions.chain( e, p.getShutdownException() ), Exceptions::chain ); }</code><technical_language>I prefer a simpler map-reduce instead: java return pools.values().stream().map( ThreadPool::getShutdownException ).reduce( null, Exceptions::chain );</technical_language>

Target:
public InterruptedException shutDownAll() { pools.forEach( ( group, pool ) -> pool.cancelAllJobs() ); pools.forEach( ( group, pool ) -> pool.shutDown() ); return pools.values().stream() .map( ThreadPool::getShutdownException ) .reduce( null, Exceptions::chain ); }
Source:
<code>PlatformTransactionManager athenaTransactionManager(@Qualifier("athenaEntityManagerFactory") EntityManagerFactory entityManagerFactory) { return new JpaTransactionManager(entityManagerFactory); <START> } <END></code><technical_language>set explicitly access modifies. I public</technical_language>

Target:
public PlatformTransactionManager athenaTransactionManager(@Qualifier("athenaEntityManagerFactory") EntityManagerFactory entityManagerFactory) { return new JpaTransactionManager(entityManagerFactory); }
Source:
<code>public void setCodeMiningProviders(ICodeMiningProvider[] codeMiningProviders) { if (fCodeMiningProviders != null) { for (ICodeMiningProvider contentMiningProvider : fCodeMiningProviders) { contentMiningProvider.dispose(); } } <START> fCodeMiningProviders= Arrays.asList(codeMiningProviders); <END> }</code><technical_language>I want change field, dispose codeMiningProviders. this line move in line 99. Also, this approach of greedily disposing, setCodeMiningProviders([a, b]); setCodeMiningProviders([a]) leads a bug a is disposed referenced. current fCodeMiningPRoviders checked part of new codeMiningProviders disposing them</technical_language>

Target:
public void setCodeMiningProviders(ICodeMiningProvider[] codeMiningProviders) { List<CodeMiningProviderWrapper> oldCodeMiningProviders= fCodeMiningProviders; fCodeMiningProviders= Stream.of(codeMiningProviders).map(provider -> new CodeMiningProviderWrapper(provider)).collect(Collectors.toList()); if (oldCodeMiningProviders != null) { for (CodeMiningProviderWrapper provider : oldCodeMiningProviders) { provider.dispose(); } } }
Source:
<code><START> public SubscriptionMetrics() { <END> }</code><technical_language>do need this constructor</technical_language>

Target:
private SubscriptionMetrics() { }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_form_display, container, false); getActivity().getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); mParent = (LinearLayout) root.findViewById(R.id.sectionContainer); <START> mPresenter.subscribe(); <END> return root; }</code><technical_language>This is duplicated</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_form_display, container, false); getActivity().getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); mParent = (LinearLayout) root.findViewById(R.id.sectionContainer); return root; }
Source:
<code>public void shouldThrowException_WhenNoParameters() throws Exception { when(network.isConnected()).thenReturn(true); <START> ExternalViewPresenter mock_up_presenter = new ExternalViewPresenter(view, network){ <END> @Override protected boolean invalidParam(String url) { return true; } }; mock_up_presenter.onViewCreated(); }</code><technical_language>underscore in java for naming</technical_language>

Target:
public void shouldThrowException_WhenNoParameters() throws Exception { when(network.isConnected()).thenReturn(true); when(view.extractTitle()).thenReturn(null); when(view.extractUrl()).thenReturn(null); presenter.onViewCreated(); }
Source:
<code>public void shouldThrowStreamsExceptionWithTimeoutHintOnProducerTimeoutWithDefaultExceptionHandler() { final RecordCollector collector = new RecordCollectorImpl( "test", logContext, new DefaultProductionExceptionHandler(), new Metrics().sensor("skipped-records")); <START> collector.init(new MockProducer(cluster, true, new DefaultPartitioner(), byteArraySerializer, byteArraySerializer) { <END> @Override public synchronized Future<RecordMetadata> send(final ProducerRecord record, final Callback callback) { callback.onCompletion(null, new TimeoutException()); return null; } }); collector.send("topic1", "3", "0", null, null, stringSerializer, stringSerializer, streamPartitioner); try { collector.flush(); fail("Should have thrown StreamsException"); } catch (final StreamsException expected) { assertTrue(expected.getCause() instanceof TimeoutException); assertTrue(expected.getMessage().endsWith(topic1TimeoutHint)); } }</code><technical_language>generic -> MockProducer<byte[], byte[]></technical_language>

Target:
public void shouldThrowStreamsExceptionWithTimeoutHintOnProducerTimeoutWithDefaultExceptionHandler() { final RecordCollector collector = new RecordCollectorImpl( "test", logContext, new DefaultProductionExceptionHandler(), new Metrics().sensor("skipped-records")); collector.init(new MockProducer<byte[], byte[]>(cluster, true, new DefaultPartitioner(), byteArraySerializer, byteArraySerializer) { @Override public synchronized Future<RecordMetadata> send(final ProducerRecord record, final Callback callback) { callback.onCompletion(null, new TimeoutException()); return null; } }); collector.send("topic1", "3", "0", null, null, stringSerializer, stringSerializer, streamPartitioner); final StreamsException expected = assertThrows(StreamsException.class, () -> collector.flush()); assertTrue(expected.getCause() instanceof TimeoutException); assertTrue(expected.getMessage().endsWith(topic1TimeoutHint)); }
Source:
<code>public void onMessageReceived(RemoteMessage remoteMessage) { IEdxEnvironment environment = MainApplication.getEnvironment(this); if(!environment.getConfig().areNotificationsEnabled()){ return; } super.onMessageReceived(remoteMessage); if (remoteMessage.getNotification() != null) { Log.d(this.getClass().getSimpleName(), "Message Notification Body: " + remoteMessage.getNotification().getBody()); } NotificationCompat.Builder builder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_notification) .setContentTitle(remoteMessage.getNotification().getTitle()) .setContentText(remoteMessage.getNotification().getBody()); <START> Intent resultIntent = new Intent(this, MainDashboardActivity.class); <END> TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(MainDashboardActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( 0, PendingIntent.FLAG_UPDATE_CURRENT ); builder.setContentIntent(resultPendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); try { notificationManager.notify(99, builder.build()); } catch (NullPointerException ex) { Log.e(this.getClass().getSimpleName(), ex.getMessage()); } }</code><technical_language>I concern it, is right activity launch for logged out users</technical_language>

Target:
public void onMessageReceived(RemoteMessage remoteMessage) { final IEdxEnvironment environment = MainApplication.getEnvironment(this); if (!environment.getConfig().areFirebasePushNotificationsEnabled()) { return; } if (remoteMessage.getNotification() != null) { logger.debug( "Message Notification Body: " + remoteMessage.getNotification().getBody() ); } sendNotification( remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody() ); }
Source:
<code>private boolean hasRemoteSiteName(Metacard metacard) { Optional<String> sourceId = Optional.ofNullable(metacard.getSourceId()); if (sourceId.isPresent()) { <START> String sourceIdLowerCase = sourceId.get(); <END> return !sourceIdLowerCase.equalsIgnoreCase(getLocalSiteName()); } else { LOGGER.debug( "Unable to determine if the source id in metacard matches the local site name because the " + " metacard did not contain a source id attribute.", metacard.getId()); return false; } }</code><technical_language>this variable's name is wrong...I'd suggest inlining sourceId.get() instead of bothering interim variable</technical_language>

Target:
private boolean hasRemoteSiteName(Metacard metacard) { Optional<String> sourceId = Optional.ofNullable(metacard.getSourceId()); if (sourceId.isPresent()) { return !sourceId.get().equalsIgnoreCase(getLocalSiteName()); } else { LOGGER.debug( "Unable to determine if the source id in metacard matches the local site name because the " + " metacard did not contain a source id attribute.", metacard.getId()); return false; } }
Source:
<code>private void updateContent() { final TextPosition currentCursor = getCursorPosition(); this.documentStorage.getDocument(document.getFile(), new DocumentCallback() { @Override public void onDocumentReceived(final String content) { editorWidget.setValue(content, new ContentInitializedHandler() { @Override public void onContentInitialized() { document.setCursorPosition(currentCursor); <START> generalEventBus.fireEvent(new FileContentUpdatedEvent(document.getFile())); <END> } }); } @Override public void onDocumentLoadFailure(final Throwable caught) { displayErrorPanel(constant.editorFileErrorMessage()); } }); }</code><technical_language>do need this operation</technical_language>

Target:
private void updateContent() { final TextPosition currentCursor = getCursorPosition(); this.documentStorage.getDocument(document.getFile(), new DocumentCallback() { @Override public void onDocumentReceived(final String content) { editorWidget.setValue(content, new ContentInitializedHandler() { @Override public void onContentInitialized() { document.setCursorPosition(currentCursor); } }); } @Override public void onDocumentLoadFailure(final Throwable caught) { displayErrorPanel(constant.editorFileErrorMessage()); } }); }
Source:
<code>public boolean isRunning() { try { <START> return MongoDBClientSupport.forServer((AbstractMongoDBServer) entity).getServerStatus().get("ok").equals(1.0); <END> } catch (Exception e) { return false; } }</code><technical_language>Feels strange/wrong for isRunning driver call out entity.getServerStatus(). pid file approach work? feel driver sticks "simple" way, entity define a function feed for serviceUp getServerStatus</technical_language>

Target:
public boolean isRunning() { try { return MongoDBClientSupport.forServer((AbstractMongoDBServer) entity).ping(); } catch (Exception e) { Exceptions.propagateIfFatal(e); return false; } }
Source:
<code>public void shouldInstallPageModel() throws Exception { String componentCode = "de_test_page_model"; String componentAssociatedLabel = "DE_TEST_LABEL"; try { installAndCheckForCompletion(componentCode); assertThat(pageModelService.getPageModel(componentCode)).isNotNull(); assertThat(i18nManager.getLabel("DE_TEST_LABEL", "en")).isEqualTo("Test label DE"); assertThat(storageManager.exists("components/de_test_page_model/test.css", false)).isTrue(); } finally { <START> if (pageModelService.getPageModel(componentCode) != null) { <END> pageModelService.removePageModel(componentCode); } if (labelService.getLabelGroup(componentAssociatedLabel) != null) { labelService.removeLabelGroup(componentAssociatedLabel); } } }</code><technical_language>for other service, this return null, instead throw a RestRourceNotFoundException</technical_language>

Target:
public void shouldInstallPageModel() throws Exception { String componentCode = "de_test_page_model"; String componentAssociatedLabel = "DE_TEST_LABEL"; try { installAndCheckForCompletion(componentCode); assertThat(pageModelService.getPageModel(componentCode)).isNotNull(); assertThat(i18nManager.getLabel("DE_TEST_LABEL", "en")).isEqualTo("Test label DE"); assertThat(storageManager.exists("components/de_test_page_model/test.css", false)).isTrue(); } finally { try { pageModelService.removePageModel(componentCode); } catch (ValidationGenericException ignored) try { labelService.removeLabelGroup(componentAssociatedLabel); } catch (ValidationGenericException ignored) } }
Source:
<code>protected void loadCategories(final Contentlet con, final Map<String,String> m) throws DotDataException, DotSecurityException { ContentType type = APILocator.getContentTypeAPI(APILocator.systemUser()).find(con.getContentTypeId()); <START> List<com.dotcms.contenttype.model.field.Field> catFields = type.fields().stream().filter(field -> field instanceof CategoryField).collect(Collectors.toList()); <END> if(catFields.size()==0) return; List<Category> myCats = APILocator.getCategoryAPI().getParents(con, APILocator.systemUser(), false); StringWriter myCatsString=new StringWriter(); for(Category me : myCats){ myCatsString.append(me.getCategoryVelocityVarName()).append(" "); } m.put(ESMappingConstants.CATEGORIES, myCatsString.toString()); for(com.dotcms.contenttype.model.field.Field f : catFields){ m.put(type.variable() + "." + f.variable(), myCatsString.toString()); } }</code><technical_language>CollectionUtils immutable list</technical_language>

Target:
protected void loadCategories(final Contentlet con, final Map<String,String> m) throws DotDataException, DotSecurityException { final ContentType type = APILocator.getContentTypeAPI(APILocator.systemUser()).find(con.getContentTypeId()); List<com.dotcms.contenttype.model.field.Field> catFields = type.fields().stream() .filter(field -> field instanceof CategoryField).collect(CollectionsUtils.toImmutableList()); if(catFields.isEmpty()) { return; } List<Category> myCats = APILocator.getCategoryAPI().getParents(con, APILocator.systemUser(), false); final StringWriter myCatsString=new StringWriter(); for(final Category me : myCats){ myCatsString.append(me.getCategoryVelocityVarName()).append(" "); } m.put(ESMappingConstants.CATEGORIES, myCatsString.toString()); for(final com.dotcms.contenttype.model.field.Field f : catFields){ m.put(type.variable() + "." + f.variable(), myCatsString.toString()); } }
Source:
<code>protected boolean validate() { if (!canRunActionOnNonManagedVm()) { return false; } if (!isInternalExecution() && !ObjectIdentityChecker.canUpdateField(getVm(), "clusterId", getVm().getStatus())) { addValidationMessage(EngineMessage.VM_STATUS_NOT_VALID_FOR_UPDATE); return false; } <START> ChangeVmClusterValidator validator = Injector.injectMembers(new ChangeVmClusterValidator(this, <END> getParameters().getClusterId(), getParameters().getVmCustomCompatibilityVersion(), getVmDeviceUtils())); return validator.validate(); }</code><technical_language>I doubt is a good approach require user of ChangeVmClusterValidator inject dependencies manually. happen if forget do this? I think, provide some static createInstance() method in ChangeVmClusterValidator, do this. regular ChangeVmClusterValidator() constructor private</technical_language>

Target:
protected boolean validate() { if (!canRunActionOnNonManagedVm()) { return false; } if (!isInternalExecution() && !ObjectIdentityChecker.canUpdateField(getVm(), "clusterId", getVm().getStatus())) { addValidationMessage(EngineMessage.VM_STATUS_NOT_VALID_FOR_UPDATE); return false; } ChangeVmClusterValidator validator = ChangeVmClusterValidator.create(this, getParameters().getClusterId(), getParameters().getVmCustomCompatibilityVersion()); return validator.validate(); }
Source:
<code>public void shouldBeAbleToStartUpIfCassandraIsDownAndRunTransactionsWhenCassandraIsUp() throws IOException, InterruptedException { EteSetup.runCliCommand("service/bin/init.sh stop"); runOnCassandraNodes(MultiCassandraTestSuite::killCassandraContainer); <START> EteSetup.runCliCommand("service/bin/init.sh start"); <END> if (cassandraNodesToStartOrStop.size() > 1) { assertThatThrownBy(this::addATodo) .isInstanceOf(RuntimeException.class) .hasMessageStartingWith("Error 500. Reason: Internal Server Error.") .hasNoCause(); } else { addATodo(); } runOnCassandraNodes(MultiCassandraTestSuite::startCassandraContainer); addATodo(); }</code><technical_language>i unfamiliar testing setup, i init.sh is reading this. consider refactoring a method name describes command does</technical_language>

Target:
public void shouldBeAbleToStartUpIfCassandraIsDownAndRunTransactionsWhenCassandraIsUp() throws IOException, InterruptedException { Assert.assertTrue(canAddTodo()); stopTheAtlasServer(); runOnCassandraNodes(MultiCassandraTestSuite::killCassandraContainer); startTheAtlasServer(); waitUntil(this::serverStarted); runOnCassandraNodes(MultiCassandraTestSuite::startCassandraContainer); waitUntil(this::canAddTodo); Assert.assertTrue(canAddTodo()); }
Source:
<code>public void addListener(LockListener listener) { if (notifier.isDone()) { <START> listener.onEvent(notifier.join()); <END> } else { notifier.thenAccept(listener::onEvent); } }</code><technical_language>Unsafe IMO, join() throw exception, method name suggest exception thrown</technical_language>

Target:
public void addListener(LockListener listener) { if (notifier.isDone() && !notifier.isCompletedExceptionally()) { listener.onEvent(notifier.join()); } else { notifier.thenAccept(listener::onEvent); } }
Source:
<code>protected String getPDFConversionURL(Blob blob) { BlobManager blobManager = Framework.getService(BlobManager.class); try { <START> URI uri = blobManager.getAvailableConversions(blob, UsageHint.DOWNLOAD).get(MimetypeRegistry.PDF_MIMETYPE); <END> if (uri != null) { return uri.toString(); } } catch (IOException e) { log.error("Failed to retrieve available conversions", e); } return null; }</code><technical_language>import static org.nuxeo.ecm.platform.mimetype.interfaces.MimetypeRegistry.PDF_MIMETYPE for this type of constant</technical_language>

Target:
protected String getPDFConversionURL(Blob blob) { BlobManager blobManager = Framework.getService(BlobManager.class); try { URI uri = blobManager.getAvailableConversions(blob, UsageHint.DOWNLOAD).get(PDF_MIMETYPE); if (uri != null) { return uri.toString(); } } catch (IOException e) { log.error("Failed to retrieve available conversions", e); } return null; }
Source:
<code>public static void close(InputStream response) { <START> try { <END> if(response != null) { response.close(); } } catch (Exception e) { } }</code><technical_language>IOUtils imported IOUtils.closeQuietly()</technical_language>

Target:
public static void close(InputStream response) { IOUtils.closeQuietly(response); }
Source:
<code>public void setSize(int width, int height) { super.setSize(width, height); validate(); if (isDisplayable()) { scrollView(); <START> loadBackgroundImage(); <END> } }</code><technical_language>Loading background image time map size changes e.g. unfold operation sensible, it</technical_language>

Target:
public void setSize(int width, int height) { super.setSize(width, height); validate(); if (isDisplayable()) { scrollView(); } }
Source:
<code><START> public SurveyAnsweredRatio getSurveyAnsweredRatio() { <END> if(mSurveyAnsweredRatio==null){ mSurveyAnsweredRatio = SurveyAnsweredRatio.getModelToEntity(SurveyAnsweredRatioDB.getSurveyAnsweredRatioBySurveyId(id)); } return mSurveyAnsweredRatio; }</code><technical_language>get SurveyAnsweredRatio survey model GetSurveyAnsweredRatioUseCase</technical_language>

Target:
public SurveyAnsweredRatio getSurveyAnsweredRatio() { return mSurveyAnsweredRatio; }
Source:
<code>public void addAndTrimUptoMaxSize(ComplexEventChunk<StreamEvent> addingEventChunk) { ComplexEventChunk<StreamEvent> addingEventChunkForCache = new ComplexEventChunk<>(true); addingEventChunk.reset(); while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); addingEventChunkForCache.add((StreamEvent) generateEventWithRequiredFields(event, siddhiAppContext, cacheExpiryEnabled)); } readWriteLock.writeLock().lock(); try { super.add(addingEventChunkForCache); while (this.size() > maxSize) { <START> this.deleteOneEntryUsingCachePolicy(); <END> } } finally { readWriteLock.writeLock().unlock(); } }</code><technical_language>Is worth improving this this.deleteEntriesUsingCachePolicy(this.size() - maxSize)</technical_language>

Target:
public void addAndTrimUptoMaxSize(ComplexEventChunk<StreamEvent> addingEventChunk) { ComplexEventChunk<StreamEvent> addingEventChunkForCache = new ComplexEventChunk<>(true); addingEventChunk.reset(); while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); addingEventChunkForCache.add((StreamEvent) generateEventWithRequiredFields(event, siddhiAppContext, cacheExpiryEnabled)); } readWriteLock.writeLock().lock(); try { super.add(addingEventChunkForCache); if (this.size() > maxSize) { this.deleteEntriesUsingCachePolicy(this.size() - maxSize); } } finally { readWriteLock.writeLock().unlock(); } }
Source:
<code>private Optional<CheckpointTriggerRequest> chooseRequestToExecute(boolean isTriggering, long lastCompletionMs) { Preconditions.checkState(Thread.holdsLock(lock)); if (isTriggering || queuedRequests.isEmpty()) { return Optional.empty(); } if (pendingCheckpointsSizeSupplier.get() >= maxConcurrentCheckpointAttempts) { return Optional.of(queuedRequests.first()) .filter(CheckpointTriggerRequest::isForce) .map(unused -> queuedRequests.pollFirst()); } <START> CheckpointTriggerRequest first = queuedRequests.first(); <END> if (first.isForce() || !first.isPeriodic) { return Optional.of(queuedRequests.pollFirst()); } long nextTriggerDelayMillis = nextTriggerDelayMillis(lastCompletionMs); if (nextTriggerDelayMillis > 0) { return onTooEarly(nextTriggerDelayMillis); } return Optional.of(queuedRequests.pollFirst()); }</code><technical_language>reuse in onTooEarly function</technical_language>

Target:
private Optional<CheckpointTriggerRequest> chooseRequestToExecute(boolean isTriggering, long lastCompletionMs) { Preconditions.checkState(Thread.holdsLock(lock)); if (isTriggering || queuedRequests.isEmpty()) { return Optional.empty(); } if (pendingCheckpointsSizeSupplier.get() >= maxConcurrentCheckpointAttempts) { return Optional.of(queuedRequests.first()) .filter(CheckpointTriggerRequest::isForce) .map(unused -> queuedRequests.pollFirst()); } CheckpointTriggerRequest first = queuedRequests.first(); if (!first.isForce() && first.isPeriodic) { long nextTriggerDelayMillis = nextTriggerDelayMillis(lastCompletionMs); if (nextTriggerDelayMillis > 0) { queuedRequests.pollFirst().completeExceptionally(new CheckpointException(MINIMUM_TIME_BETWEEN_CHECKPOINTS)); rescheduleTrigger.accept(nextTriggerDelayMillis); return Optional.empty(); } } return Optional.of(queuedRequests.pollFirst()); }
Source:
<code>protected void endTransaction(final TransactionManager tm, final Transaction tx) { try { if (tx != tm.getTransaction()) { throw EjbLogger.ROOT_LOGGER.wrongTxOnThread(tx, tm.getTransaction()); } final int txStatus = tx.getStatus(); <START> if (txStatus == Status.STATUS_ACTIVE || txStatus == Status.STATUS_PREPARED || txStatus == Status.STATUS_PREPARING || txStatus == Status.STATUS_COMMITTING || txStatus == Status.STATUS_COMMITTED) { <END> tm.commit(); } else if (txStatus == Status.STATUS_MARKED_ROLLBACK) { tm.rollback(); } else if (txStatus == Status.STATUS_ROLLEDBACK || txStatus == Status.STATUS_ROLLING_BACK) { tm.rollback(); throw EjbLogger.ROOT_LOGGER.transactionAlreadyRolledBack(tx); } else if (txStatus == Status.STATUS_UNKNOWN) { tm.rollback(); throw EjbLogger.ROOT_LOGGER.transactionInUnexpectedState(tx, statusAsString(txStatus)); } else { tm.suspend(); throw EjbLogger.ROOT_LOGGER.transactionInUnexpectedState(tx, statusAsString(txStatus)); } } catch (RollbackException e) { handleEndTransactionException(e); } catch (HeuristicMixedException e) { handleEndTransactionException(e); } catch (HeuristicRollbackException e) { handleEndTransactionException(e); } catch (SystemException e) { handleEndTransactionException(e); } }</code><technical_language>Prior WFLY-1346, call tm.commit() for MARKED_ROLLBACK, a lot of experience handling PREPARED/PREPARING/COMMITTING/COMMITTED changed to</technical_language>

Target:
protected void endTransaction(final TransactionManager tm, final Transaction tx) { try { if (tx != tm.getTransaction()) { throw EjbLogger.ROOT_LOGGER.wrongTxOnThread(tx, tm.getTransaction()); } final int txStatus = tx.getStatus(); if (txStatus == Status.STATUS_ACTIVE) { tm.commit(); } else if (txStatus == Status.STATUS_MARKED_ROLLBACK) { tm.rollback(); } else if (txStatus == Status.STATUS_ROLLEDBACK || txStatus == Status.STATUS_ROLLING_BACK) { tm.rollback(); throw EjbLogger.ROOT_LOGGER.transactionAlreadyRolledBack(tx); } else if (txStatus == Status.STATUS_UNKNOWN) { tm.rollback(); throw EjbLogger.ROOT_LOGGER.transactionInUnexpectedState(tx, statusAsString(txStatus)); } else { tm.suspend(); throw EjbLogger.ROOT_LOGGER.transactionInUnexpectedState(tx, statusAsString(txStatus)); } } catch (RollbackException e) { handleEndTransactionException(e); } catch (HeuristicMixedException e) { handleEndTransactionException(e); } catch (HeuristicRollbackException e) { handleEndTransactionException(e); } catch (SystemException e) { handleEndTransactionException(e); } }
Source:
<code>private void checkPermission(ComponentDto project) { <START> userSession.hasComponentPermission(UserRole.ADMIN, project); <END> }</code><technical_language>Unit test is missing permission, this method do check, returns a boolean</technical_language>

Target:
private void checkPermission(ComponentDto project) { userSession.checkComponentPermission(UserRole.ADMIN, project); }
Source:
<code>StreamSpec getStreamSpec() { StreamSpec spec = (partitions == PARTITIONS_UNKNOWN) ? streamSpec : streamSpec.copyWithPartitionCount(partitions); if (isIntermediate) { ApplicationConfig appConfig = new ApplicationConfig(config); if (appConfig.getAppMode() == ApplicationConfig.ApplicationMode.BATCH && appConfig.getRunId() != null) { <START> spec = spec.copyWithPhysicalName(spec.getPhysicalName() + "-" + appConfig.getRunId()); <END> } } return spec; }</code><technical_language>This logic is similar logic added JavaStreamConfig. Is put in a central place? if I this idea, a BatchStreamSpec class extends StreamSpec (like KafkaStreamSpec does) provides some static methods. Thoughts</technical_language>

Target:
StreamSpec getStreamSpec() { StreamSpec spec = (partitions == PARTITIONS_UNKNOWN) ? streamSpec : streamSpec.copyWithPartitionCount(partitions); if (isIntermediate) { String physicalName = StreamManager.createUniqueNameForBatch(spec.getPhysicalName(), config); if (!physicalName.equals(spec.getPhysicalName())) { spec = spec.copyWithPhysicalName(physicalName); } } return spec; }
Source:
<code>public boolean readMsg() throws Exception { int bytesAvailable = serial.available(); if (bytesAvailable > 0) { for (int i = 0; i < bytesAvailable; i++) { int newByte = serial.read(); ++byteCount; if (byteCount == 1 && newByte != VirtualMsg.MAGIC_NUMBER) { publishError(F("error serial")); byteCount = 0; } if (byteCount == 2) { if (newByte > 64) { byteCount = 0; <START> System.out.println("TO BIG"); <END> continue; } msgSize = newByte; } if (byteCount > 2) { ioCmd[byteCount - 3] = newByte; } if (byteCount == 2 + msgSize) { System.out.println("GOT " + msgSize + " BYTES"); byteCount = 0; return true; } } } return false; }</code><technical_language>avoid system.out.printlns.... log.debug/info ... (System.out.println is good for debugging locally)</technical_language>

Target:
public boolean readMsg() throws Exception { int bytesAvailable = serial.available(); if (bytesAvailable > 0) { for (int i = 0; i < bytesAvailable; i++) { int newByte = serial.read(); ++byteCount; if (byteCount == 1 && newByte != VirtualMsg.MAGIC_NUMBER) { publishError(F("error serial")); byteCount = 0; } if (byteCount == 2) { if (newByte > 64) { byteCount = 0; continue; } msgSize = newByte; } if (byteCount > 2) { ioCmd[byteCount - 3] = newByte; } if (byteCount == 2 + msgSize) { System.out.println("GOT " + msgSize + " BYTES"); byteCount = 0; return true; } } } return false; }
Source:
<code>public RecordMaterializer<T> prepareForRead( Configuration configuration, Map<String, String> keyValueMetaData, MessageType fileSchema, ReadContext readContext) { Map<String, String> metadata = readContext.getReadSupportMetadata(); MessageType parquetSchema = readContext.getRequestedSchema(); Schema avroSchema; <START> if (readContext.getReadSupportMetadata().get(AVRO_READ_SCHEMA_METADATA_KEY) != null) { <END> avroSchema = new Schema.Parser().parse(metadata.get(AVRO_READ_SCHEMA_METADATA_KEY)); } else if (keyValueMetaData.get(AVRO_SCHEMA_METADATA_KEY) != null) { avroSchema = new Schema.Parser().parse(keyValueMetaData.get(AVRO_SCHEMA_METADATA_KEY)); } else if (keyValueMetaData.get(OLD_AVRO_SCHEMA_METADATA_KEY) != null) { avroSchema = new Schema.Parser().parse(keyValueMetaData.get(OLD_AVRO_SCHEMA_METADATA_KEY)); } else { avroSchema = new AvroSchemaConverter(configuration).convert(parquetSchema); } GenericData model = getDataModel(configuration); String compatEnabled = metadata.get(AvroReadSupport.AVRO_COMPATIBILITY); if (compatEnabled != null && Boolean.valueOf(compatEnabled)) { return newCompatMaterializer(parquetSchema, avroSchema, model); } return new AvroRecordMaterializer<T>(parquetSchema, avroSchema, model); }</code><technical_language>readContext.getReadSupportMetadata() replaced metadata</technical_language>

Target:
public RecordMaterializer<T> prepareForRead( Configuration configuration, Map<String, String> keyValueMetaData, MessageType fileSchema, ReadContext readContext) { Map<String, String> metadata = readContext.getReadSupportMetadata(); MessageType parquetSchema = readContext.getRequestedSchema(); Schema avroSchema; if (metadata.get(AVRO_READ_SCHEMA_METADATA_KEY) != null) { avroSchema = new Schema.Parser().parse(metadata.get(AVRO_READ_SCHEMA_METADATA_KEY)); } else if (keyValueMetaData.get(AVRO_SCHEMA_METADATA_KEY) != null) { avroSchema = new Schema.Parser().parse(keyValueMetaData.get(AVRO_SCHEMA_METADATA_KEY)); } else if (keyValueMetaData.get(OLD_AVRO_SCHEMA_METADATA_KEY) != null) { avroSchema = new Schema.Parser().parse(keyValueMetaData.get(OLD_AVRO_SCHEMA_METADATA_KEY)); } else { avroSchema = new AvroSchemaConverter(configuration).convert(parquetSchema); } GenericData model = getDataModel(configuration); String compatEnabled = metadata.get(AvroReadSupport.AVRO_COMPATIBILITY); if (compatEnabled != null && Boolean.valueOf(compatEnabled)) { return newCompatMaterializer(parquetSchema, avroSchema, model); } return new AvroRecordMaterializer<T>(parquetSchema, avroSchema, model); }
Source:
<code>public boolean getJmxEnabledOnJobCoordinator() { if (containsKey(CLUSTER_MANAGER_JMX_ENABLED)) { <START> log.info("Configuration is deprecated. Please use {}", CLUSTER_MANAGER_JMX_ENABLED, JOB_JMX_ENABLED); <END> return getBoolean(CLUSTER_MANAGER_JMX_ENABLED); } else if (containsKey(AM_JMX_ENABLED)) { log.info("Configuration is deprecated. Please use {}", AM_JMX_ENABLED, JOB_JMX_ENABLED); return getBoolean(AM_JMX_ENABLED); } else if (containsKey(JOB_JMX_ENABLED)) { return getBoolean(JOB_JMX_ENABLED); } else { return true; } }</code><technical_language>This message logged warn log-level</technical_language>

Target:
public boolean getJmxEnabledOnJobCoordinator() { if (containsKey(CLUSTER_MANAGER_JMX_ENABLED)) { log.warn("Configuration is deprecated. Please use {}", CLUSTER_MANAGER_JMX_ENABLED, JOB_JMX_ENABLED); return getBoolean(CLUSTER_MANAGER_JMX_ENABLED); } else if (containsKey(AM_JMX_ENABLED)) { log.warn("Configuration is deprecated. Please use {}", AM_JMX_ENABLED, JOB_JMX_ENABLED); return getBoolean(AM_JMX_ENABLED); } else if (containsKey(JOB_JMX_ENABLED)) { return getBoolean(JOB_JMX_ENABLED); } else { return true; } }
Source:
<code>public boolean handleExtraButtonPressed(int buttonId) { if (buttonId == QueryWizardDialog.REFRESH_BUTTON_ID) { if (getTaskRepository() != null) { refreshConfiguration(true); } else { MessageDialog.openInformation( Display.getCurrent().getActiveShell(), Messages.AbstractRepositoryQueryPage2_Update_Attributes_Failed, Messages.AbstractRepositoryQueryPage2_No_repository_available_please_add_one_using_the_Task_Repositories_view); } return true; } else if (buttonId == QueryWizardDialog.CLEAR_BUTTON_ID) { <START> if (!innerComposite.isDisposed()) { <END> doClearControls(); return false; } return true; } return false; }</code><technical_language>Is button is disposed</technical_language>

Target:
public boolean handleExtraButtonPressed(int buttonId) { if (buttonId == QueryWizardDialog.REFRESH_BUTTON_ID) { if (getTaskRepository() != null) { refreshConfiguration(true); } else { MessageDialog.openInformation( Display.getCurrent().getActiveShell(), Messages.AbstractRepositoryQueryPage2_Update_Attributes_Failed, Messages.AbstractRepositoryQueryPage2_No_repository_available_please_add_one_using_the_Task_Repositories_view); } return true; } else if (buttonId == QueryWizardDialog.CLEAR_BUTTON_ID) { doClearControls(); return true; } return false; }
Source:
<code>public static void entriesMapCleanUp() { Timer cleanUpTimer = new Timer(); cleanUpTimer.schedule(new TimerTask() { @Override public void run() { CleanUp(); } }, Constants.KALTURA_ENTRY_PERSISTENCE_CLEANUP_START); <START> logger.info("Persistence hash map cleanup will start in " + Constants.KALTURA_ENTRY_PERSISTENCE_CLEANUP_START / 1000 + " seconds"); <END> }</code><technical_language>pls change log level debug</technical_language>

Target:
public static void entriesMapCleanUp() { synchronized (_cleanUpLock) { long currentTime = System.currentTimeMillis(); if (currentTime - _lastMapCleanUp > Constants.KALTURA_TIME_BETWEEN_PERSISTENCE_CLEANUP) { _lastMapCleanUp = currentTime; Timer cleanUpTimer = new Timer(); cleanUpTimer.schedule(new TimerTask() { @Override public void run() { CleanUp(); } }, Constants.KALTURA_ENTRY_PERSISTENCE_CLEANUP_START); logger.debug("Persistence hash map cleanup will start in " + Constants.KALTURA_ENTRY_PERSISTENCE_CLEANUP_START / 1000 + " seconds"); } else { logger.debug("Persistence cleanup was called less than " + Constants.KALTURA_TIME_BETWEEN_PERSISTENCE_CLEANUP / 1000 + " seconds ago. Ignoring call!"); } } }