auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Notification createNotification(Intent inboundIntent) { final NotificationData data = readInboundIntent(inboundIntent); if (null == data) { return null; } MPLog.d(LOGTAG, "MP FCM notification received: " + data.message); final PendingIntent contentIntent = PendingIntent.getActivity( context, 0, data.intent, PendingIntent.FLAG_UPDATE_CURRENT ); builder. setDefaults(MPConfig.getInstance(context).getNotificationDefaults()). setWhen(now). setContentTitle(data.title). setContentText(data.message). setTicker(data.ticker == null ? data.message : data.ticker). setContentIntent(contentIntent); maybeSetSubTitle(data); maybeSetNotificationBarIcon(data); maybeSetLargeIcon(data); maybeSetExpandableNotification(data); maybeSetCustomIconColor(data); maybeAddActionButtons(data); maybeSetChannel(data); maybeSetNotificationBadge(data); maybeSetTag(data); maybeSetGroupKey(data, contentIntent); maybeSetTime(data); maybeSetVisibility(data); final Notification n = buildNotification(); if (!data.sticky) { n.flags |= Notification.FLAG_AUTO_CANCEL; } return n; }

Target:
public Notification createNotification(Intent inboundIntent) { final NotificationData data = readInboundIntent(inboundIntent); if (null == data) { return null; } else { this.data = data; } MPLog.d(LOGTAG, "MP FCM notification received: " + data.message); final PendingIntent contentIntent = PendingIntent.getActivity( context, 0, data.intent, PendingIntent.FLAG_UPDATE_CURRENT ); builder. setDefaults(MPConfig.getInstance(context).getNotificationDefaults()). setWhen(now). setContentTitle(data.title). setContentText(data.message). setTicker(data.ticker == null ? data.message : data.ticker). setContentIntent(contentIntent); maybeSetSubTitle(); maybeSetNotificationBarIcon(); maybeSetLargeIcon(); maybeSetExpandableNotification(); maybeSetCustomIconColor(); maybeAddActionButtons(); maybeSetChannel(); maybeSetNotificationBadge(); maybeSetGroupKey(contentIntent); maybeSetTime(); maybeSetVisibility(); final Notification n = buildNotification(); if (!data.sticky) { n.flags |= Notification.FLAG_AUTO_CANCEL; } return n; }
Source:
public void switchTab(TabListItem tabItem) { boolean found = false; for (int i = 0; i < navTabs.getWidgetCount(); i++) { TabListItem tabListItem = (TabListItem) navTabs.getWidget(i); if (tabItem.getText().equals(tabListItem.getText())) { tabListItem.showTab(); TabPane tabPane = (TabPane) tabContent.getWidget(i); tabContent.remove(tabPane); tabContent.insert(tabPane, i); ((FlowPanel) tabPane.getWidget(0)).insert(tabHeaderContainer, 0); tabPane.getWidget(0).setHeight(height); tabPane.setActive(true); activeTab = (TabListItem) navTabs.getWidget(i); found = true; } else { TabPane tabPane = (TabPane) tabContent.getWidget(i); ((FlowPanel) tabPane.getWidget(0)).remove(tabHeaderContainer); tabPane.setActive(false); } } if (!found && navTabs.getWidgetCount() > 0) { ((TabListItem) navTabs.getWidget(0)).showTab(); TabPane tabPane = (TabPane) tabContent.getWidget(0); ((FlowPanel) tabPane.getWidget(0)).insert(tabHeaderContainer, 0); tabPane.setActive(true); } }

Target:
public void switchTab(TabListItem tabItem) { boolean found = false; for (int i = 0; i < navTabs.getWidgetCount(); i++) { TabListItem currentTabItem = (TabListItem) navTabs.getWidget(i); if (tabItem.getText().equals(currentTabItem.getText())) { currentTabItem.showTab(); TabPane tabPane = (TabPane) tabContent.getWidget(i); tabContent.remove(tabPane); tabContent.insert(tabPane, i); ((FlowPanel) tabPane.getWidget(0)).insert(tabHeaderContainer, 0); tabPane.getWidget(0).setHeight(height); tabPane.setActive(true); activeTab = (TabListItem) navTabs.getWidget(i); found = true; } else { TabPane tabPane = (TabPane) tabContent.getWidget(i); ((FlowPanel) tabPane.getWidget(0)).remove(tabHeaderContainer); tabPane.setActive(false); } } if (!found && navTabs.getWidgetCount() > 0) { ((TabListItem) navTabs.getWidget(0)).showTab(); TabPane tabPane = (TabPane) tabContent.getWidget(0); ((FlowPanel) tabPane.getWidget(0)).insert(tabHeaderContainer, 0); tabPane.setActive(true); } }
Source:
public void testSaltedVarbinaryUpperBoundQuery() throws Exception { String tableName = generateUniqueName(); String ddl = "CREATE TABLE " + tableName + " ( k VARBINARY PRIMARY KEY, a INTEGER ) SALT_BUCKETS = 3"; String dml = "UPSERT INTO " + tableName + " values (?, ?)"; String sql2 = "SELECT * FROM " + tableName + " WHERE k = ?"; try (Connection conn = DriverManager.getConnection(getUrl())) { conn.createStatement().execute(ddl); PreparedStatement stmt = conn.prepareStatement(dml); stmt.setInt(2, 1); stmt.setBytes(1, new byte[] { 5 }); stmt.executeUpdate(); stmt.setBytes(1, new byte[] { 5, 0 }); stmt.executeUpdate(); stmt.setBytes(1, new byte[] { 5, 1 }); stmt.executeUpdate(); conn.commit(); stmt = conn.prepareStatement(sql2); stmt.setBytes(1, new byte[] { 5 }); ResultSet rs = stmt.executeQuery(); assertTrue(rs.next()); assertArrayEquals(new byte[] {5},rs.getBytes(1)); assertEquals(1,rs.getInt(2)); assertFalse(rs.next()); } }

Target:
public void testSaltedVarbinaryUpperBoundQuery() throws Exception { String tableName = generateUniqueName(); String ddl = "CREATE TABLE " + tableName + " ( k VARBINARY PRIMARY KEY, a INTEGER ) SALT_BUCKETS = 3"; String dml = "UPSERT INTO " + tableName + " values (?, ?)"; String sql2 = "SELECT * FROM " + tableName + " WHERE k = ?"; try (Connection conn = DriverManager.getConnection(getUrl())) { conn.createStatement().execute(ddl); PreparedStatement stmt = conn.prepareStatement(dml); stmt.setInt(2, 1); stmt.setBytes(1, new byte[] { 5 }); stmt.executeUpdate(); stmt.setBytes(1, new byte[] { 5, 0 }); stmt.executeUpdate(); stmt.setBytes(1, new byte[] { 5, 1 }); stmt.executeUpdate(); stmt.close(); conn.commit(); stmt = conn.prepareStatement(sql2); stmt.setBytes(1, new byte[] { 5 }); ResultSet rs = stmt.executeQuery(); assertTrue(rs.next()); assertArrayEquals(new byte[] {5},rs.getBytes(1)); assertEquals(1,rs.getInt(2)); assertFalse(rs.next()); stmt.close(); } }
Source:
public void append(String cacheKey, LoggingEvent event) { try { isAppending.lock(); appenderCache.computeIfAbsent(cacheKey, this::createAppender); queue.put(new ApplicableEvent(cacheKey, event)); } catch (InterruptedException e) { LOGGER.warn("Queue put is interrupted."); } finally { isAppending.unlock(); } }

Target:
public void append(String cacheKey, LoggingEvent event) { try { isAppending.lock(); appenderCache.computeIfAbsent(cacheKey, this::createAppender); queue.put(new ApplicableEvent(cacheKey, event)); } catch (InterruptedException e) { LOGGER.warn("Interrupted append on " + cacheKey); Thread.currentThread().interrupt(); } finally { isAppending.unlock(); } }
Source:
protected void start(String name, File rootDir, File configurationFile) { if (configuration.isParallelStartup()) { throw new IllegalStateException("Forked mode doesn't support parallel startup"); } String globalServerHome = System.getProperty(TestSystemPropertyNames.INFINISPAN_TEST_SERVER_DIR); if (globalServerHome == null) { throw new IllegalArgumentException("You must specify a " + TestSystemPropertyNames.INFINISPAN_TEST_SERVER_DIR + " property."); } List<Path> serverHomes = new ArrayList<>(); Path src = Paths.get(globalServerHome).normalize(); for (int i = 0; i < configuration.numServers(); i++) { Path dest = Paths.get(CommonsTestingUtil.tmpDirectory(), UUID.randomUUID().toString()); try { Files.createDirectory(dest); Files.walkFileTree(src, new CommonsTestingUtil.CopyFileVisitor(dest, true)); } catch (IOException e) { throw new UncheckedIOException("Cannot copy the server to temp folder", e); } serverHomes.add(dest); } if (serverHomes.size() != configuration.numServers()) { throw new IllegalArgumentException("configuration.numServers should be the same " + "as the number of servers declared on org.infinispan.test.server"); } for (int i = 0; i < configuration.numServers(); i++) { String serverHome = serverHomes.get(i).toString(); ForkedServer server = new ForkedServer(serverHome) .setServerConfiguration(configurationFile.getPath()) .setPortsOffset(i); copyArtifactsToUserLibDir(server.getServerLib()); forkedServers.add(server.start()); forkedServers.get(0).printServerLog(s -> log.info(s)); } }

Target:
protected void start(String name, File rootDir, File configurationFile) { if (configuration.isParallelStartup()) { throw new IllegalStateException("Forked mode doesn't support parallel startup"); } String globalServerHome = configuration.properties().getProperty(TestSystemPropertyNames.INFINISPAN_TEST_SERVER_DIR); if (globalServerHome == null) { throw new IllegalArgumentException("You must specify a " + TestSystemPropertyNames.INFINISPAN_TEST_SERVER_DIR + " property."); } List<Path> serverHomes = new ArrayList<>(); Path src = Paths.get(globalServerHome).normalize(); for (int i = 0; i < configuration.numServers(); i++) { Path dest = Paths.get(CommonsTestingUtil.tmpDirectory(), UUID.randomUUID().toString()); try { Files.createDirectory(dest); Files.walkFileTree(src, new CommonsTestingUtil.CopyFileVisitor(dest, true)); } catch (IOException e) { throw new UncheckedIOException("Cannot copy the server to temp folder", e); } serverHomes.add(dest); } if (serverHomes.size() != configuration.numServers()) { throw new IllegalArgumentException("configuration.numServers should be the same " + "as the number of servers declared on org.infinispan.test.server"); } for (int i = 0; i < configuration.numServers(); i++) { String serverHome = serverHomes.get(i).toString(); ForkedServer server = new ForkedServer(serverHome) .setServerConfiguration(configurationFile.getPath()) .setPortsOffset(i); copyArtifactsToUserLibDir(server.getServerLib()); forkedServers.add(server.start()); forkedServers.get(0).printServerLog(log::info); } }
Source:
private void setSourceMetadata(Model model, Resource primaryResource, File dataFile) { PID sourceMDPID = new PID(primaryResource.getURI() + "/" + MD_SOURCE.getName()); Resource sourceMDResource = model.createResource(sourceMDPID.getURI()); model.add(primaryResource, dprop(model, hasDatastream), sourceMDResource); model.add(primaryResource, cdrprop(model, sourceMetadata), sourceMDResource); model.add(sourceMDResource, dprop(model, stagingLocation), DepositConstants.DATA_DIR + "/" + dataFile.getName()); model.add(primaryResource, cdrprop(model, hasSourceMetadataProfile), "proquest"); model.add(sourceMDResource, dprop(model, mimetype), "text/xml"); }

Target:
private void setSourceMetadata(Model model, Resource primaryResource, File dataFile) { PID sourceMDPID = new PID(primaryResource.getURI() + "/" + MD_SOURCE.getName()); Resource sourceMDResource = model.createResource(sourceMDPID.getURI()); model.add(primaryResource, dprop(model, hasDatastream), sourceMDResource); model.add(primaryResource, cdrprop(model, sourceMetadata), sourceMDResource); model.add(sourceMDResource, dprop(model, stagingLocation), DepositConstants.DATA_DIR + "/" + dataFile.getName()); model.add(primaryResource, cdrprop(model, hasSourceMetadataProfile), PROQUEST_ETD); model.add(sourceMDResource, dprop(model, mimetype), "text/xml"); }
Source:
public TaskDataDiff createDiff(TaskData newTaskData, TaskData oldTaskData, final IProgressMonitor monitor) { final TaskDataDiff diff = new TaskDataDiff(model, newTaskData, oldTaskData); for (final SynchronizationParticipant participant : getDefaultParticipants()) { SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { } public void run() throws Exception { participant.processUpdate(diff, monitor); } }); } for (final SynchronizationParticipant participant : getParticipants(newTaskData.getConnectorKind())) { SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { } public void run() throws Exception { participant.processUpdate(diff, monitor); } }); } diff.setHasChanged(diff.getChangedAttributes().size() > 0 || diff.getNewComments().size() > 0 || diff.getNewAttachments().size() > 0); return diff; }

Target:
public TaskDataDiff createDiff(TaskData newTaskData, TaskData oldTaskData, final IProgressMonitor monitor) { final TaskDataDiff diff = new TaskDataDiff(model, newTaskData, oldTaskData); for (final SynchronizationParticipant participant : getDefaultParticipants()) { SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { } public void run() throws Exception { participant.processUpdate(diff, monitor); } }); } for (final SynchronizationParticipant participant : getParticipants(newTaskData.getConnectorKind())) { SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { } public void run() throws Exception { participant.processUpdate(diff, monitor); } }); } diff.updateHasChanged(); return diff; }
Source:
public void close() { log.debug("Close consumer if exist: %d, partition %d", Thread.currentThread().getId(), split.getPartitionId()); if (this.consumer != null) { this.consumer.close(); } }

Target:
public void close() { if (consumer != null) { consumer.close(); } }
Source:
public void workerBackpressure(String stormId, String node, Long port, long timestamp) { String path = ClusterUtils.backpressurePath(stormId, node, port); boolean existed = stateStorage.node_exists(path, false); if (timestamp <= 0) { return; } byte[] data = ByteBuffer.allocate(Long.BYTES).putLong(timestamp).array(); if (existed) { stateStorage.set_data(path, data, acls); } else { stateStorage.set_ephemeral_node(path, data, acls); } }

Target:
public void workerBackpressure(String stormId, String node, Long port, long timestamp) { if (timestamp <= 0) { return; } String path = ClusterUtils.backpressurePath(stormId, node, port); boolean existed = stateStorage.node_exists(path, false); byte[] data = ByteBuffer.allocate(Long.BYTES).putLong(timestamp).array(); if (existed) { stateStorage.set_data(path, data, acls); } else { stateStorage.set_ephemeral_node(path, data, acls); } }
Source:
public long count() { AtomicInteger counter = new AtomicInteger(0); forEachBatched(batch -> counter.addAndGet(batch.size()), 1000); return counter.get(); }

Target:
public long count() { AtomicInteger counter = new AtomicInteger(0); forEachBatched(batch -> counter.addAndGet(batch.size()), BATCH_SIZE); return counter.get(); }
Source:
public void addEventHandler(EventHandler eventHandler) { if (eventHandler != null) { if (eventHandlers == null) { eventHandlers = Collections.synchronizedList(new LinkedList<EventHandler>()); } boolean handlerExist = false; for (EventHandler handler : eventHandlers) { if (handler.getUID().equals(eventHandler.getUID())) { handlerExist = true; } } if (!handlerExist) { eventHandlers.add(eventHandler); addSubscribeEvents(eventHandler.getSupportetEvents()); logger.debug("eventHandler: added", eventHandler.getUID()); if (isStarted) { internalStart(); } } } }

Target:
public void addEventHandler(EventHandler eventHandler) { if (eventHandler != null) { boolean handlerExist = false; for (EventHandler handler : eventHandlers) { if (handler.getUID().equals(eventHandler.getUID())) { handlerExist = true; } } if (!handlerExist) { eventHandlers.add(eventHandler); addSubscribeEvents(eventHandler.getSupportedEvents()); logger.debug("eventHandler: added", eventHandler.getUID()); if (isStarted) { internalStart(); } } } }
Source:
public static BigInteger factorial(int base) { if (base > 100000) { return null; } BigInteger value = BigInteger.ONE; for (int i = 1; i <= base; i++) { value = value.multiply(BigInteger.valueOf(base)); } return value; }

Target:
public static BigInteger factorial(int base) { if (base > 100000) { return null; } BigInteger value = BigInteger.ONE; for (int i = 1; i <= base; i++) { value = value.multiply(BigInteger.valueOf(i)); } return value; }
Source:
void processForCompatibility()

Target:
void processForCompatibility() { final ObjectAttributes attributes = this.mergeRequestHook.getObjectAttributes(); if (attributes != null) { final Project source = attributes.getSource(); if (source != null && source.getHttpUrl() != null) { if (source.getUrl() == null) { source.setUrl(source.getHttpUrl()); } if (source.getHomepage() == null) { source.setHomepage(source.getHttpUrl().substring(0, source.getHttpUrl().lastIndexOf(".git"))); } } } }
Source:
private void calcSha256ForItem(String repoName, String path) { ObjectMapper mapper = new ObjectMapper(); Map<String, Object> map = null; try { map = mapper.readValue( "{\"repoKey\":\""+ repoName +"\", \"path\":\""+path+"\"}", Map.class ); } catch (IOException e) { e.printStackTrace(); } ArtifactoryRequest request = new ArtifactoryRequestImpl() .apiUrl("api/checksum/sha256") .method(ArtifactoryRequest.Method.POST) .requestType(ArtifactoryRequest.ContentType.JSON) .requestBody(map); artifactory.restCall(request); }

Target:
private void calcSha256ForItem(String repoName, String path) { ObjectMapper mapper = new ObjectMapper(); Map<String, Object> map; try { map = mapper.readValue( "{\"repoKey\":\""+ repoName +"\", \"path\":\""+path+"\"}", Map.class ); } catch (IOException e) { throw new RuntimeException(e); } ArtifactoryRequest request = new ArtifactoryRequestImpl() .apiUrl("api/checksum/sha256") .method(ArtifactoryRequest.Method.POST) .requestType(ArtifactoryRequest.ContentType.JSON) .requestBody(map); artifactory.restCall(request); }
Source:
public boolean matches(String segment, int startIncl, int endExcl, boolean assumeDirectory) { String s = subPattern; int subLength = s.length() - 1; if (subLength == 0) return true; if (subLength > (endExcl - startIncl)) return false; for (int i = subLength, j = 1; i > 0; i--, j++) { char c1 = s.charAt(i); char c2 = segment.charAt(endExcl - j); if (c1 != c2) return false; } return true; }

Target:
public boolean matches(String segment, int startIncl, int endExcl, boolean assumeDirectory) { String s = subPattern; int subLength = s.length() - 1; if (subLength == 0) return true; if (subLength > (endExcl - startIncl)) return false; for (int i = subLength, j = endExcl - 1; i > 0; i--, j--) { char c1 = s.charAt(i); char c2 = segment.charAt(j); if (c1 != c2) return false; } return true; }
Source:
public boolean isLeapDay() { return isLeapYear() && dayOfYear == 169; }

Target:
boolean isLeapDay() { return this.isLeapDay; }
Source:
private void initPreApplicationState() { logger.info(Utility.version(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); prefs = TestController.loadApplicationPreferences(); if(TestController.isBypassLogin()){ prefs.setLastLoginCredentials("test", "test"); } KeyboardShortcuts.loadKeyboardShortcuts(prefs); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); }

Target:
private void initPreApplicationState() { logger.info(Version.getCurrentVersion().toString()); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); prefs = TestController.loadApplicationPreferences(); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); updateManager = TestController.createUpdateManager(); updateManager.run(); }
Source:
public int cleanupCompliances(int minutes) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, -1 * minutes); int batchSize = 256; int count = 0; Session session = this.currentSession(); EntityManager em = this.getEntityManager(); CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery<Compliance> cquery = builder.createQuery(Compliance.class); Root<Compliance> croot = cquery.from(Compliance.class); ParameterExpression<Date> param = builder.parameter(Date.class); cquery.select(croot).where(builder.lessThanOrEqualTo(croot.<Date>get("date"), param)); TypedQuery<Compliance> query = em.createQuery(cquery); query.setParameter(param, cal.getTime()); query.setMaxResults(batchSize); List<Compliance> compliances; do { compliances = (List<Compliance>) query.getResultList(); for (Compliance compliance : compliances) { session.delete(compliance); } em.flush(); count += compliances.size(); } while (compliances.size() == batchSize); return count; }

Target:
public int cleanupCompliances(int minutes) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, -1 * minutes); int batchSize = 256; int count = 0; EntityManager em = this.getEntityManager(); CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery<Compliance> cquery = builder.createQuery(Compliance.class); Root<Compliance> croot = cquery.from(Compliance.class); ParameterExpression<Date> param = builder.parameter(Date.class); cquery.select(croot).where(builder.lessThanOrEqualTo(croot.<Date>get("date"), param)); TypedQuery<Compliance> query = em.createQuery(cquery); query.setHint("javax.persistence.cache.retrieveMode", CacheRetrieveMode.BYPASS); query.setHint("javax.persistence.cache.storeMode", CacheStoreMode.BYPASS); query.setParameter(param, cal.getTime()); query.setMaxResults(batchSize); List<Compliance> compliances; do { compliances = (List<Compliance>) query.getResultList(); for (Compliance compliance : compliances) { em.remove(compliance); } em.flush(); count += compliances.size(); } while (compliances.size() == batchSize); return count; }
Source:
public DimFilter optimize() { if (values.size() == 1) { return new SelectorDimFilter(dimension, values.first(), extractionFn).optimize(); } if (extractionFn instanceof LookupExtractionFn && ((LookupExtractionFn) extractionFn).isOptimize()) { LookupExtractionFn exFn = (LookupExtractionFn) extractionFn; LookupExtractor lookup = exFn.getLookup(); final List<String> keys = new ArrayList<>(); for (String value : values) { final String convertedValue = Strings.emptyToNull(value); if (!exFn.isRetainMissingValue() && Objects.equals(convertedValue, exFn.getReplaceMissingValueWith())) { return this; } keys.addAll(lookup.unapply(convertedValue)); if (exFn.isRetainMissingValue() && lookup.apply(convertedValue) == null) { keys.add(convertedValue); } } if (keys.isEmpty()) { return this; } else { return new InDimFilter(dimension, keys, null).optimize(); } } return this; }

Target:
public DimFilter optimize() { InDimFilter inFilter = optimizeLookup(); if (inFilter.values.size() == 1) { return new SelectorDimFilter(inFilter.dimension, inFilter.values.first(), inFilter.getExtractionFn()); } return inFilter; }
Source:
public DecodedJWT verify(String token) throws JWTVerificationException { DecodedJWT jwt = JWT.decode(token); verifyAlgorithm(jwt, algorithm); algorithm.verify(jwt); verifyClaims(jwt, claims); return jwt; }

Target:
public DecodedJWT verify(String token) throws JWTVerificationException { DecodedJWT jwt = JWT.decode(token); return verify(jwt); }
Source:
public void setup(OperatorContext context) { Preconditions.checkNotNull(managedState); ((FileAccessFSImpl)managedState.getFileAccess()).setBasePath(context.getValue(DAG.APPLICATION_PATH) + Path.SEPARATOR + BUCKET_DIR); managedState.setup(context); if (preserveTupleOrder) { decisions = Maps.newLinkedHashMap(); } }

Target:
public void setup(OperatorContext context) { ((FileAccessFSImpl)managedState.getFileAccess()).setBasePath(context.getValue(DAG.APPLICATION_PATH) + Path.SEPARATOR + BUCKET_DIR); managedState.setup(context); if (preserveTupleOrder) { decisions = Maps.newLinkedHashMap(); } }
Source:
private QueryData checkAndCloneQueryData() throws OseeCoreException { QueryData queryData = getQueryData().clone(); Collection<Criteria> criterias = queryData.getAllCriteria(); if (criterias.isEmpty() || (criterias.size() == 1 && criterias.iterator().next() instanceof CriteriaBranch)) { addAndCheck(queryData, criteriaFactory.createAllArtifactsCriteria()); } return queryData; }

Target:
private QueryData checkAndCloneQueryData() throws OseeCoreException { QueryData queryData = getQueryData().clone(); Collection<Criteria> criterias = queryData.getAllCriteria(); if (criterias.isEmpty() || hasOneBranchCriteria(criterias)) { addAndCheck(queryData, criteriaFactory.createAllArtifactsCriteria()); } return queryData; }
Source:
private boolean isChildNode(Node current, Node prevNode) { boolean isChild = false; if (prevNode.hasChildNodes()) { NodeList childNodes = prevNode.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { if (childNodes.item(i).getAttributes() != null && current.getAttributes() .getNamedItem(SOAPToRESTConstants.NAME_ATTRIBUTE).getNodeValue().equals(childNodes.item(i) .getAttributes().getNamedItem(SOAPToRESTConstants.NAME_ATTRIBUTE).getNodeValue())) { isChild = true; } } } return isChild; }

Target:
private boolean isChildNode(Node current, Node prevNode) { if (prevNode.hasChildNodes()) { NodeList childNodes = prevNode.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { if (childNodes.item(i).getAttributes() != null && current.getAttributes() .getNamedItem(SOAPToRESTConstants.NAME_ATTRIBUTE).getNodeValue().equals(childNodes.item(i) .getAttributes().getNamedItem(SOAPToRESTConstants.NAME_ATTRIBUTE).getNodeValue())) { return true; } } } return false; }
Source:
public ViewDistance getViewDistance() { return (viewDistance == null) ? ViewDistance.FAR : viewDistance; }

Target:
public ViewDistance getViewDistance() { return (viewDistance == null) ? ViewDistance.MODERATE : viewDistance; }
Source:
public StartsDockerDaemon(final Profile prof) { this.profile = prof; this.client = DockerClientBuilder.getInstance().build(); this.containers = Collections.newSetFromMap( new ConcurrentHashMap<CreateContainerResponse, Boolean>(1) ); }

Target:
public StartsDockerDaemon(final Profile prof) { this.profile = prof; this.client = DockerClientBuilder.getInstance().build(); this.containers = Collections.newSetFromMap( new ConcurrentHashMap<CreateContainerResponse, Boolean>(1, 0.9f, 1) ); }
Source:
protected void onInit() { super.onInit(); this.webSocketContainer.setMessageListener(this); if (!CollectionUtils.isEmpty(this.messageConverters)) { List<MessageConverter> converters = this.messageConverter.getConverters(); if (this.mergeWithDefaultConverters) { ListIterator<MessageConverter> iterator = this.messageConverters.listIterator(this.messageConverters.size()); while (iterator.hasPrevious()) { MessageConverter converter = iterator.previous(); converters.add(0, converter); } } else { converters.clear(); converters.addAll(this.messageConverters); } } if (this.server && this.useBroker) { Map<String, AbstractBrokerMessageHandler> brokers = getApplicationContext() .getBeansOfType(AbstractBrokerMessageHandler.class); for (AbstractBrokerMessageHandler broker : brokers.values()) { if (broker instanceof SimpleBrokerMessageHandler || broker instanceof StompBrokerRelayMessageHandler) { this.brokerHandler = broker; break; } } if (this.brokerHandler == null) { logger.warn("'AbstractBrokerMessageHandler' isn't present in the application context. The non-MESSAGE" + "WebSocketMessages will be ignored."); } } }

Target:
protected void onInit() { super.onInit(); this.webSocketContainer.setMessageListener(this); if (!CollectionUtils.isEmpty(this.messageConverters)) { List<MessageConverter> converters = this.messageConverter.getConverters(); if (this.mergeWithDefaultConverters) { ListIterator<MessageConverter> iterator = this.messageConverters.listIterator(this.messageConverters.size()); while (iterator.hasPrevious()) { MessageConverter converter = iterator.previous(); converters.add(0, converter); } } else { converters.clear(); converters.addAll(this.messageConverters); } } if (this.server && this.useBroker) { Map<String, AbstractBrokerMessageHandler> brokers = getApplicationContext() .getBeansOfType(AbstractBrokerMessageHandler.class); for (AbstractBrokerMessageHandler broker : brokers.values()) { if (broker instanceof SimpleBrokerMessageHandler || broker instanceof StompBrokerRelayMessageHandler) { this.brokerHandler = broker; break; } } if (this.brokerHandler == null) { logger.warn("'AbstractBrokerMessageHandler' isn't present in the application context. " + "The non-MESSAGE WebSocketMessages will be ignored."); } } }
Source:
public String method() { return method.name(); }

Target:
public String method() { return httpMethod.name(); }
Source:
public String getPartitionIdStringOrNullString() { return defaultIfNull(getPartitionId(), "null").toString(); }

Target:
public String getPartitionIdStringOrNullString() { if (myPartitionId == null) { return "null"; } return myPartitionId.toString(); }
Source:
protected NIC populate(NIC model, VmNetworkInterface entity) { network network = getClusterNetwork(getClusterId(), null, model.getNetwork().getName()); String networkId = network == null ? null : network.getId().toString(); model.getNetwork().setId(networkId); model.getNetwork().setName(null); if (entity.isPortMirroring()) { PortMirroring portMirroring = new PortMirroring(); Networks networks = new Networks(); Network net = new Network(); net.setId(networkId); portMirroring.setNetworks(networks); portMirroring.getNetworks().getNetworks().add(net); model.setPortMirroring(portMirroring); } return addStatistics(model, entity, uriInfo, httpHeaders); }

Target:
protected NIC populate(NIC model, VmNetworkInterface entity) { return addStatistics(model, entity, uriInfo, httpHeaders); }
Source:
private void addPrincipals( ParsedPolicyEntry parsedPolicyEntry, List<ConditionInfo> conditionInfos) { List<ParsedPrincipal> parsedPrincipals = parsedPolicyEntry.getPrincipals(); List<String> principals = new ArrayList<>(); for (ParsedPrincipal parsedPrincipal : parsedPrincipals) { if (parsedPrincipal.hasAlias()) { principals.add(parsedPrincipal.getAlias()); } else { principals.add( parsedPrincipal.getPrincipalClass() + "/" + parsedPrincipal.getPrincipalName()); } } if (!principals.isEmpty()) { conditionInfos.add(new ConditionInfo(PRINCIPAL_CONDITION, principals.toArray(new String[0]))); } }

Target:
private void addPrincipals( ParsedPolicyEntry parsedPolicyEntry, List<ConditionInfo> conditionInfos) { List<ParsedPrincipal> parsedPrincipals = parsedPolicyEntry.getPrincipals(); List<String> principals = new ArrayList<>(); for (ParsedPrincipal parsedPrincipal : parsedPrincipals) { if (parsedPrincipal.hasAlias()) { principals.add(parsedPrincipal.getAlias()); } else { principals.add( parsedPrincipal.getPrincipalClass() + "/" + parsedPrincipal.getPrincipalName()); } } if (!principals.isEmpty()) { conditionInfos.add( new ConditionInfo( PRINCIPAL_CONDITION, principals.toArray(new String[principals.size()]))); } }
Source:
public void testAllChecksPageInSyncWithChecksSummaries() throws Exception { final Pattern endOfSentence = Pattern.compile("(.*?\\.)\\s", Pattern.DOTALL); final Map<String, String> summaries = readSummaries(); for (Path path : XdocUtil.getXdocsConfigFilePaths(XdocUtil.getXdocsFilePaths())) { final String fileName = path.getFileName().toString(); if ("config_reporting.xml".equals(fileName) || "config_filefilters.xml".equals(fileName) || "config_filters.xml".equals(fileName)) { continue; } final String input = new String(Files.readAllBytes(path), UTF_8); final Document document = XmlUtil.getRawXml(fileName, input, input); final NodeList sources = document.getElementsByTagName("subsection"); for (int position = 0; position < sources.getLength(); position++) { final Node section = sources.item(position); final String sectionName = XmlUtil.getNodeName(section); if (!"Description".equals(sectionName)) { continue; } final String checkName = XmlUtil.getNodeName(section.getParentNode()); final Matcher matcher = endOfSentence.matcher(section.getTextContent()); assertWithMessage( "XDocs description should start with a sentence that ends with a period") .that(matcher.find()); final String firstSentence = XmlUtil.sanitizeXml(matcher.group(1)); assertWithMessage("Summary for check " + checkName + " in " + AVAILABLE_CHECKS_PATH + " should match the first sentence of the \"Description\" section for " + fileName + "#" + checkName) .that(summaries.get(checkName)) .isEqualTo(firstSentence); } } }

Target:
public void testAllChecksPageInSyncWithChecksSummaries() throws Exception { final Pattern endOfSentence = Pattern.compile("(.*?\\.)\\s", Pattern.DOTALL); final Map<String, String> summaries = readSummaries(); for (Path path : XdocUtil.getXdocsConfigFilePaths(XdocUtil.getXdocsFilePaths())) { final String fileName = path.getFileName().toString(); if ("config_reporting.xml".equals(fileName) || "config_filefilters.xml".equals(fileName) || "config_filters.xml".equals(fileName)) { continue; } final String input = new String(Files.readAllBytes(path), UTF_8); final Document document = XmlUtil.getRawXml(fileName, input, input); final NodeList sources = document.getElementsByTagName("subsection"); for (int position = 0; position < sources.getLength(); position++) { final Node section = sources.item(position); final String sectionName = XmlUtil.getNameAttributeOfNode(section); if (!"Description".equals(sectionName)) { continue; } final String checkName = XmlUtil.getNameAttributeOfNode(section.getParentNode()); final Matcher matcher = endOfSentence.matcher(section.getTextContent()); assertWithMessage( "The first sentence of the \"Description\" subsection for the check " + checkName + " in the file \"" + fileName + "\" should end with a period") .that(matcher.find()); final String firstSentence = XmlUtil.sanitizeXml(matcher.group(1)); assertWithMessage("The summary for check " + checkName + " in the file \"" + AVAILABLE_CHECKS_PATH + "\"" + " should match the first sentence of the \"Description\" subsection" + " for this check in the file \"" + fileName + "\"") .that(summaries.get(checkName)) .isEqualTo(firstSentence); } } }
Source:
public void incrementAllReachable(int seconds) { for (int i = 0; i < travelTimes.length; i++) { if (travelTimes[i] != Integer.MAX_VALUE) { travelTimes[i] += seconds; } } }

Target:
public void incrementAllReachable(int seconds) { for (int i = 0; i < travelTimes.length; i++) { if (travelTimes[i] != UNREACHED) { travelTimes[i] += seconds; } } }
Source:
protected void initButton(final Button button) { button.setToolTipText("Update Working Branch From Parent"); button.setImage(ImageManager.getImage(FrameworkImage.BRANCH_SYNCH)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { try { Branch branchToUpdate = getWorkingBranch(); if (branchToUpdate != null) { if (!BranchManager.hasMergeBranches(branchToUpdate) || branchToUpdate.getBranchState().isRebaselineInProgress()) { if (branchToUpdate.getBranchState().isRebaselineInProgress()) { RebaselineInProgressHandler.handleRebaselineInProgress(branchToUpdate); } else { boolean isUserSure = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Update Branch", String.format("Are you sure you want to update [%s] branch", branchToUpdate.getName())); if (isUserSure) { BranchManager.updateBranch(branchToUpdate, new UserConflictResolver()); } } } else { MessageDialog.openWarning( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Can't Update Branch", String.format( "Couldn't update [%s] because it currently has merge branches from commits. To perform an update please delete all the merge branches for this branch.", branchToUpdate.getName())); } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } } }); }

Target:
protected void initButton(final Button button) { button.setToolTipText("Update Working Branch From Parent"); button.setImage(ImageManager.getImage(FrameworkImage.BRANCH_SYNCH)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { try { Branch branchToUpdate = getWorkingBranch(); if (branchToUpdate != null) { if (BranchManager.isUpdatable(branchToUpdate)) { if (branchToUpdate.getBranchState().isRebaselineInProgress()) { RebaselineInProgressHandler.handleRebaselineInProgress(branchToUpdate); } else { boolean isUserSure = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Update Branch", String.format("Are you sure you want to update [%s] branch", branchToUpdate.getName())); if (isUserSure) { BranchManager.updateBranch(branchToUpdate, new UserConflictResolver()); } } } else { MessageDialog.openWarning( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Can't Update Branch", String.format( "Couldn't update [%s] because it currently has merge branches from commits. To perform an update please delete all the merge branches for this branch.", branchToUpdate.getName())); } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } } }); }
Source:
public void testConfigProviderConfigurationWithConfigParams() { Properties providers = new Properties(); providers.put("config.providers", "vault"); providers.put("config.providers.vault.class", "org.apache.kafka.common.config.provider.MockVaultConfigProvider"); providers.put("config.providers.vault.param.key", "randomKey"); providers.put("config.providers.vault.param.location", "/usr/vault"); Properties props = new Properties(); props.put("sasl.truststore.location", "${vault:/usr/truststore:truststoreKey}"); props.put("sasl.truststore.password", "${vault:/usr/truststore:truststorePassword}"); props.put("sasl.truststore.location", "${vault:/usr/truststore:truststoreLocation}"); TestIndirectConfigResolution config = new TestIndirectConfigResolution(props, convertPropertiesToMap(providers)); assertEquals(config.originals().get("sasl.truststore.location"), "/usr/vault"); }

Target:
public void testConfigProviderConfigurationWithConfigParams() { Properties providers = new Properties(); providers.put("config.providers", "vault"); providers.put("config.providers.vault.class", MockVaultConfigProvider.class.getName()); providers.put("config.providers.vault.param.key", "randomKey"); providers.put("config.providers.vault.param.location", "/usr/vault"); Properties props = new Properties(); props.put("sasl.truststore.location", "${vault:/usr/truststore:truststoreKey}"); props.put("sasl.truststore.password", "${vault:/usr/truststore:truststorePassword}"); props.put("sasl.truststore.location", "${vault:/usr/truststore:truststoreLocation}"); TestIndirectConfigResolution config = new TestIndirectConfigResolution(props, convertPropertiesToMap(providers)); assertEquals(config.originals().get("sasl.truststore.location"), "/usr/vault"); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Opt121 opt121 = (Opt121) o; if (rtDstSubnet != null ? !rtDstSubnet.equals(opt121.rtDstSubnet) : opt121.rtDstSubnet != null) return false; return gateway != null ? gateway.equals(opt121.gateway) : opt121.gateway == null; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Opt121 other = (Opt121)o; return Objects.equals(rtDstSubnet, other.rtDstSubnet) && Objects.equals(gateway, other.gateway); }
Source:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fIgnoreCase ? 1231 : 1237); result = prime * result + (fNot ? 1231 : 1237); result = prime * result + ((fValue == null) ? 0 : fValue.hashCode()); result = prime * result + ((fValueUpperCase == null) ? 0 : fValueUpperCase.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fIgnoreCase ? 1231 : 1237); result = prime * result + (fNot ? 1231 : 1237); result = prime * result + ((fValue == null) ? 0 : fValue.hashCode()); return result; }
Source:
SamzaContainer createSamzaContainer(String processorId, JobModel jobModel) { Optional<Tuple2<DiagnosticsManager, MetricsSnapshotReporter>> diagnosticsManagerReporterPair = DiagnosticsUtil.buildDiagnosticsManager(new ApplicationConfig(config).getAppName(), new ApplicationConfig(config).getAppId(), processorId, Optional.empty(), config); Option<DiagnosticsManager> diagnosticsManager = Option.empty(); if (diagnosticsManagerReporterPair.isPresent()) { diagnosticsManager = Option.apply(diagnosticsManagerReporterPair.get()._1()); this.customMetricsReporter.put(MetricsConfig.METRICS_SNAPSHOT_REPORTER_NAME_FOR_DIAGNOSTICS(), diagnosticsManagerReporterPair.get()._2()); } return SamzaContainer.apply(processorId, jobModel, ScalaJavaUtil.toScalaMap(this.customMetricsReporter), this.taskFactory, JobContextImpl.fromConfigWithDefaults(this.config), Option.apply(this.applicationDefinedContainerContextFactoryOptional.orElse(null)), Option.apply(this.applicationDefinedTaskContextFactoryOptional.orElse(null)), Option.apply(this.externalContextOptional.orElse(null)), null, null, diagnosticsManager); }

Target:
SamzaContainer createSamzaContainer(String processorId, JobModel jobModel) { String jobName = new JobConfig(config).getName().get(); String jobId = new JobConfig(config).getJobId(); Optional<Pair<DiagnosticsManager, MetricsSnapshotReporter>> diagnosticsManagerReporterPair = DiagnosticsUtil.buildDiagnosticsManager(jobName, jobId, processorId, Optional.empty(), config); Option<DiagnosticsManager> diagnosticsManager = Option.empty(); if (diagnosticsManagerReporterPair.isPresent()) { diagnosticsManager = Option.apply(diagnosticsManagerReporterPair.get().getKey()); this.customMetricsReporter.put(MetricsConfig.METRICS_SNAPSHOT_REPORTER_NAME_FOR_DIAGNOSTICS(), diagnosticsManagerReporterPair.get().getValue()); } return SamzaContainer.apply(processorId, jobModel, ScalaJavaUtil.toScalaMap(this.customMetricsReporter), this.taskFactory, JobContextImpl.fromConfigWithDefaults(this.config), Option.apply(this.applicationDefinedContainerContextFactoryOptional.orElse(null)), Option.apply(this.applicationDefinedTaskContextFactoryOptional.orElse(null)), Option.apply(this.externalContextOptional.orElse(null)), null, null, diagnosticsManager); }
Source:
protected IPapyrusMarker getMarkerA() { if (markerA == null) { markerA = new NodeAMarker(getView()); } return markerA; }

Target:
protected IPapyrusMarker getMarkerA() { if (null == markerA) { markerA = new NodeAMarker(getView()); } return markerA; }
Source:
protected boolean acquireLockInternal() { final boolean acquireLock = super.acquireLockInternal(); if (!acquireLock && getVm().isAutoStartup()) { AutoStartVmsRunner.getInstance().addVmToRun(getParameters().getVmId()); } return acquireLock; }

Target:
protected boolean acquireLockInternal() { final boolean acquireLock = super.acquireLockInternal(); if (!acquireLock && getVm() != null && getVm().isAutoStartup()) { AutoStartVmsRunner.getInstance().addVmToRun(getParameters().getVmId()); } return acquireLock; }
Source:
public synchronized boolean setFolderSyncMode(FolderMode syncMode) { FolderMode oldSyncMode = folderSyncMode; folderSyncMode = syncMode; if (syncMode == FolderMode.NONE && oldSyncMode != FolderMode.NONE) { return true; } return syncMode != FolderMode.NONE && oldSyncMode == FolderMode.NONE; }

Target:
public synchronized boolean setFolderSyncMode(FolderMode syncMode) { FolderMode oldSyncMode = folderSyncMode; folderSyncMode = syncMode; if (syncMode == FolderMode.NONE && oldSyncMode != FolderMode.NONE) { return true; } if (syncMode != FolderMode.NONE && oldSyncMode == FolderMode.NONE) { return true; } return false; }
Source:
public Map<String, JsonElement> allFlags(LDUser user) { if (isOffline()) { return null; } if (!initialized()) { return null; } Map<String, FeatureFlag> flags = this.config.featureStore.all(); Map<String, JsonElement> result = new HashMap<>(); for (String key : flags.keySet()) { result.put(key, evaluate(key, user, null)); } return result; }

Target:
public Map<String, Boolean> allFlags(LDUser user) { if (isOffline()) { return null; } if (!initialized()) { return null; } Map<String, FeatureFlag> flags = this.config.featureStore.all(); Map<String, Boolean> result = new HashMap<>(); for (String key : flags.keySet()) { JsonElement evalResult = evaluate(key, user, null); if (evalResult.isJsonPrimitive() && evalResult.getAsJsonPrimitive().isBoolean()) { result.put(key, evalResult.getAsBoolean()); } } return result; }
Source:
private DCPanel contentBottom() { String showDataCloudDialog = _userPreferences.getAdditionalProperties() .getOrDefault(SHOW_DATACLOUD_DIALOG_USER_PREFERENCE, "false"); Boolean showDataCloudDialogBool = Boolean.parseBoolean(showDataCloudDialog); final JButton closeButton = WidgetFactory.createDefaultButton("Close", IconUtils.ACTION_CLOSE_DARK); dontShowAgainCheckBox = new JCheckBox("Don't show after start again.", !showDataCloudDialogBool); dontShowAgainCheckBox.setOpaque(false); final DCPanel result = new DCPanel(WidgetUtils.COLOR_DEFAULT_BACKGROUND); final BorderLayout borderLayout = new BorderLayout(); result.setLayout(borderLayout); result.add(dontShowAgainCheckBox, BorderLayout.WEST); result.add(closeButton, BorderLayout.EAST); closeButton.addActionListener(e -> { saveDontShowFlag(); close(); }); return result; }

Target:
private DCPanel contentBottom() { String showDataCloudDialog = _userPreferences.getAdditionalProperties() .getOrDefault(SHOW_DATACLOUD_DIALOG_USER_PREFERENCE, "false"); Boolean showDataCloudDialogBool = Boolean.parseBoolean(showDataCloudDialog); final JButton closeButton = WidgetFactory.createDefaultButton("Close", IconUtils.ACTION_CLOSE_DARK); dontShowAgainCheckBox = new JCheckBox("Don't show again.", !showDataCloudDialogBool); dontShowAgainCheckBox.setOpaque(false); final DCPanel result = new DCPanel(WidgetUtils.COLOR_DEFAULT_BACKGROUND); final BorderLayout borderLayout = new BorderLayout(); result.setLayout(borderLayout); result.add(dontShowAgainCheckBox, BorderLayout.WEST); result.add(closeButton, BorderLayout.EAST); closeButton.addActionListener(e -> { saveDontShowFlag(); close(); }); return result; }
Source:
public boolean consumeRetry() { return --remainingRetries >= 0; }

Target:
boolean consumeRetry() { return --remainingRetries >= 0; }
Source:
public Object[][] inputSequences() { return new Object[][] { {true}, {false}, {true, true, true}, {false, false, false}, {true, false, true, false}, }; }

Target:
public Object[][] inputSequences() { return new Object[][] { {true}, {false}, {true, false}, {true, true, true}, {false, false, false}, {true, false, true, false}, }; }
Source:
private synchronized void writeWatchdogDevice(String value) { File f = null; FileWriter bw = null; try { f = new File(this.watchdogDevice); bw = new FileWriter(f); bw.write(value); logger.debug("write on watchdog device", value); } catch (IOException e) { logger.error("IOException on disable watchdog", e); } finally { try { if (bw != null) { bw.close(); } } catch (IOException e) { logger.error("IOException on closing watchdog file", e); } } }

Target:
private synchronized void writeWatchdogDevice(String value) { File f = new File(this.watchdogDevice); try (FileWriter bw = new FileWriter(f);) { bw.write(value); logger.debug("write on watchdog device", value); } catch (IOException e) { logger.error("IOException on disable watchdog", e); } }
Source:
protected Optional<Boolean> getVal(Entity dataHolder) { return Optional.of(dataHolder.isGlowing()); }

Target:
protected Optional<Boolean> getVal(Entity dataHolder) { return OptBool.of(dataHolder.isGlowing()); }
Source:
public void add(TopicPartition topicPartition, PartitionData data) { if (sessionPartitions.containsKey(topicPartition)) { altered.add(topicPartition); } else { added.add(topicPartition); } next.put(topicPartition, data); sessionPartitions.put(topicPartition, data); }

Target:
public void add(TopicPartition topicPartition, PartitionData data) { if (sessionPartitions.put(topicPartition, data) != null) { altered.add(topicPartition); } else { added.add(topicPartition); } next.put(topicPartition, data); }
Source:
public Optional getRequestAttribute(final String name) { return Optional.ofNullable(this.request.getAttribute(name)); }

Target:
public Optional<Object> getRequestAttribute(final String name) { return Optional.ofNullable(this.request.getAttribute(name)); }
Source:
private void init() { if (platformChecker == null) { setPlatformChecker(); } }

Target:
private void init() { if (platformChecker == null) setPlatformChecker(); }