auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { List<Set<GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); if (replicaCount > volume.getBricks().size()) { throw new EngineException(EngineError.GlusterVolumeGeoRepSyncFailed, "Not all bricks are up for this volume"); } for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { Set<GeoRepSessionStatus> subVolumeStatusSet = new HashSet<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusSet.add(getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusSet); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (Set<GeoRepSessionStatus> subVolumeStatusValues : list) { if (subVolumeStatusValues.contains(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusValues.contains(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (subVolumeStatusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) subVolumeStatusValues.toArray()[0]); } else { log.info("Multiple status values found in volume '{}'", session.getMasterVolumeName()); } } } }

Target:
private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { List<Set<GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); if (replicaCount > volume.getBricks().size()) { throw new EngineException(EngineError.GlusterVolumeGeoRepSyncFailed, "Not all bricks are available for this volume"); } for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { Set<GeoRepSessionStatus> subVolumeStatusSet = new HashSet<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusSet.add(getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusSet); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (Set<GeoRepSessionStatus> subVolumeStatusValues : list) { if (subVolumeStatusValues.contains(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusValues.contains(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (subVolumeStatusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) subVolumeStatusValues.toArray()[0]); } else { log.info("Multiple status values found in volume '{}'", session.getMasterVolumeName()); } } } }
Source:
public RedisMetadataReport(URL url) { super(url); if (url.getParameter(Constants.CLUSTER_KEY, false)) { jedisClusterNodes = new HashSet<HostAndPort>(); List<URL> urls = url.getBackupUrls(); for (URL tmpUrl : urls) { jedisClusterNodes.add(new HostAndPort(tmpUrl.getHost(), tmpUrl.getPort())); } } else { pool = new JedisPool(new JedisPoolConfig(), url.getHost(), url.getPort()); } }

Target:
public RedisMetadataReport(URL url) { super(url); timeout = url.getParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT); if (url.getParameter(CLUSTER_KEY, false)) { jedisClusterNodes = new HashSet<HostAndPort>(); List<URL> urls = url.getBackupUrls(); for (URL tmpUrl : urls) { jedisClusterNodes.add(new HostAndPort(tmpUrl.getHost(), tmpUrl.getPort())); } } else { pool = new JedisPool(new JedisPoolConfig(), url.getHost(), url.getPort(), timeout, url.getPassword()); } }
Source:
public Boolean stop(final String id, final boolean publish) { log.debug("Stop task[%s] publish[%s]", id, publish); try { final FullResponseHolder response = submitRequest( id, HttpMethod.POST, "stop", publish ? "publish=true" : null, true ); return response.getStatus().getCode() / 100 == 2; } catch (NoTaskLocationException e) { return false; } catch (TaskNotRunnableException e) { log.info("Task [%s] couldn't be stopped because it is no longer running", id); return true; } catch (Exception e) { log.warn(e, "Exception while stopping task [%s]", id); return false; } }

Target:
public boolean stop(final String id, final boolean publish) { log.debug("Stop task[%s] publish[%s]", id, publish); try { final FullResponseHolder response = submitRequest( id, HttpMethod.POST, "stop", publish ? "publish=true" : null, true ); return response.getStatus().getCode() / 100 == 2; } catch (NoTaskLocationException e) { return false; } catch (TaskNotRunnableException e) { log.info("Task [%s] couldn't be stopped because it is no longer running", id); return true; } catch (Exception e) { log.warn(e, "Exception while stopping task [%s]", id); return false; } }
Source:
private static void canonicalizeForPath(Buffer out, String input, int pos, int limit, boolean alreadyEncoded) { Buffer utf8Buffer = null; int codePoint; for (int i = pos; i < limit; i += Character.charCount(codePoint)) { codePoint = input.codePointAt(i); if (alreadyEncoded && shouldSkipCodePoint(codePoint)) { } else if (!alreadyEncoded && shouldEncodeCodePoint(codePoint)) { if (utf8Buffer == null) { utf8Buffer = new Buffer(); } utf8Buffer.writeUtf8CodePoint(codePoint); while (!utf8Buffer.exhausted()) { int b = utf8Buffer.readByte() & 0xff; out.writeByte('%'); out.writeByte(HEX_DIGITS[(b >> 4) & 0xf]); out.writeByte(HEX_DIGITS[b & 0xf]); } } else { out.writeUtf8CodePoint(codePoint); } } }

Target:
private static void canonicalizeForPath(Buffer out, String input, int pos, int limit, boolean alreadyEncoded) { Buffer utf8Buffer = null; int codePoint; for (int i = pos; i < limit; i += Character.charCount(codePoint)) { codePoint = input.codePointAt(i); if (alreadyEncoded && (codePoint == '\t' || codePoint == '\n' || codePoint == '\f' || codePoint == '\r')) { } else if (codePoint < 0x20 || codePoint >= 0x7f || PATH_SEGMENT_ALWAYS_ENCODE_SET.indexOf(codePoint) != -1 || (!alreadyEncoded && (codePoint == '/' || codePoint == '%'))) { if (utf8Buffer == null) { utf8Buffer = new Buffer(); } utf8Buffer.writeUtf8CodePoint(codePoint); while (!utf8Buffer.exhausted()) { int b = utf8Buffer.readByte() & 0xff; out.writeByte('%'); out.writeByte(HEX_DIGITS[(b >> 4) & 0xf]); out.writeByte(HEX_DIGITS[b & 0xf]); } } else { out.writeUtf8CodePoint(codePoint); } } }
Source:
public PersistentHostSetupNetworksParameters(Guid hostId) { super(hostId); }

Target:
public PersistentHostSetupNetworksParameters(Guid hostId) { this(hostId, 1, 1); }
Source:
private HttpRequestHeadersProvider getHttpRequestHeadersProvider(Subscription subscription) { Optional<HttpAuthorizationProvider> authorizationProvider = authorizationProviderFactory.create(subscription); Http1RequestHeadersProvider http1RequestHeadersProvider = new Http1RequestHeadersProvider(authorizationProvider); return subscription.isHttp2Enabled() ? new Http2RequestHeadersProvider(http1RequestHeadersProvider) : http1RequestHeadersProvider; }

Target:
private HttpHeadersProvider getHttpRequestHeadersProvider(Subscription subscription) { Optional<HttpAuthorizationProvider> authorizationProvider = authorizationProviderFactory.create(subscription); HttpHeadersProvider httpHeadersProvider = subscription.isHttp2Enabled() ? http2HeadersProvider : http1HeadersProvider; return new HermesHeadersProvider( new AuthHeadersProvider( httpHeadersProvider, authorizationProvider.orElse(null) ) ); }
Source:
public void cancelQuery(UUID queryId) { synchronized (this) { startTime.remove(queryId); } log.info("Canceling Query with RequestId: " + queryId); }

Target:
public void cancelQuery(UUID queryId) { log.debug("Canceling Query with RequestId: " + queryId); }
Source:
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) { final String homeDir = getActivity().getApplicationInfo().dataDir; databasesDir = new File(homeDir + "/databases"); newpipeDb = new File(homeDir + "/databases/newpipe.db"); newpipeDbJournal = new File(homeDir + "/databases/newpipe.db-journal"); newpipeDbShm = new File(homeDir + "/databases/newpipe.db-shm"); newpipeDbWal = new File(homeDir + "/databases/newpipe.db-wal"); newpipeSettings = new File(homeDir + "/databases/newpipe.settings"); newpipeSettings.delete(); addPreferencesFromResource(R.xml.content_settings); final Preference importDataPreference = findPreference(getString(R.string.import_data)); importDataPreference.setOnPreferenceClickListener((Preference p) -> { final Intent i = StoredFileHelper.getPicker(getContext()); startActivityForResult(i, REQUEST_IMPORT_PATH); return true; }); final Preference exportDataPreference = findPreference(getString(R.string.export_data)); exportDataPreference.setOnPreferenceClickListener((final Preference p) -> { startActivityForResult(StoredDirectoryHelper.getPicker(getContext()), REQUEST_EXPORT_PATH); return true; }); }

Target:
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) { final String homeDir = getActivity().getApplicationInfo().dataDir; databasesDir = new File(homeDir + "/databases"); newpipeDb = new File(homeDir + "/databases/newpipe.db"); newpipeDbJournal = new File(homeDir + "/databases/newpipe.db-journal"); newpipeDbShm = new File(homeDir + "/databases/newpipe.db-shm"); newpipeDbWal = new File(homeDir + "/databases/newpipe.db-wal"); newpipeSettings = new File(homeDir + "/databases/newpipe.settings"); newpipeSettings.delete(); addPreferencesFromResource(R.xml.content_settings); final Preference importDataPreference = findPreference(getString(R.string.import_data)); importDataPreference.setOnPreferenceClickListener((Preference p) -> { startActivityForResult(StoredFileHelper.getPicker(getContext()), REQUEST_IMPORT_PATH); return true; }); final Preference exportDataPreference = findPreference(getString(R.string.export_data)); exportDataPreference.setOnPreferenceClickListener((final Preference p) -> { final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US); startActivityForResult(StoredFileHelper.getNewPicker(getContext(), null, "NewPipeData-" + sdf.format(new Date()) + ".zip"), REQUEST_EXPORT_PATH); return true; }); }
Source:
public String getCategory() { return "core"; }

Target:
public String getCategory() { return CATEGORY; }
Source:
private static BoundingBox toBoundingBox(List<Float> serviceBoundingBox) { if (CoreUtils.isNullOrEmpty(serviceBoundingBox)) { return null; } Point topLeft = new Point(serviceBoundingBox.get(0), serviceBoundingBox.get(1)); Point topRight = new Point(serviceBoundingBox.get(2), serviceBoundingBox.get(3)); Point bottomLeft = new Point(serviceBoundingBox.get(4), serviceBoundingBox.get(5)); Point bottomRight = new Point(serviceBoundingBox.get(6), serviceBoundingBox.get(7)); return new BoundingBox(Arrays.asList(topLeft, topRight, bottomLeft, bottomRight)); }

Target:
private static BoundingBox toBoundingBox(List<Float> serviceBoundingBox) { if (CoreUtils.isNullOrEmpty(serviceBoundingBox) || (serviceBoundingBox.size() % 2) != 0) { return null; } List<Point> pointList = new ArrayList<>(); for (int i = 0; i < serviceBoundingBox.size(); i++) { pointList.add(new Point(serviceBoundingBox.get(i), serviceBoundingBox.get(++i))); } return new BoundingBox(pointList); }
Source:
public ConfigurationInstance get(Event event) { return withContextClassLoader(getExtensionClassLoader(), () -> { try (ValueResolvingContext resolvingContext = ValueResolvingContext.builder(((CoreEvent) event)) .withExpressionManager(expressionManager).build()) { ResolverSetResult result = resolverSet.resolve(resolvingContext); ResolverSetResult providerResult = null; if (connectionProviderResolver.getResolverSet().isPresent()) { providerResult = ((ResolverSet) connectionProviderResolver.getResolverSet().get()).resolve(resolvingContext); } if (muleContext.isStopping() || muleContext.isStopped()) { return getConfiguration(new Pair<>(result, providerResult), (CoreEvent) event); } else { return computeConfiguration(new Pair<>(result, providerResult), (CoreEvent) event); } } }); }

Target:
public ConfigurationInstance get(Event event) { return withContextClassLoader(getExtensionClassLoader(), () -> { try (ValueResolvingContext resolvingContext = ValueResolvingContext.builder(((CoreEvent) event)) .withExpressionManager(expressionManager).build()) { ResolverSetResult result = resolverSet.resolve(resolvingContext); ResolverSetResult providerResult = null; if (connectionProviderResolver.getResolverSet().isPresent()) { providerResult = ((ResolverSet) connectionProviderResolver.getResolverSet().get()).resolve(resolvingContext); } return getConfiguration(new Pair<>(result, providerResult), (CoreEvent) event); } }); }
Source:
public void delete(final String eventTypeName, final String timelineId, final Client client) throws ForbiddenAccessException, UnableProcessException, TimelineException { if (!client.getClientId().equals(securitySettings.getAdminClientId())) { throw new ForbiddenAccessException("Request is forbidden for user " + client.getClientId()); } final UUID uuid = uuidGenerator.fromString(timelineId); final List<Timeline> timelines = timelineDbRepository.listTimelines(eventTypeName); if (timelines.size() != DELETE_ONLY_FIRST_TIMELINE) { throw new UnableProcessException("Timeline with timelineId: " + uuid + " could not be deleted"); } final Timeline activeTimeline = timelines.get(0); if (activeTimeline.getId().equals(uuid)) { switchToFakeTimeline(uuid, activeTimeline); } else { throw new UnableProcessException("Timeline with timelineId: " + uuid + " not found"); } }

Target:
public void delete(final String eventTypeName, final String timelineId, final Client client) throws ForbiddenAccessException, UnableProcessException, TimelineException { if (!client.getClientId().equals(securitySettings.getAdminClientId())) { throw new ForbiddenAccessException("Request is forbidden for user " + client.getClientId()); } final EventType eventType; try { eventType = eventTypeCache.getEventType(eventTypeName); } catch (NoSuchEventTypeException e) { throw new NotFoundException("EventType \"" + eventTypeName + "\" does not exist", e); } catch (InternalNakadiException e) { throw new TimelineException("Internal service error", e); } final UUID uuid = uuidGenerator.fromString(timelineId); final List<Timeline> timelines = timelineDbRepository.listTimelines(eventType.getName()); if (timelines.size() == 1) { final Timeline activeTimeline = timelines.get(0); if (activeTimeline.getId().equals(uuid)) { switchToFakeTimeline(uuid, activeTimeline); } else { throw new NotFoundException("Timeline with id: " + uuid + " not found"); } } else { throw new UnableProcessException("Timeline with id: " + uuid + " could not be deleted. " + "It is possible to delete a timeline if there is only one timeline"); } }
Source:
public boolean addAll(final Collection<? extends E> c) { boolean ret = false; for(E elem : c) { boolean currentRet = add(elem); if(currentRet) { ret = true; } } return ret; }

Target:
public boolean addAll(final Collection<? extends E> c) { boolean ret = false; for(final E elem : c) { boolean currentRet = add(elem); if(currentRet) { ret = true; } } return ret; }
Source:
public static List<Alteration> getPositionedAlterations(Alteration alteration, Set<Alteration> fullAlterations) { if (alteration.getGene().getHugoSymbol().equals("ABL1") && alteration.getAlteration().equals("T315I")) { return new ArrayList<>(); } if (alteration.getConsequence() != null && alteration.getConsequence().equals(VariantConsequenceUtils.findVariantConsequenceByTerm("missense_variant")) && !alteration.getProteinStart().equals(-1) && !alteration.getProteinStart().equals(100000)) { VariantConsequence variantConsequence = new VariantConsequence(); variantConsequence.setTerm("NA"); return ApplicationContextSingleton.getAlterationBo().findMutationsByConsequenceAndPositionOnSamePosition(alteration.getGene(), variantConsequence, alteration.getProteinStart(), alteration.getProteinEnd(), fullAlterations); } return new ArrayList<>(); }

Target:
public static List<Alteration> getPositionedAlterations(Alteration alteration, Set<Alteration> fullAlterations) { if (alteration.getGene().getHugoSymbol().equals("ABL1") && alteration.getAlteration().equals("T315I")) { return new ArrayList<>(); } if (alteration.getConsequence() != null && alteration.getConsequence().equals(VariantConsequenceUtils.findVariantConsequenceByTerm("missense_variant")) && alteration.getProteinStart().intValue() != AlterationPositionBoundary.START.getValue() && alteration.getProteinStart().intValue() != AlterationPositionBoundary.END.getValue()) { VariantConsequence variantConsequence = new VariantConsequence(); variantConsequence.setTerm("NA"); return ApplicationContextSingleton.getAlterationBo().findMutationsByConsequenceAndPositionOnSamePosition(alteration.getGene(), variantConsequence, alteration.getProteinStart(), alteration.getProteinEnd(), fullAlterations); } return new ArrayList<>(); }
Source:
private void executeLoginUseCase(final Credentials credentials) { mLoginUseCase.execute(credentials, new ALoginUseCase.Callback() { @Override public void onLoginSuccess() { Log.d(TAG, "onLoginSuccess"); mLoginActivityStrategy.onLoginSuccess(credentials); } @Override public void onServerURLNotValid() { Log.d(TAG, "onServerURLNotValid"); onFinishLoading(null); serverText.setError( translate(R.string.login_invalid_server_url)); showError(translate(R.string.login_invalid_server_url)); } @Override public void onInvalidCredentials() { Log.d(TAG, "onInvalidCredentials"); mLoginActivityStrategy.onBadCredentials(); } @Override public void onServerPinChanged() { Log.d(TAG, "onServerPinChanged"); mLoginActivityStrategy.onBadCredentials(); } @Override public void onNetworkError() { Log.d(TAG, "onNetworkError"); mLoginActivityStrategy.onLoginNetworkError(credentials); } @Override public void onConfigJsonInvalid() { Log.d(TAG, "onConfigJsonInvalid"); onFinishLoading(null); showError(translate(R.string.login_error_json)); } @Override public void onUnexpectedError() { Log.d(TAG, "onUnexpectedError"); hideProgressBar(); showError(translate(R.string.login_unexpected_error)); } @Override public void onMaxLoginAttemptsReachedError() { Log.d(TAG, "onMaxLoginAttemptsReachedError"); mLoginActivityStrategy.disableLogin(); } @Override public void onServerNotAvailable() { Log.d(TAG, "onServerNotAvailable"); mLoginActivityStrategy.onServerNotAvailable(); } }); }

Target:
private void executeLoginUseCase(final Credentials credentials) { mLoginUseCase.execute(credentials, new ALoginUseCase.Callback() { @Override public void onLoginSuccess() { Log.d(TAG, "onLoginSuccess"); mLoginActivityStrategy.onLoginSuccess(credentials); } @Override public void onServerURLNotValid() { Log.d(TAG, "onServerURLNotValid"); onFinishLoading(null); serverText.setError( translate(R.string.login_invalid_server_url)); showError(translate(R.string.login_invalid_server_url)); } @Override public void onInvalidCredentials() { Log.d(TAG, "onInvalidCredentials"); mLoginActivityStrategy.onBadCredentials(); } @Override public void onServerPinChanged() { Log.d(TAG, "onServerPinChanged"); mLoginActivityStrategy.onBadCredentials(); } @Override public void onNetworkError() { Log.d(TAG, "onNetworkError"); mLoginActivityStrategy.onLoginNetworkError(credentials); } @Override public void onConfigJsonInvalid() { Log.d(TAG, "onConfigJsonInvalid"); onFinishLoading(null); showError(translate(R.string.login_error_json)); } @Override public void onUnexpectedError() { Log.d(TAG, "onUnexpectedError"); hideProgressBar(); showError(translate(R.string.login_unexpected_error)); } @Override public void onMaxLoginAttemptsReachedError() { Log.d(TAG, "onMaxLoginAttemptsReachedError"); mLoginActivityStrategy.disableLogin(); } @Override public void onServerNotAvailable(String message) { Log.d(TAG, "onServerNotAvailable"); mLoginActivityStrategy.onServerNotAvailable(message); } }); }
Source:
public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (Boolean.parseBoolean(jobExecution.getJobParameters().getString(jobParameterName))) { logger.info("Step skipped due to setting enabled", jobParameterName); return new FlowExecutionStatus(SKIP_STEP); } return new FlowExecutionStatus(DO_STEP); }

Target:
public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (Boolean.parseBoolean(jobExecution.getJobParameters().getString(jobParameterName))) { logger.info("Step skipped due to enabled", jobParameterName); return new FlowExecutionStatus(SKIP_STEP); } return new FlowExecutionStatus(DO_STEP); }
Source:
public void testService() { CodecService service = Framework.getService(CodecService.class); assertNotNull(service); }

Target:
public void testService() { assertNotNull(service); }
Source:
public void selectUserAccount(final WebContext ctx, String id) { if ("main".equals(id)) { String originalUserId = tenants.getTenantUserManager().getOriginalUserId(); UserAccount<?, ?> account = tenants.getTenantUserManager().fetchAccount(originalUserId); auditLog.neutral("AuditLog.switchedToMainUser") .hideFromUser() .causedByUser(account.getUniqueName(), account.getUserAccountData().getLogin().getUsername()) .forCurrentUser() .log(); ctx.setSessionValue(UserContext.getCurrentScope().getScopeId() + TenantUserManager.SPY_ID_SUFFIX, null); ctx.respondWith().redirectTemporarily("/user-accounts/select"); return; } assertPermission(TenantUserManager.PERMISSION_SELECT_USER_ACCOUNT); U user = mixing.getDescriptor(getUserClass()).getMapper().find(getUserClass(), id).orElse(null); if (user == null) { UserContext.get().addMessage(Message.error(NLS.get("UserAccountController.cannotBecomeUser"))); selectUserAccounts(ctx); return; } if (!getUser().hasPermission(TenantUserManager.PERMISSION_SYSTEM_TENANT_AFFILIATE)) { assertTenant(user); } auditLog.neutral("AuditLog.selectedUser") .hideFromUser() .causedByCurrentUser() .forUser(user.getUniqueName(), user.getUserAccountData().getLogin().getUsername()) .forTenant(String.valueOf(user.getTenant().getId()), user.getTenant().fetchValue().getTenantData().getName()) .log(); ctx.setSessionValue(UserContext.getCurrentScope().getScopeId() + TenantUserManager.SPY_ID_SUFFIX, user.getUniqueName()); ctx.respondWith().redirectTemporarily(ctx.get("goto").asString(wondergemRoot)); }

Target:
public void selectUserAccount(final WebContext ctx, String id) { if ("main".equals(id)) { String originalUserId = tenants.getTenantUserManager().getOriginalUserId(); UserAccount<?, ?> account = tenants.getTenantUserManager().fetchAccount(originalUserId); auditLog.neutral("AuditLog.switchedToMainUser") .hideFromUser() .causedByUser(account.getUniqueName(), account.getUserAccountData().getLogin().getUsername()) .forCurrentUser() .log(); ctx.setSessionValue(UserContext.getCurrentScope().getScopeId() + TenantUserManager.SPY_ID_SUFFIX, null); ctx.respondWith().redirectTemporarily("/user-accounts/select"); return; } assertPermission(TenantUserManager.PERMISSION_SELECT_USER_ACCOUNT); U user = mixing.getDescriptor(getUserClass()).getMapper().find(getUserClass(), id).orElse(null); if (user == null) { UserContext.get().addMessage(Message.error(NLS.get("UserAccountController.cannotBecomeUser"))); selectUserAccounts(ctx); return; } if (!getUser().hasPermission(TenantUserManager.PERMISSION_SYSTEM_TENANT_AFFILIATE)) { assertTenant(user); } auditLog.neutral("AuditLog.selectedUser") .hideFromUser() .causedByCurrentUser() .forUser(user.getUniqueName(), user.getUserAccountData().getLogin().getUsername()) .forTenant(user.getTenant().getIdAsString(), matchingTenants.fetchCachedRequiredTenant(user.getTenant()).getTenantData().getName()) .log(); ctx.setSessionValue(UserContext.getCurrentScope().getScopeId() + TenantUserManager.SPY_ID_SUFFIX, user.getUniqueName()); ctx.respondWith().redirectTemporarily(ctx.get("goto").asString(wondergemRoot)); }
Source:
public void testCreateEmptyBucketedPartition(HiveStorageFormat storageFormat) { String tableName = "test_insert_partitioned_bucketed_table"; createPartitionedBucketedTable(tableName, storageFormat); ImmutableList<String> orderStatusList = ImmutableList.of("F", "O", "P"); for (int i = 0; i < orderStatusList.size(); i++) { String sql = format("CALL system.create_empty_partition('%s', '%s', ARRAY['orderstatus'], ARRAY['%s'])", TPCH_SCHEMA, tableName, orderStatusList.get(i)); getQueryRunner().execute(getSession(), sql); assertQuery( "SELECT count(*) FROM \"test_insert_partitioned_bucketed_table$partitions\"", "SELECT " + (i + 1)); assertQueryFails(sql, "Partition already exists.*"); } assertUpdate("DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(getSession(), tableName)); }

Target:
public void testCreateEmptyBucketedPartition(HiveStorageFormat storageFormat) { String tableName = "test_insert_partitioned_bucketed_table"; createPartitionedBucketedTable(tableName, storageFormat); List<String> orderStatusList = ImmutableList.of("F", "O", "P"); for (int i = 0; i < orderStatusList.size(); i++) { String sql = format("CALL system.create_empty_partition('%s', '%s', ARRAY['orderstatus'], ARRAY['%s'])", TPCH_SCHEMA, tableName, orderStatusList.get(i)); assertUpdate(sql); assertQuery( "SELECT count(*) FROM \"test_insert_partitioned_bucketed_table$partitions\"", "SELECT " + (i + 1)); assertQueryFails(sql, "Partition already exists.*"); } assertUpdate("DROP TABLE " + tableName); assertFalse(getQueryRunner().tableExists(getSession(), tableName)); }
Source:
public void testDeleteFromListColumnIndexTable_nullRowFilter() { ColumnModel multiValue = new ColumnModel(); multiValue.setId("886"); multiValue.setColumnType(ColumnType.STRING_LIST); multiValue.setName("multiValue"); multiValue.setMaximumSize(100L); String message = assertThrows(IllegalArgumentException.class, ()->{ tableIndexDAO.deleteFromListColumnIndexTable(tableId, multiValue, null); }).getMessage(); assertEquals("rowIds is required and must not be empty.", message); }

Target:
public void testDeleteFromListColumnIndexTable_nullRowFilter() { ColumnModel multiValue = new ColumnModel(); multiValue.setId("886"); multiValue.setColumnType(ColumnType.STRING_LIST); multiValue.setName("multiValue"); multiValue.setMaximumSize(100L); Set<Long> rowIdFilter = null; String message = assertThrows(IllegalArgumentException.class, ()->{ tableIndexDAO.deleteFromListColumnIndexTable(tableId, multiValue, rowIdFilter); }).getMessage(); assertEquals("rowIds is required and must not be empty.", message); }
Source:
public static int optimalNumOfBits(long n, double p) { Preconditions.checkArgument((p > 0.0 && p < 1.0), "FPP should be less than 1.0 and great than 0.0"); final double m = -8 * n / Math.log(1 - Math.pow(p, 1.0 / 8)); final double MAX = DEFAULT_MAXIMUM_BYTES << 3; int numBits = (int)m; if (m > MAX || m < 0) { numBits = (int)MAX; } numBits = (numBits + BITS_PER_BLOCK -1) & ~BITS_PER_BLOCK; if (numBits < (DEFAULT_MINIMUM_BYTES << 3)) { numBits = DEFAULT_MINIMUM_BYTES << 3; } return numBits; }

Target:
public static int optimalNumOfBits(long n, double p) { Preconditions.checkArgument((p > 0.0 && p < 1.0), "FPP should be less than 1.0 and great than 0.0"); final double m = -8 * n / Math.log(1 - Math.pow(p, 1.0 / 8)); int numBits = (int)m ; if (numBits > UPPER_BOUND_BYTES << 3 || m < 0) { numBits = UPPER_BOUND_BYTES << 3; } numBits = (numBits + BITS_PER_BLOCK -1) & ~BITS_PER_BLOCK; if (numBits < (LOWER_BOUND_BYTES << 3)) { numBits = LOWER_BOUND_BYTES << 3; } return numBits; }
Source:
protected void tearDown() throws Exception { Job.getJobManager().removeJobChangeListener(jobChangeListener); PermissionService.removeExtension(permissionProviderDescriptor); super.tearDown(); }

Target:
protected void tearDown() throws Exception { Job.getJobManager().removeJobChangeListener(jobChangeListener); PermissionService.removeExtension(permissionProviderDescriptor); permissionProviderDescriptor = null; jobChangeListener = null; sessionAirdResource = null; modelExplorerView = null; super.tearDown(); }
Source:
private void endAction(CommandBase<?> commandBase, List<Guid> childCmdIds, boolean succeeded) { if (shouldExecuteEndMethod(commandBase)) { commandBase.getReturnValue().setSucceeded(false); VdcReturnValueBase returnVal = commandBase.endAction(); if (!returnVal.getSucceeded() && shouldRepeatEndMethodsOnFail(returnVal)) { throw new EngineException(EngineError.ENGINE, String.format("Command %1$s id: '%2$s' endAction() " + "didn't complete successfully", commandBase.getActionType(), commandBase.getCommandId())); } if (commandBase.getParameters().getParentCommand() == VdcActionType.Unknown) { CommandCoordinatorUtil.removeAllCommandsInHierarchy(commandBase.getCommandId()); } ExecutionHandler.endJob(commandBase.getExecutionContext(), succeeded); } }

Target:
private void endAction(CommandBase<?> commandBase, List<Guid> childCmdIds, boolean succeeded) { if (shouldExecuteEndMethod(commandBase)) { commandBase.getReturnValue().setSucceeded(false); VdcReturnValueBase returnVal = commandBase.endAction(); if (!returnVal.getSucceeded()) { if (shouldRepeatEndMethodsOnFail(returnVal)) { throw new EngineException(EngineError.ENGINE, String.format("Command %1$s id: '%2$s' endAction() " + "didn't complete successfully", commandBase.getActionType(), commandBase.getCommandId())); } else { log.warn("Command '{}' id: '{}' end method execution failed, as the command isn't marked for " + "endAction() retries silently ignoring", commandBase.getActionType(), commandBase.getCommandId()); } } if (commandBase.getParameters().getParentCommand() == VdcActionType.Unknown) { CommandCoordinatorUtil.removeAllCommandsInHierarchy(commandBase.getCommandId()); } ExecutionHandler.endJob(commandBase.getExecutionContext(), succeeded); } }
Source:
public View getView(int position, View convertView, ViewGroup parent) { View element = convertView; if(element == null){ LayoutInflater inflater = (LayoutInflater) this.mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); element = inflater.inflate(R.layout.user_item, null); } View userColor = (View) element.findViewById(R.id.userColor); TextView username = (TextView)element.findViewById(R.id.username); userColor.setBackgroundColor(Color.parseColor(users.get(usernames[position]))); username.setText(usernames[position]); return element; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { View userView = convertView; if(userView == null){ LayoutInflater inflater = (LayoutInflater) this.mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); userView = inflater.inflate(R.layout.user_item, null); } View userColor = (View) userView.findViewById(R.id.user_color); TextView username = (TextView)userView.findViewById(R.id.username); userColor.setBackgroundColor(Color.parseColor(users.get(usernames[position]))); username.setText(usernames[position]); return userView; }
Source:
protected void describeLine(StringBuilder sb) { super.describeLine(sb); if (barrier == null) { sb.append(String.format("connect %s\n", location)); } else { sb.append(String.format("connect await %s\nconnect %s\n", barrier, location)); } }

Target:
protected void describeLine(StringBuilder sb) { super.describeLine(sb); if (barrier == null) { sb.append(format("connect %s\n", location)); } else { sb.append(format("connect await %s\nconnect %s\n", barrier, location)); } }
Source:
public void testReadAvroWithoutReaderSchemas() throws IOException { Path sequenceFilePath = new Path(new File(mTempDir.getRoot(), "output.seq").getPath()); writeSequenceFile(sequenceFilePath, AvroKey.class, AvroValue.class, Schema.create(Schema.Type.STRING), Schema.create(Schema.Type.INT), new AvroKey<CharSequence>("one"), new AvroValue<>(1), new AvroKey<CharSequence>("two"), new AvroValue<>(2)); Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); AvroSequenceFile.Reader.Options options = new AvroSequenceFile.Reader.Options().withFileSystem(fs) .withInputPath(sequenceFilePath).withConfiguration(conf); SequenceFile.Reader reader = new AvroSequenceFile.Reader(options); AvroKey<CharSequence> key = new AvroKey<>(); AvroValue<Integer> value = new AvroValue<>(); key = (AvroKey<CharSequence>) reader.next(key); assertNotNull(key); assertEquals("one", key.datum().toString()); value = (AvroValue<Integer>) reader.getCurrentValue(value); assertNotNull(value); assertEquals(1, value.datum().intValue()); key = (AvroKey<CharSequence>) reader.next(key); assertNotNull(key); assertEquals("two", key.datum().toString()); value = (AvroValue<Integer>) reader.getCurrentValue(value); assertNotNull(value); assertEquals(2, value.datum().intValue()); assertNull("Should be no more records.", reader.next(key)); reader.close(); }

Target:
public void testReadAvroWithoutReaderSchemas() throws IOException { Path sequenceFilePath = new Path(new File(mTempDir.getRoot(), "output.seq").getPath()); writeSequenceFile(sequenceFilePath, AvroKey.class, AvroValue.class, Schema.create(Schema.Type.STRING), Schema.create(Schema.Type.INT), new AvroKey<CharSequence>("one"), new AvroValue<>(1), new AvroKey<CharSequence>("two"), new AvroValue<>(2)); Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); AvroSequenceFile.Reader.Options options = new AvroSequenceFile.Reader.Options().withFileSystem(fs) .withInputPath(sequenceFilePath).withConfiguration(conf); try (SequenceFile.Reader reader = new AvroSequenceFile.Reader(options)) { AvroKey<CharSequence> key = new AvroKey<>(); AvroValue<Integer> value = new AvroValue<>(); key = (AvroKey<CharSequence>) reader.next(key); assertNotNull(key); assertEquals("one", key.datum().toString()); value = (AvroValue<Integer>) reader.getCurrentValue(value); assertNotNull(value); assertEquals(1, value.datum().intValue()); key = (AvroKey<CharSequence>) reader.next(key); assertNotNull(key); assertEquals("two", key.datum().toString()); value = (AvroValue<Integer>) reader.getCurrentValue(value); assertNotNull(value); assertEquals(2, value.datum().intValue()); assertNull("Should be no more records.", reader.next(key)); } }
Source:
private boolean alreadyExistsInTgt(StoreKey key, IndexValue srcValue) throws StoreException { IndexValue tgtValue = tgtIndex.findKey(key); return tgtValue != null && srcValue.isFlagSet(IndexValue.Flags.Delete_Index) == tgtValue.isFlagSet( IndexValue.Flags.Delete_Index); }

Target:
private boolean alreadyExistsInTgt(StoreKey key, IndexValue srcValue) throws StoreException { IndexValue tgtValue = tgtIndex.findKey(key); return tgtValue != null && (tgtValue.isFlagSet(IndexValue.Flags.Delete_Index) || !srcValue.isFlagSet( IndexValue.Flags.Delete_Index)); }
Source:
public void onBackPressed() { if (coordinatesChanged) { showSaveChangesDialog(this); } else { super.onBackPressed(); } }

Target:
public void onBackPressed() { showSaveChangesDialog(this); }
Source:
public long getMessageSendTime(final int idx) { if (!VmSettings.MESSAGE_TIMESTAMPS) { return 0; } return messageSendTime.get(idx); }

Target:
public long getMessageSendTime(final int idx) { return messageSendTime.get(idx); }
Source:
public Builder cmd(List<String> cmd) { this.cmd = ImmutableList.builder(); this.cmd.addAll(cmd); return this; }

Target:
public Builder cmd(List<String> cmd) { this.cmd = ImmutableList.copyOf(checkNotNull(cmd, "cmd")); return this; }
Source:
public void waitTabSelected(String tabTitle) { final String terminalTabXpath = getTerminalTabXpath(tabTitle); final String cssTopBorderColorProperty = "border-top-color"; final String selectedElementTopBorderColor = "rgba(245, 245, 245, 1)"; seleniumWebDriverHelper.waitCssValueEqualsTo( By.xpath(terminalTabXpath), cssTopBorderColorProperty, selectedElementTopBorderColor); }

Target:
public void waitTabSelected(String tabTitle) { final String tabXpath = getTabXpath(tabTitle); final String cssTopBorderColorProperty = "border-top-color"; final String selectedElementTopBorderColor = "rgba(245, 245, 245, 1)"; seleniumWebDriverHelper.waitCssValueEqualsTo( By.xpath(tabXpath), cssTopBorderColorProperty, selectedElementTopBorderColor); }
Source:
public final Response createServiceIntegrationSecrets( @Context final HttpServletRequest request, @Context final HttpServletResponse response, final SecretForm secretForm ) { try { secretForm.checkValid(); final InitDataObject initData = new WebResource.InitBuilder(webResource) .requiredBackendUser(true) .requiredFrontendUser(false) .requestAndResponse(request, response) .rejectWhenNoUser(true) .init(); final User user = initData.getUser(); helper.saveUpdateSecret(secretForm, user); return Response.ok(new ResponseEntityView(OK)).build(); } catch (Exception e) { Logger.error(this.getClass(),"Exception creating secret with message: " + e.getMessage(), e); return ResponseUtil.mapExceptionResponse(e); } }

Target:
public final Response createServiceIntegrationSecrets( @Context final HttpServletRequest request, @Context final HttpServletResponse response, final SecretForm secretForm ) { try { secretForm.checkValid(); final InitDataObject initData = new WebResource.InitBuilder(webResource) .requiredBackendUser(true) .requiredFrontendUser(false) .requestAndResponse(request, response) .rejectWhenNoUser(true) .init(); final User user = initData.getUser(); helper.saveUpdateSecret(secretForm, user); return Response.ok(new ResponseEntityView(OK)).build(); } catch (Exception e) { Logger.error(this.getClass(), String.format("Exception creating secret integration with form `%s` ",secretForm), e ); return ResponseUtil.mapExceptionResponse(e); } }
Source:
private DashboardFilter blacklist(String... pipelines) { return new BlacklistFilter(DEFAULT_NAME, CaseInsensitiveString.list(pipelines), new HashSet<>()); }

Target:
private DashboardFilter blacklist(String... pipelines) { return new BlacklistFilter(DEFAULT_NAME, CaseInsensitiveString.list(pipelines), Collections.emptySet()); }
Source:
public String completeToolTipText(String toolTipText, EObject eObject, EStructuralFeature feature) { return completeToolTipText(toolTipText, eObject); }

Target:
public String completeToolTipText(String toolTipText, EObject eObject, EStructuralFeature feature) { return toolTipText; }
Source:
public static Map<String, String> filterTags(Map<String, String> tags, List<String> whiteList, List<String> whiteListPrefixes) { if (!(whiteList == null && whiteListPrefixes == null)) { final Map<String, String> tagsCopy = Maps.newHashMap(tags); final Map<String, String> newTags = Maps.newLinkedHashMap(); String key; if (whiteList != null) { for (Map.Entry<String, String> entry : tags.entrySet()) { key = entry.getKey(); if (whiteList.contains(key)) { newTags.put(key, entry.getValue()); tagsCopy.remove(key); } } } if (whiteListPrefixes != null) { for (Map.Entry<String, String> entry : tagsCopy.entrySet()) { key = entry.getKey(); for (String prefix : whiteListPrefixes) { if (key.startsWith(prefix)) { newTags.put(key, entry.getValue()); break; } } } } return newTags; } return tags; }

Target:
public static Map<String, String> filterTags(Map<String, String> tags, List<String> whiteList, List<String> whiteListPrefixes) { if (whiteList == null && whiteListPrefixes == null) { return tags; } final Map<String, String> tagsCopy = Maps.newHashMap(tags); final Map<String, String> newTags = Maps.newLinkedHashMap(); String key; if (whiteList != null) { for (Map.Entry<String, String> entry : tags.entrySet()) { key = entry.getKey(); if (whiteList.contains(key)) { newTags.put(key, entry.getValue()); tagsCopy.remove(key); } } } if (whiteListPrefixes != null) { for (Map.Entry<String, String> entry : tagsCopy.entrySet()) { key = entry.getKey(); for (String prefix : whiteListPrefixes) { if (key.startsWith(prefix)) { newTags.put(key, entry.getValue()); break; } } } } return newTags; }
Source:
public GenericRecord convertToAvro(String json) { try { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(json); return getOutputRecord(jsonNode, schema); } catch (IOException ex) { logger.error(ex.getMessage()); } return null; }

Target:
public GenericRecord convertToAvro(String json) { try { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(json); return getOutputRecord(jsonNode, schema); } catch (IOException | TalendRuntimeException e) { throw TalendRuntimeException.createUnexpectedException(e.getCause()); } }
Source:
public synchronized void put(Integer key, String testUnitName) throws OseeCoreException { ensurePopulated(); if (idToNameCache.containsKey(key) && !idToNameCache.get(key).equalsIgnoreCase(testUnitName)) { throw new OseeArgumentException("TestUnit key: [%s] has already been used", key); } else { idToNameCache.put(key, testUnitName); cacheIsDirty = true; } }

Target:
public synchronized void put(Integer key, String testUnitName) throws OseeCoreException { ensurePopulated(); if (idToNameCache.containsKey(key) && !idToNameCache.get(key).equalsIgnoreCase(testUnitName)) { throw new OseeArgumentException("TestUnit key: [%s] has already been used", key); } else { idToNameCache.put(key, testUnitName); cacheIsDirty = true; lastId = Math.max(lastId, key); } }
Source:
public void testRemoveValueUnequalStoreEntryCacheAccessExceptionNoCacheWriterEntry() throws Exception { final MockStore realStore = new MockStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(realStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final MockCacheWriter realCache = new MockCacheWriter(Collections.<String, String>emptyMap()); this.cacheWriter = spy(realCache); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); assertThat(realCache.getEntries().containsKey("key"), is(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }

Target:
public void testRemoveValueUnequalStoreEntryCacheAccessExceptionNoCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.<String, String>emptyMap()); this.cacheWriter = spy(fakeWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); ehcache.remove("key", "value"); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
public void visitToken(final DetailAST ast) { final String[] lines = this.getLines(); final int start = ast.getLineNo(); final int cstart = JavadocEmptyLineCheck.findCommentStart(lines, start) + 1; if (JavadocEmptyLineCheck.isNodeHavingJavaDoc(ast, cstart)) { if (JavadocEmptyLineCheck.isJavadocLineEmpty(lines[cstart])) { this.log(cstart + 1, "Empty javadoc line at the beginning"); } final int cend = JavadocEmptyLineCheck.findCommentEnd(lines, start) - 1; if (JavadocEmptyLineCheck.isJavadocLineEmpty(lines[cend])) { this.log(cend + 1, "Empty javadoc line at the end"); } } }

Target:
public void visitToken(final DetailAST ast) { final String[] lines = this.getLines(); final int current = ast.getLineNo(); final int start = JavadocEmptyLineCheck.findCommentStart(lines, current) + 1; if (JavadocEmptyLineCheck.isNodeHavingJavadoc(ast, start)) { if (JavadocEmptyLineCheck.isJavadocLineEmpty(lines[start])) { this.log(start + 1, "Empty Javadoc line at the beginning"); } final int end = JavadocEmptyLineCheck.findCommentEnd(lines, current) - 1; if (JavadocEmptyLineCheck.isJavadocLineEmpty(lines[end])) { this.log(end + 1, "Empty Javadoc line at the end"); } } }
Source:
public static void setup() { try { Class.forName(DB_DRIVER).newInstance(); Connection con = DriverManager.getConnection(DB_URL,USER_NAME,PSW); Statement stmt = con.createStatement(); String createMetaTable = "CREATE TABLE IF NOT EXISTS " + JdbcTransactionalStore.DEFAULT_META_TABLE + " ( " + JdbcTransactionalStore.DEFAULT_APP_ID_COL + " VARCHAR(100) NOT NULL, " + JdbcTransactionalStore.DEFAULT_OPERATOR_ID_COL + " INT NOT NULL, " + JdbcTransactionalStore.DEFAULT_WINDOW_COL + " BIGINT NOT NULL, " + "UNIQUE (" + JdbcTransactionalStore.DEFAULT_APP_ID_COL + ", " + JdbcTransactionalStore.DEFAULT_OPERATOR_ID_COL + ", " + JdbcTransactionalStore.DEFAULT_WINDOW_COL + ") " + ")"; stmt.executeUpdate(createMetaTable); String createInputTable = "CREATE TABLE IF NOT EXISTS " + INPUT_TABLE + "(MONTH INT(2) not NULL, DAY INT(2), YEAR INT(4), MEANTEMP DOUBLE(10) )"; stmt.executeUpdate(createInputTable); String createOutputTable = "CREATE TABLE IF NOT EXISTS " + OUTPUT_TABLE + "(MONTH INT(2) not NULL, MEANTEMP DOUBLE(10) )"; stmt.executeUpdate(createOutputTable); String cleanTable = "truncate table " + INPUT_TABLE; stmt.executeUpdate(cleanTable); stmt = con.createStatement(); String sql = "INSERT INTO " + INPUT_TABLE + " VALUES (6, 21, 2014, 85.3)"; stmt.executeUpdate(sql); sql = "INSERT INTO " + INPUT_TABLE + " VALUES (7, 20, 2014, 75.4)"; stmt.executeUpdate(sql); sql = "INSERT INTO " + INPUT_TABLE + " VALUES (6, 18, 2014, 45.3)"; stmt.executeUpdate(sql); } catch (Throwable e) { DTThrowable.rethrow(e); } }

Target:
public static void setup() { try { Class.forName(DB_DRIVER).newInstance(); Connection con = DriverManager.getConnection(DB_URL,USER_NAME,PSW); Statement stmt = con.createStatement(); String createMetaTable = "CREATE TABLE IF NOT EXISTS " + JdbcTransactionalStore.DEFAULT_META_TABLE + " ( " + JdbcTransactionalStore.DEFAULT_APP_ID_COL + " VARCHAR(100) NOT NULL, " + JdbcTransactionalStore.DEFAULT_OPERATOR_ID_COL + " INT NOT NULL, " + JdbcTransactionalStore.DEFAULT_WINDOW_COL + " BIGINT NOT NULL, " + "UNIQUE (" + JdbcTransactionalStore.DEFAULT_APP_ID_COL + ", " + JdbcTransactionalStore.DEFAULT_OPERATOR_ID_COL + ", " + JdbcTransactionalStore.DEFAULT_WINDOW_COL + ") " + ")"; stmt.executeUpdate(createMetaTable); String createInputTable = "CREATE TABLE IF NOT EXISTS " + INPUT_TABLE + "(MONTH INT(2) not NULL, DAY INT(2), YEAR INT(4), MEANTEMP DOUBLE(10) )"; stmt.executeUpdate(createInputTable); String createOutputTable = "CREATE TABLE IF NOT EXISTS " + OUTPUT_TABLE + "(MONTH INT(2) not NULL, MEANTEMP DOUBLE(10) )"; stmt.executeUpdate(createOutputTable); String cleanTable = "truncate table " + INPUT_TABLE; stmt.executeUpdate(cleanTable); stmt = con.createStatement(); String sql = "INSERT INTO " + INPUT_TABLE + " VALUES (6, 21, 2014, 85.3)"; stmt.executeUpdate(sql); sql = "INSERT INTO " + INPUT_TABLE + " VALUES (7, 20, 2014, 75.4)"; stmt.executeUpdate(sql); sql = "INSERT INTO " + INPUT_TABLE + " VALUES (6, 18, 2014, 45.3)"; stmt.executeUpdate(sql); } catch (Throwable e) { throw Throwables.propagate(e); } }
Source:
public void endWindow() { if (!partialWindowTuples.isEmpty() && windowId > windowDataManager.getLargestRecoveryWindow()) { throw new RuntimeException("Violates Exactly once. Not all the tuples received after operator reset."); } try { this.windowDataManager.save(getPartitionsAndOffsets(), operatorId, windowId); } catch (IOException e) { throw new RuntimeException(e); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }

Target:
public void endWindow() { if (!partialWindowTuples.isEmpty() && windowId > windowDataManager.getLargestRecoveryWindow()) { throw new RuntimeException("Violates Exactly once. Not all the tuples received after operator reset."); } getProducer().flush(); try { this.windowDataManager.save(getPartitionsAndOffsets(true), operatorId, windowId); } catch (IOException | InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }