auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void saveLocation_ShouldSaveCorrectLocation() { LocationEntity actualLocationEntity = createEntity(10L); mDatabase.locationRoomDAO().saveLocation(actualLocationEntity); mDatabase.locationRoomDAO().getLocations().subscribe(new SingleObserver<List<LocationEntity>>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(List<LocationEntity> locationEntities) { Assert.assertEquals(locationEntities.get(0).getName(), "name"); } @Override public void onError(Throwable e) { } }); }

Target:
public void saveLocation_ShouldSaveCorrectLocation() { mDatabase.locationRoomDAO().saveLocation(expectedLocationEntity); mDatabase.locationRoomDAO().getLocations().subscribe(new SingleObserver<List<LocationEntity>>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(List<LocationEntity> locationEntities) { Assert.assertEquals(locationEntities.get(0).getName(), "name"); Assert.assertEquals(locationEntities.get(0).getDescription(), "description"); Assert.assertEquals(locationEntities.get(0).getDisplay(), "display"); } @Override public void onError(Throwable e) { Log.i(TAG, e.getMessage()); } }); }
Source:
private void receiveTokenFromKeycloak(final String content) throws IOException, URISyntaxException { Assert.requireNonNull(content, "content"); LOG.debug("receiving new token from keycloak server"); final HttpClientConnection clientConnection = createConnection(); clientConnection.addRequestHeader("Content-Type", "application/x-www-form-urlencoded"); clientConnection.setDoOutput(true); clientConnection.writeRequestContent(content); final int responseCode = clientConnection.readResponseCode(); if(responseCode == SC_HTTP_UNAUTHORIZED) { throw new DolphinRuntimeException("Invalid login!"); } final String input = clientConnection.readUTFResponseContent(); final Gson gson = PlatformClient.getService(Gson.class); final KeycloakOpenidConnectResult result = gson.fromJson(input, KeycloakOpenidConnectResult.class); connectResult = result; tokenCreation = System.currentTimeMillis(); }

Target:
private void receiveTokenFromKeycloak(final String content) throws IOException, URISyntaxException { Assert.requireNonNull(content, "content"); LOG.debug("receiving new token from keycloak server"); final HttpClientConnection clientConnection = createConnection(); clientConnection.addRequestHeader(CONTENT_TYPE_HEADER, FORM_MIME_TYPE); clientConnection.setDoOutput(true); clientConnection.writeRequestContent(content); final int responseCode = clientConnection.readResponseCode(); if(responseCode == SC_HTTP_UNAUTHORIZED) { throw new DolphinRuntimeException("Invalid login!"); } final String input = clientConnection.readUTFResponseContent(); final Gson gson = PlatformClient.getService(Gson.class); final KeycloakOpenidConnectResult result = gson.fromJson(input, KeycloakOpenidConnectResult.class); connectResult = result; tokenCreation = System.currentTimeMillis(); }
Source:
static Pair<TextSelection, Boolean> getSelection(@NotNull Editor editor) { SelectionModel selectionModel = editor.getSelectionModel(); int selectionStart = selectionModel.getSelectionStart(); int selectionEnd = selectionModel.getSelectionEnd(); TextSelection selection = calculateSelectionPosition(editor, selectionStart, selectionEnd); boolean isBackwardsSelection = isBackwardsSelection(editor, selectionStart, selectionEnd); return new Pair<>(selection, isBackwardsSelection); }

Target:
static TextSelection getSelection(@NotNull Editor editor) { SelectionModel selectionModel = editor.getSelectionModel(); int selectionStart = selectionModel.getSelectionStart(); int selectionEnd = selectionModel.getSelectionEnd(); return calculateSelectionPosition(editor, selectionStart, selectionEnd); }
Source:
public String toString() { return "ModuleDeploymentStatus{" + "container='" + container + '\'' + ", key=" + key + ", status=" + state + ", errorDescription='" + errorDescription + '\'' + '}'; }

Target:
public String toString() { return "ModuleDeploymentStatus{" + "container='" + container + '\'' + ", key=" + key + ", state=" + state + ", errorDescription='" + errorDescription + '\'' + '}'; }
Source:
public void testHotRod() { ConfigurationBuilder builder = new ConfigurationBuilder(); if (!mechanism.isEmpty()) { builder.security().authentication() .saslMechanism(mechanism) .serverName("infinispan") .realm("default") .username("all_user") .password("all"); } try { RemoteCache<String, String> cache = SERVER_TEST.hotrod().withClientConfiguration(builder).withCacheMode(CacheMode.DIST_SYNC).create(); cache.put("k1", "v1"); assertEquals(1, cache.size()); assertEquals("v1", cache.get("k1")); } catch (HotRodClientException e) { if (!mechanism.isEmpty() && !"PLAIN".equals(mechanism)) throw e; } }

Target:
public void testHotRod() { ConfigurationBuilder builder = new ConfigurationBuilder(); if (!mechanism.isEmpty()) { builder.security().authentication() .saslMechanism(mechanism) .realm("default") .username("all_user") .password("all"); } try { RemoteCache<String, String> cache = SERVER_TEST.hotrod().withClientConfiguration(builder).withCacheMode(CacheMode.DIST_SYNC).create(); cache.put("k1", "v1"); assertEquals(1, cache.size()); assertEquals("v1", cache.get("k1")); } catch (HotRodClientException e) { if (!mechanism.isEmpty() && !"PLAIN".equals(mechanism)) throw e; } }
Source:
void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) { if (GTK.GTK4) { background = rgba; super.setBackgroundGdkRGBA(context, handle, rgba); } else { if (rgba == null) { background = defaultBackground(); } else { background = rgba; } String css; String properties; String name; name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "spinbutton" : "GtkSpinButton"; String color = display.gtk_rgba_to_css_string (background); properties = " {background-image: -gtk-gradient (linear, 0 0, 0 1, color-stop(0, " + color + "), color-stop(1, " + color + "));}"; css = name + properties; cssBackground = css; String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); gtk_css_provider_load_from_css(context, finalCss); } }

Target:
void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) { if (rgba == null) { background = defaultBackground(); } else { background = rgba; } if (GTK.GTK4) { super.setBackgroundGdkRGBA(context, handle, rgba); } else { String color = display.gtk_rgba_to_css_string (background); String properties = " {background-image: -gtk-gradient (linear, 0 0, 0 1, color-stop(0, " + color + "), color-stop(1, " + color + "));}"; String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "spinbutton" : "GtkSpinButton"; String css = name + properties; cssBackground = css; String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND); gtk_css_provider_load_from_css(context, finalCss); } }
Source:
public void useAadAsyncClient() { DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() .endpoint("{endpoint}") .credential(defaultCredential) .buildAsyncClient(); }

Target:
public void useAadAsyncClient() { TokenCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); TextAnalyticsAsyncClient textAnalyticsClient = new TextAnalyticsClientBuilder() .endpoint("{endpoint}") .credential(defaultCredential) .buildAsyncClient(); }
Source:
public Object hasPermission(ProceedingJoinPoint proceedingJoinPoint) { long startTime = System.currentTimeMillis(); MethodSignature methodSignature = (MethodSignature) proceedingJoinPoint.getSignature(); LOGGER.debug("Permission check started at (method: {})", startTime, methodSignature.getMethod().getDeclaringClass().getSimpleName() + "#" + methodSignature.getMethod().getName()); Optional<Object> initiatorUserCrn = reflectionUtil.getParameter(proceedingJoinPoint, methodSignature, InitiatorUserCrn.class); if (initiatorUserCrn.isPresent() && initiatorUserCrn.get() instanceof String && Crn.isCrn((String) initiatorUserCrn.get())) { String newUserCrn = (String) initiatorUserCrn.get(); internalUserModifier.persistModifiedInternalUser(crnUserDetailsService.loadUserByUsername(newUserCrn)); return ThreadBasedUserCrnProvider.doAs(newUserCrn, () -> commonPermissionCheckingUtils.proceed(proceedingJoinPoint, methodSignature, startTime)); } if (commonPermissionCheckingUtils.isAuthorizationDisabled(proceedingJoinPoint) || InternalCrnBuilder.isInternalCrn(ThreadBasedUserCrnProvider.getUserCrn())) { return commonPermissionCheckingUtils.proceed(proceedingJoinPoint, methodSignature, startTime); } checkPrerequisitesOnClass(proceedingJoinPoint, methodSignature); return checkPermission(proceedingJoinPoint, methodSignature, startTime); }

Target:
public Object hasPermission(ProceedingJoinPoint proceedingJoinPoint) { long startTime = System.currentTimeMillis(); MethodSignature methodSignature = (MethodSignature) proceedingJoinPoint.getSignature(); LOGGER.debug("Permission check started at (method: {})", startTime, methodSignature.getMethod().getDeclaringClass().getSimpleName() + "#" + methodSignature.getMethod().getName()); Optional<Object> initiatorUserCrn = reflectionUtil.getParameter(proceedingJoinPoint, methodSignature, InitiatorUserCrn.class); if (InternalCrnBuilder.isInternalCrn(ThreadBasedUserCrnProvider.getUserCrn()) && initiatorUserCrn.isPresent() && initiatorUserCrn.get() instanceof String && Crn.isCrn((String) initiatorUserCrn.get())) { String newUserCrn = (String) initiatorUserCrn.get(); internalUserModifier.persistModifiedInternalUser(crnUserDetailsService.loadUserByUsername(newUserCrn)); return ThreadBasedUserCrnProvider.doAs(newUserCrn, () -> commonPermissionCheckingUtils.proceed(proceedingJoinPoint, methodSignature, startTime)); } if (commonPermissionCheckingUtils.isAuthorizationDisabled(proceedingJoinPoint) || InternalCrnBuilder.isInternalCrn(ThreadBasedUserCrnProvider.getUserCrn())) { return commonPermissionCheckingUtils.proceed(proceedingJoinPoint, methodSignature, startTime); } checkPrerequisitesOnClass(proceedingJoinPoint, methodSignature); return checkPermission(proceedingJoinPoint, methodSignature, startTime); }
Source:
public void shouldValidateValueWithDifferentDigester() throws Exception { String value = "myPassword"; final byte[] salt = KeySources.random(16).getKey(); Digester digester1 = new Digester(KeySources.random(16), DigestSources.pbkDf2(salt)); Digester digester2 = new Digester(KeySources.random(16), DigestSources.pbkDf2(salt)); final String digest = digester1.digest(value); assertTrue(digester2.validate("myPassword", digest)); assertFalse(digester2.validate("MyPassword", digest)); }

Target:
public void shouldValidateValueWithDifferentDigester() throws Exception { String value = "myPassword"; Digester digester1 = new Digester(KeySources.random(16), DigestSources.pbkDf2()); Digester digester2 = new Digester(KeySources.random(16), DigestSources.pbkDf2()); final String digest1 = digester1.digest(value); final String digest2 = digester2.digest(value); assertTrue(digester2.validate("myPassword", digest1)); assertFalse(digester2.validate("MyPassword", digest1)); assertNotEquals(digest1, digest2); }
Source:
private Stack prepareSharedServiceIfNeed(Stack stack) { if (stack.getDatalakeResourceId() != null) { return sharedServiceConfigProvider.prepareDatalakeConfigs(stack); } LOGGER.debug("No datalake resource id has been given for stack! (crn: {})", stack.getResourceCrn()); return stack; }

Target:
private Stack prepareSharedServiceIfNeed(Stack stack) { if (stack.getDatalakeResourceId() != null) { return sharedServiceConfigProvider.prepareDatalakeConfigs(stack); } LOGGER.debug("No Data Lake resource id has been given for stack! (crn: {})", stack.getResourceCrn()); return stack; }
Source:
public String buildAuthorizeUrl(List<String> scopes){ String scopeParameter = scopes.stream().collect(Collectors.joining(" ")); System.out.println(scopeParameter); URIBuilder builder = new URIBuilder() .setScheme("https") .setHost(domain) .setPath(authenticationUrl) .addParameter("redirect_uri", callbackURI) .addParameter("client_id", clientId) .addParameter("scope", scopeParameter) .addParameter("response_type", "code"); return builder.toString(); }

Target:
public String buildAuthorizeUrl(List<String> scopes) { String scopeParameter = String.join("+", scopes); UriComponents uri = UriComponentsBuilder.newInstance() .scheme("https") .host(domain) .path(authenticationUrl) .queryParam("redirect_uri", callbackURI) .queryParam("client_id", clientId) .queryParam("scope", scopeParameter) .queryParam("response_type", "code") .build(); return uri.toUriString(); }
Source:
public boolean createAccountingDocumentsFromXml() { List<String> inputFileNames = batchInputFileService.listInputFileNamesWithDoneFile(accountingDocumentBatchInputFileType); LOG.info("createAccountingDocumentsFromXml: Found " + inputFileNames.size() + " files to process"); CreateAccountingDocumentLogReport logReport = new CreateAccountingDocumentLogReport(); inputFileNames.stream() .forEach(fileName -> {processAccountingDocumentFromXml(fileName, logReport);}); LOG.info("createAccountingDocumentsFromXml, files with non business rule errors: " + logReport.getFilesWithNonBusinessRuleFailures()); LOG.info("createAccountingDocumentsFromXml, files without non business rule errors: " + logReport.getFilesWithoutNonBusinessRuleFailures()); LOG.info("createAccountingDocumentsFromXml: Finished processing all pending accounting document XML files"); return logReport.getFilesWithNonBusinessRuleFailures().isEmpty(); }

Target:
public boolean createAccountingDocumentsFromXml() { List<String> inputFileNames = batchInputFileService.listInputFileNamesWithDoneFile(accountingDocumentBatchInputFileType); LOG.info("createAccountingDocumentsFromXml: Found " + inputFileNames.size() + " files to process"); CreateAccountingDocumentLogReport logReport = new CreateAccountingDocumentLogReport(); inputFileNames.stream() .forEach(fileName -> processAccountingDocumentFromXml(fileName, logReport)); LOG.info("createAccountingDocumentsFromXml, files with non business rule errors: " + logReport.getFilesWithNonBusinessRuleFailures()); LOG.info("createAccountingDocumentsFromXml, files successfully processed: " + logReport.getFilesSuccessfullyProcessed()); LOG.info("createAccountingDocumentsFromXml: Finished processing all pending accounting document XML files"); return logReport.getFilesWithNonBusinessRuleFailures().isEmpty(); }
Source:
private boolean isHeaderUnique() { final String header = getHeader(); for (final ActionCol52 col52 : presenter.getModel().getActionCols()) { if (col52.getHeader().equals(header)) { return false; } } for (CompositeColumn<?> cc : presenter.getModel().getConditions()) { for (int iChild = 0; iChild < cc.getChildColumns().size(); iChild++) { if (cc.getChildColumns().get(iChild).getHeader().equals(header)) { return false; } } } return true; }

Target:
private boolean isHeaderUnique() { final String header = getHeader(); return !plugin().getAlreadyUsedColumnHeaders().contains(header); }
Source:
private boolean rowMatchesPredicate() { if (!predicate.isPresent() || predicate.get().isAll()) { return true; } Set<ColumnHandle> predicatePushdownColumns = predicate.get().getDomains().get().keySet(); Map<ColumnHandle, NullableValue> rowMap = predicatePushdownColumns.stream() .collect(toImmutableMap( column -> column, column -> { TpchColumnHandle tpchColumnHandle = (TpchColumnHandle) column; Type type = tpchColumnHandle.getType(); TpchColumn tpchColumn = table.getColumn(tpchColumnHandle.getColumnName()); return NullableValue.of(type, getPrestoObject(tpchColumn, type)); })); TupleDomain<ColumnHandle> rowTupleDomain = TupleDomain.fromFixedValues(rowMap); return predicate.get().contains(rowTupleDomain); }

Target:
private boolean rowMatchesPredicate() { if (predicate.isAll()) { return true; } Map<ColumnHandle, NullableValue> rowMap = predicate.getDomains().get().keySet().stream() .collect(toImmutableMap( column -> column, column -> { TpchColumnHandle tpchColumnHandle = (TpchColumnHandle) column; Type type = tpchColumnHandle.getType(); TpchColumn tpchColumn = table.getColumn(tpchColumnHandle.getColumnName()); return NullableValue.of(type, getPrestoObject(tpchColumn, type)); })); TupleDomain<ColumnHandle> rowTupleDomain = TupleDomain.fromFixedValues(rowMap); return predicate.contains(rowTupleDomain); }
Source:
void handleResponse(ResponseInfo responseInfo) { DeleteRequest deleteRequest = (DeleteRequest) responseInfo.getRequest(); DeleteOperation deleteOperation = correlationIdToDeleteOperation.remove(deleteRequest.getCorrelationId()); if (deleteOperations.contains(deleteOperation)) { deleteOperation.handleResponse(responseInfo); } else { logger.trace("Received response for a request of an operation that has completed."); } }

Target:
void handleResponse(ResponseInfo responseInfo) { int correlationId = ((DeleteRequest) responseInfo.getRequest()).getCorrelationId(); DeleteOperation deleteOperation = correlationIdToDeleteOperation.remove(correlationId); if (deleteOperations.contains(deleteOperation)) { deleteOperation.handleResponse(responseInfo); if (deleteOperation.isOperationComplete()) { deleteOperations.remove(deleteOperation); onComplete(deleteOperation); } } }
Source:
public void deleteTenant(String tenantUniqueID) throws UserStoreException { try { deleteTenant(tenantUniqueID, true); } catch (UserStoreException e) { throw new UserStoreException(e); } }

Target:
public void deleteTenant(String tenantUniqueID) throws UserStoreException { Tenant tenant = this.getTenant(tenantUniqueID); if (tenant != null) { clearTenantCaches(tenant); invalidateCacheManager(tenant.getDomain()); } String sqlStmt = TenantConstants.DELETE_TENANT_BY_UUID_SQL; try (Connection dbConnection = getDBConnection()) { try (PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)) { prepStmt.setString(1, tenantUniqueID); prepStmt.executeUpdate(); dbConnection.commit(); } catch (SQLException e) { DatabaseUtil.rollBack(dbConnection); } } catch (SQLException e) { String msg = "Error in deleting the tenant with tenant unique ID " + tenantUniqueID + "."; if (log.isDebugEnabled()) { log.debug(msg, e); } throw new UserStoreException(msg, e); } }
Source:
public void setup() { this.idcIdTokenValidator = new OidcIdTokenValidator(this.registration.build()); this.headers.put("alg", JwsAlgorithms.RS256); this.claims.put(IdTokenClaimNames.ISS, "<LINK_0>"); this.claims.put(IdTokenClaimNames.SUB, "rob"); this.claims.put(IdTokenClaimNames.AUD, Collections.singletonList("client-id")); }

Target:
public void setup() { this.idTokenValidator = new OidcIdTokenValidator(this.registration.build()); this.headers.put("alg", JwsAlgorithms.RS256); this.claims.put(IdTokenClaimNames.ISS, "<LINK_0>"); this.claims.put(IdTokenClaimNames.SUB, "rob"); this.claims.put(IdTokenClaimNames.AUD, Collections.singletonList("client-id")); }
Source:
public static Type getSuperType(final Type type) { return SUPER_TYPE_MAP.computeIfAbsent(type, _type -> { if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; Type genericSuperClass = ((Class<?>) parameterizedType.getRawType()).getGenericSuperclass(); if (genericSuperClass instanceof ParameterizedType) { final Type[] superTypeArguments = getTypeArguments(genericSuperClass); final Type[] typeParameters = ((GenericDeclaration) parameterizedType.getRawType()).getTypeParameters(); int k = 0; outer: for (int i = 0; i != superTypeArguments.length; i++) { for (int j = 0; i < typeParameters.length; j++) { if (typeParameters[j].equals(superTypeArguments[i])) { superTypeArguments[i] = parameterizedType.getActualTypeArguments()[k++]; break outer; } } } return new ParameterizedType() { @Override public Type[] getActualTypeArguments() { return superTypeArguments; } @Override public Type getRawType() { return ((ParameterizedType) genericSuperClass).getRawType(); } @Override public Type getOwnerType() { return null; } }; } else { return genericSuperClass; } } else { return ((Class<?>) type).getGenericSuperclass(); } }); }

Target:
public static Type getSuperType(final Type type) { return SUPER_TYPE_MAP.computeIfAbsent(type, _type -> { if (type instanceof ParameterizedType) { final ParameterizedType parameterizedType = (ParameterizedType) type; final Type genericSuperClass = ((Class<?>) parameterizedType.getRawType()).getGenericSuperclass(); if (genericSuperClass instanceof ParameterizedType) { final Type[] superTypeArguments = getTypeArguments(genericSuperClass); final Type[] typeParameters = ((GenericDeclaration) parameterizedType.getRawType()).getTypeParameters(); int k = 0; for (int i = 0; i != superTypeArguments.length; i++) { for (int j = 0; i < typeParameters.length; j++) { if (typeParameters[j].equals(superTypeArguments[i])) { superTypeArguments[i] = parameterizedType.getActualTypeArguments()[k++]; break; } } } return createParameterizedType(((ParameterizedType) genericSuperClass).getRawType(), superTypeArguments); } else { return genericSuperClass; } } else { return ((Class<?>) type).getGenericSuperclass(); } }); }
Source:
public EntityArchetype createArchetype() { throw new UnsupportedOperationException(); }

Target:
public EntityArchetype createArchetype() { EntityArchetype.Builder builder = new SpongeEntityArchetypeBuilder(); builder.type(this.entityType); if (this.compound != null) { builder.entityData(NbtTranslator.getInstance().translate(this.compound)); } return builder.build(); }
Source:
public static void main(final String[] args) { try { final CommandLine cl = new CommandLine(); cl.registerShortNameOfClass(Parameters.Address.class); cl.registerShortNameOfClass(Parameters.Port.class); final Configuration networkConf = cl.processCommandLine(args).getBuilder().build(); final Injector injector = Tang.Factory.getTang().newInjector(networkConf); final JobCommandSender sender = injector.getInstance(JobCommandSender.class); sender.sendJobCommand(Parameters.SHUTDOWN_COMMAND, EMPTY_JOB_CONF); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public static void main(final String[] args) { try { final Injector injector = Tang.Factory.getTang().newInjector(); final CommandSender commandSender = injector.getInstance(CommandSender.class); commandSender.sendShutdownCommand(); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public void verifyFromModuleHasUserAndWikiField() { List<WebElement> List = driver.findElements(fromCommunityWikinameAndUsernameFieldsBy); for (int i = 0; i < List.size(); i++) { PageObjectLogging.log("verifyFromModuleHasUserAndWikiField", "Checking field number "+(i+1), true); scrollToElement(List.get(i)); waitForElementByElement(List.get(i)); } PageObjectLogging.log("verifyFromModuleHasUserAndWikiField", "Verify that from the community module has username field", true); }

Target:
public void verifyFromModuleHasUserAndWikiField() { for (WebElement element : fromCommunityWikinameAndUsernameFields) { scrollToElement(element); waitForElementByElement(element); } PageObjectLogging.log( "verifyFromModuleHasUserAndWikiField", "Verify that from the community module has username field", true ); }
Source:
public void dispose() { if (getAndSet(null) != null) { timed.dispose(); timed.dispose(); } }

Target:
public void dispose() { if (getAndSet(null) != null) { timed.dispose(); direct.dispose(); } }
Source:
public void attachKeyTypeValidator( final JTextComponent textComponent, final Predicate<String> dataValidation, final Consumer<Boolean> action) { DocumentListenerBuilder.attachDocumentListener( textComponent, () -> new Thread( () -> { if (!validationIsInFlight) { validationIsInFlight = true; Interruptibles.sleep(200); final String textData = textComponent.getText().trim(); final boolean valid = dataValidation.test(textData); SwingUtilities.invokeLater( () -> { action.accept(valid); validationIsInFlight = false; }); } }) .start()); }

Target:
public void attachKeyTypeValidator( final JTextComponent textComponent, final Predicate<String> dataValidation, final Consumer<Boolean> action) { DocumentListenerBuilder.attachDocumentListener( textComponent, () -> new Thread( () -> { if (validationIsInFlight.compareAndSet(false, true)) { if (!Interruptibles.sleep(200)) { validationIsInFlight.set(false); return; } validationIsInFlight.set(false); final String textData = textComponent.getText().trim(); final boolean valid = dataValidation.test(textData); SwingUtilities.invokeLater(() -> action.accept(valid)); } }) .start()); }
Source:
public int getSessionTimeout() { System.err.println("CALLING GETSESSIONTIMEOUT"); if (!isStarting()) throw new IllegalStateException(); if (!_enabled) throw new UnsupportedOperationException(); int timeout = -1; if (_sessionHandler != null) { timeout = _sessionHandler.getMaxInactiveInterval(); System.err.println("GETSESSIONTIMEOUT FROM SESSIONHANDLER = " + timeout); } return (int)TimeUnit.SECONDS.toMinutes(timeout); }

Target:
public int getSessionTimeout() { if (!isStarting()) throw new IllegalStateException(); if (!_enabled) throw new UnsupportedOperationException(); int timeout = -1; if (_sessionHandler != null) { timeout = _sessionHandler.getMaxInactiveInterval(); } return (int)TimeUnit.SECONDS.toMinutes(timeout); }
Source:
public boolean isSkipped(Plugin plugin) { PluginStats pluginStats = mapPluginStats.get(plugin.getId()); if (this.scannerParam.getMaxRuleDurationInMins() > 0 && plugin.getTimeStarted() != null) { long endtime = System.currentTimeMillis(); if (plugin.getTimeFinished() != null) { endtime = plugin.getTimeFinished().getTime(); } if (endtime - plugin.getTimeStarted().getTime() > TimeUnit.MINUTES.toMillis(this.scannerParam.getMaxRuleDurationInMins())) { return true; } } if (this.scannerParam.getMaxScanDurationInMins() > 0 && plugin.getTimeFinished() == null) { if (System.currentTimeMillis() - this.hostProcessStartTime > TimeUnit.MINUTES.toMillis(this.scannerParam.getMaxScanDurationInMins())) { return true; } } if (pluginStats == null) { return false; } return pluginStats.isSkipped(); }

Target:
public boolean isSkipped(Plugin plugin) { PluginStats pluginStats = mapPluginStats.get(plugin.getId()); if (pluginStats != null && pluginStats.isSkipped()) { return true; } if (plugin.getTimeFinished() == null && stopReason != null) { this.pluginSkipped(plugin, stopReason); return true; } else if (this.scannerParam.getMaxRuleDurationInMins() > 0 && plugin.getTimeStarted() != null) { long endtime = System.currentTimeMillis(); if (plugin.getTimeFinished() != null) { endtime = plugin.getTimeFinished().getTime(); } if (endtime - plugin.getTimeStarted().getTime() > TimeUnit.MINUTES.toMillis(this.scannerParam.getMaxRuleDurationInMins())) { this.pluginSkipped(plugin, Constant.messages.getString("ascan.progress.label.skipped.reason.maxRule")); return true; } } return false; }
Source:
public Subquery parameter(String listId, Object... values) { if (values == null || values.length == 0 || values[0] == null) { return this; } where.setToNormal(); where.setToIntersection(); where.addParameter(listId, values); return this; }

Target:
public Subquery parameter(String listId, Object... values) { if (values == null || values.length == 0 || values[0] == null) { return this; } where.setToIntersection(); where.addParameter(listId, values); return this; }
Source:
public static FirstWant fromLine(String line) throws PackProtocolException { String wantLine; Set<String> capabilities; if (line.length() > 45) { String opt = line.substring(45); if (!opt.startsWith(" ")) { throw new PackProtocolException(JGitText.get().wantNoSpaceWithCapabilities); } opt = opt.substring(1); final HashSet<String> opts = new HashSet<>( Arrays.asList(opt.split(" "))); wantLine = line.substring(0, 45); capabilities = Collections.unmodifiableSet(opts); } else { wantLine = line; capabilities = Collections.emptySet(); } return new FirstWant(wantLine, capabilities); }

Target:
public static FirstWant fromLine(String line) throws PackProtocolException { String wantLine; Set<String> capabilities; if (line.length() > 45) { String opt = line.substring(45); if (!opt.startsWith(" ")) { throw new PackProtocolException(JGitText.get().wantNoSpaceWithCapabilities); } opt = opt.substring(1); HashSet<String> opts = new HashSet<>( Arrays.asList(opt.split(" "))); wantLine = line.substring(0, 45); capabilities = Collections.unmodifiableSet(opts); } else { wantLine = line; capabilities = Collections.emptySet(); } return new FirstWant(wantLine, capabilities); }
Source:
public void sendRequestReview() throws MessagingException { if (begin("requestReview")) { final Account a = Common.getAccountCache().get(fromId); if (a == null) { body.append("A Gerrit user"); } else { final String e = a.getFullName(); body.append(e); } body.append(" has requested that you review a change\n\n"); if (changeUrl() != null) { openFooter(); body.append("To respond visit "); body.append(changeUrl()); body.append("\n"); } initInReplyToChange(); add(RecipientType.TO, reviewers); add(RecipientType.CC, extraCC); if (fromId != null) { add(RecipientType.CC, fromId); } send(); } }

Target:
public void sendRequestReview() throws MessagingException { if (begin("requestReview")) { final Account a = Common.getAccountCache().get(fromId); if (a == null || a.getFullName() == null || a.getFullName().length() == 0) { body.append("A Gerrit user"); } else { body.append(a.getFullName()); } body.append(" has requested that you review a change:\n\n"); body.append(change.getChangeId()); body.append(" - "); body.append(change.getSubject()); body.append("\n\n"); if (changeUrl() != null) { openFooter(); body.append("To respond visit "); body.append(changeUrl()); body.append("\n"); } initInReplyToChange(); add(RecipientType.TO, reviewers); add(RecipientType.CC, extraCC); if (fromId != null) { add(RecipientType.CC, fromId); } send(); } }
Source:
public void populateDAG(DAG dag, Configuration conf) { AddDataGenerator dataGenerator = dag.addOperator("dataGenerator", new AddDataGenerator()); CsvParser parserOperator = dag.addOperator("csvParser", new CsvParser()); ConsoleOutputOperator consoleOperator = dag.addOperator("dataconsole", new ConsoleOutputOperator()); ConsoleOutputOperator errorConsoleOperator = dag.addOperator("errorConsole", new ConsoleOutputOperator()); dag.addStream("inputData", dataGenerator.out, parserOperator.in); dag.addStream("parsedData", parserOperator.parsedOutput, consoleOperator.input); dag.addStream("errorData", parserOperator.err, errorConsoleOperator.input); }

Target:
public void populateDAG(DAG dag, Configuration conf) { AdDataGenerator dataGenerator = dag.addOperator("dataGenerator", new AdDataGenerator()); CsvParser parserOperator = dag.addOperator("csvParser", new CsvParser()); FileOutputOperator dataOutput = dag.addOperator("dataOutput", new FileOutputOperator()); FileOutputOperator errorOutput = dag.addOperator("errorOutput", new FileOutputOperator()); ConsoleOutputOperator consoleOutput = dag.addOperator("consoleOutput", new ConsoleOutputOperator()); dag.addStream("inputData", dataGenerator.out, parserOperator.in); dag.addStream("parsedData", parserOperator.parsedOutput, dataOutput.input); dag.addStream("errorData", parserOperator.err, errorOutput.input); dag.addStream("pojoData", parserOperator.out, consoleOutput.input); }
Source:
public long getBufferedSize() { if (fellBackAlready) { return currentWriter.getBufferedSize(); } final long dictEncodedByteSize = initialWriter.getBufferedSize(); final double utilization = initialWriter.getUtilization(); long weightedSize; if (utilization < UTILIZATION_THRESHOLD) { weightedSize = dictEncodedByteSize; } else { final double weight_for_raw_size = (utilization - UTILIZATION_THRESHOLD) / (1 - UTILIZATION_THRESHOLD); weightedSize = (long) (weight_for_raw_size * rawDataByteSize + (1 - weight_for_raw_size) * dictEncodedByteSize); } LOG.debug("utilization = {}, dictEncodedByteSize = {}, rawDataByteSize = {}, weightedSize = {}", utilization, dictEncodedByteSize, rawDataByteSize, weightedSize); return weightedSize; }

Target:
public long getBufferedSize() { if (fellBackAlready) { return currentWriter.getBufferedSize(); } final long dictEncodedByteSize = initialWriter.getBufferedSize(); final double utilization = initialWriter.getUtilization(); long weightedSize; if (utilization < UTILIZATION_THRESHOLD) { weightedSize = dictEncodedByteSize; } else { final double weightForRawSize = (utilization - UTILIZATION_THRESHOLD) / (1 - UTILIZATION_THRESHOLD); weightedSize = (long) (weightForRawSize * rawDataByteSize + (1 - weightForRawSize) * dictEncodedByteSize); } LOG.debug("utilization = {}, dictEncodedByteSize = {}, rawDataByteSize = {}, weightedSize = {}", utilization, dictEncodedByteSize, rawDataByteSize, weightedSize); return weightedSize; }
Source:
public long countProjectsByFilter(final Map<ProgramFilters, Object> filters) throws MiddlewareException { try { Criteria criteria = this.getSession().createCriteria(Project.class); for (Map.Entry<ProgramFilters, Object> entry : filters.entrySet()) { ProgramFilters filter = entry.getKey(); Object value = entry.getValue(); criteria.add(Restrictions.eq(filter.getStatement(), value)); } return criteria.list().size(); } catch (HibernateException e) { throw new MiddlewareException("Error in countProjectsByFilter(): " + e.getMessage(), e); } }

Target:
public long countProjectsByFilter(final Map<ProgramFilters, Object> filters) throws MiddlewareException { try { final Criteria criteria = this.getSession().createCriteria(Project.class); for (Map.Entry<ProgramFilters, Object> entry : filters.entrySet()) { final ProgramFilters filter = entry.getKey(); final Object value = entry.getValue(); criteria.add(Restrictions.eq(filter.getStatement(), value)); } return criteria.list().size(); } catch (HibernateException e) { throw new MiddlewareException("Error in countProjectsByFilter(): " + e.getMessage(), e); } }
Source:
protected boolean canDoAction() { VDS vds = getVds(); if (vds == null) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); return false; } if (!ObjectIdentityChecker.CanUpdateField(vds, "vds_group_id", vds.getstatus())) { addCanDoActionMessage(VdcBllMessages.VDS_STATUS_NOT_VALID_FOR_UPDATE); return false; } if (getTargetCluster() == null) { addCanDoActionMessage(VdcBllMessages.VDS_CLUSTER_IS_NOT_VALID); return false; } if (getVdsGroup().getstorage_pool_id() != null && !getVdsGroup().getstorage_pool_id().equals(getTargetCluster().getId()) && reachedMaxNumOfVdsInPool(getTargetCluster().getId().getValue())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXCEEDED_MAXIMUM_NUMBER_OF_HOSTS_IN_DATA_CENTER); return false; } targetStoragePool = DbFacade.getInstance().getStoragePoolDAO().getForVdsGroup(getTargetCluster().getId()); if (targetStoragePool != null && targetStoragePool.getstorage_pool_type() == StorageType.LOCALFS) { if (!DbFacade.getInstance().getVdsStaticDAO().getAllForVdsGroup(getParameters().getClusterId()).isEmpty()) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_ADD_MORE_THEN_ONE_HOST_TO_LOCAL_STORAGE); return false; } } if (getVdsGroup().supportsGlusterService()) { if (getGlusterUtils().hasBricks(getSourceCluster().getId())) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_REMOVE_HOST_HAVING_GLUSTER_VOLUME); return false; } if (!hasUpServer(getSourceCluster())) { return false; } } if (getTargetCluster().supportsGlusterService() && !hasUpServer(getTargetCluster())) { return false; } return true; }

Target:
protected boolean canDoAction() { VDS vds = getVds(); if (vds == null) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); return false; } if (!ObjectIdentityChecker.CanUpdateField(vds, "vds_group_id", vds.getstatus())) { addCanDoActionMessage(VdcBllMessages.VDS_STATUS_NOT_VALID_FOR_UPDATE); return false; } if (getTargetCluster() == null) { addCanDoActionMessage(VdcBllMessages.VDS_CLUSTER_IS_NOT_VALID); return false; } targetStoragePool = DbFacade.getInstance().getStoragePoolDAO().getForVdsGroup(getTargetCluster().getId()); if (targetStoragePool != null && targetStoragePool.getstorage_pool_type() == StorageType.LOCALFS) { if (!DbFacade.getInstance().getVdsStaticDAO().getAllForVdsGroup(getParameters().getClusterId()).isEmpty()) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_ADD_MORE_THEN_ONE_HOST_TO_LOCAL_STORAGE); return false; } } if (getVdsGroup().getstorage_pool_id() != null && !getVdsGroup().getstorage_pool_id().equals(getTargetCluster().getId()) && reachedMaxNumOfVdsInPool(getTargetCluster().getId().getValue())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXCEEDED_MAXIMUM_NUMBER_OF_HOSTS_IN_DATA_CENTER); return false; } if (getVdsGroup().supportsGlusterService()) { if (getGlusterUtils().hasBricks(getSourceCluster().getId())) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_REMOVE_HOST_HAVING_GLUSTER_VOLUME); return false; } if (!hasUpServer(getSourceCluster())) { return false; } } if (getTargetCluster().supportsGlusterService() && !hasUpServer(getTargetCluster())) { return false; } return true; }
Source:
public void visitFunctionCall(FunctionCallTree tree) { if (isSetCookie(tree) && httpOnlySetToFalse(tree)) { if (tree.arguments().size() > HTTP_ONLY_PARAMETER_INDEX) { context().newIssue(this, tree.callee(), MESSAGE).secondary(tree.arguments().get(HTTP_ONLY_PARAMETER_INDEX), null); } else if(tree.arguments().size() != 3) { context().newIssue(this, tree.callee(), MESSAGE); } } super.visitFunctionCall(tree); }

Target:
public void visitFunctionCall(FunctionCallTree tree) { if (isSetCookie(tree)) { if (tree.arguments().size() > HTTP_ONLY_PARAMETER_INDEX) { ExpressionTree httpOnlyArgument = tree.arguments().get(HTTP_ONLY_PARAMETER_INDEX); if (httpOnlyArgument.is(Kind.BOOLEAN_LITERAL) && isFalseValue(httpOnlyArgument)) { context().newIssue(this, tree.callee(), MESSAGE).secondary(tree.arguments().get(HTTP_ONLY_PARAMETER_INDEX), null); } } else if (tree.arguments().size() != 3) { context().newIssue(this, tree.callee(), MESSAGE); } } super.visitFunctionCall(tree); }
Source:
private void onPreview() { Snapshot snapshot = getSelectedItem(); if (snapshot == null) { cancel(); return; } VM vm = getEntity(); SnapshotModel snapshotModel = (SnapshotModel) getWindow(); boolean memory = false; List<DiskImage> disks; Set<Guid> diskImages = new HashSet<>(); if (snapshotModel.isShowPartialSnapshotWarning()) { switch (snapshotModel.getPartialPreviewSnapshotOptions().getSelectedItem()) { case preserveActiveDisks: disks = snapshotModel.getDisks(); disks.addAll(imagesSubtract(getVmDisks(), disks)); diskImages = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); break; case excludeActiveDisks: break; case openCustomPreviewDialog: setWindow(null); getCustomPreviewCommand().execute(); return; } } if (snapshotModel.isShowMemorySnapshotWarning()) { memory = snapshotModel.getMemory().getEntity(); } runTryBackToAllSnapshotsOfVm(snapshotModel, vm, snapshot, memory, diskImages); }

Target:
private void onPreview() { Snapshot snapshot = getSelectedItem(); if (snapshot == null) { cancel(); return; } VM vm = getEntity(); SnapshotModel snapshotModel = (SnapshotModel) getWindow(); boolean memory = false; List<DiskImage> disks; Set<Guid> diskImages = null; if (snapshotModel.isShowPartialSnapshotWarning()) { switch (snapshotModel.getPartialPreviewSnapshotOptions().getSelectedItem()) { case preserveActiveDisks: disks = snapshotModel.getDisks(); disks.addAll(imagesSubtract(getVmDisks(), disks)); diskImages = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); break; case excludeActiveDisks: break; case openCustomPreviewDialog: setWindow(null); getCustomPreviewCommand().execute(); return; } } if (snapshotModel.isShowMemorySnapshotWarning()) { memory = snapshotModel.getMemory().getEntity(); } runTryBackToAllSnapshotsOfVm(snapshotModel, vm, snapshot, memory, diskImages); }
Source:
public boolean setConfig(Configuration conf) { boolean success = false; try { for(int i=0; i<this.publishers.length; i++) { success |= this.publishers[i].setConfig(conf); if(success) LOG.info("Successfully loaded " + this.publishers[i].getClass().getName() +" publisher"); } }catch(Exception e) { LOG.warn("Error while loading publishers : " + e.getMessage()); } if(!success) { LOG.warn("Could not load any publishers out of " + this.publishers.length +" publishers"); } return success; }

Target:
public boolean setConfig(Configuration conf) { boolean success = false; try { for(int i=0; i<this.publishers.length; i++) { success |= this.publishers[i].setConfig(conf); if(success) LOG.info("Successfully loaded publisher", this.publishers[i].getClass().getName()); } }catch(Exception e) { LOG.warn("Error while loading publishers : {}", e.getMessage()); } if(!success) { LOG.warn("Could not load any publishers out of publishers", this.publishers.length); } return success; }
Source:
private boolean updateMetadataForIndex(final String indexName, final long lastSequence) { boolean success; Future<Boolean> result = queue.submit(new Callable<Boolean>() { @Override public Boolean call() { boolean updateSuccess = true; ContentValues v = new ContentValues(); v.put("last_sequence", lastSequence); int row = database.update(IndexManager.INDEX_METADATA_TABLE_NAME, v, " index_name = ? ", new String[]{ indexName }); if (row <= 0) { updateSuccess = false; } return updateSuccess; } }); try { success = result.get(); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Execution error encountered:", e); success = false; } catch (InterruptedException e) { logger.log(Level.SEVERE, "Execution interrupted error encountered:", e); success = false; } return success; }

Target:
private boolean updateMetadataForIndex(final String indexName, final long lastSequence) { Future<Boolean> result = queue.submit(new Callable<Boolean>() { @Override public Boolean call() { boolean updateSuccess = true; ContentValues v = new ContentValues(); v.put("last_sequence", lastSequence); int row = database.update(IndexManager.INDEX_METADATA_TABLE_NAME, v, " index_name = ? ", new String[]{ indexName }); if (row <= 0) { updateSuccess = false; } return updateSuccess; } }); boolean success; try { success = result.get(); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Execution error encountered:", e); success = false; } catch (InterruptedException e) { logger.log(Level.SEVERE, "Execution interrupted error encountered:", e); success = false; } return success; }
Source:
public void setupExecutor() { if (m_executor!=null) { return; } synchronized(m_executorLock) { exportLog.info("Activating ExportDataSource gen " + m_generation + " table " + m_tableName + " partition " + m_partitionId + "FirstAction: " + (m_firstAction != null ? "true" : "false")); if (m_executor==null) { ListeningExecutorService es = CoreUtils.getListeningExecutorService( "ExportDataSource gen " + m_generation + " table " + m_tableName + " partition " + m_partitionId, 1); if (m_firstAction != null) { exportLog.info("Submitting truncate task for ExportDataSource gen " + m_generation + " table " + m_tableName + " partition " + m_partitionId); es.submit(m_firstAction); } if (m_queuedActions.size()>0) { for (RunnableWithES queuedR : m_queuedActions) { queuedR.setExecutorService(es); es.submit(queuedR); } m_queuedActions.clear(); } m_executor = es; } } }

Target:
public void setupExecutor() { if (m_executor!=null) { return; } synchronized(m_executorLock) { if (exportLog.isDebugEnabled()) { exportLog.debug("Activating ExportDataSource gen " + m_generation + " table " + m_tableName + " partition " + m_partitionId + "FirstAction: " + (m_firstAction != null ? "true" : "false")); } if (m_executor==null) { ListeningExecutorService es = CoreUtils.getListeningExecutorService( "ExportDataSource gen " + m_generation + " table " + m_tableName + " partition " + m_partitionId, 1); if (m_firstAction != null) { exportLog.info("Submitting truncate task for ExportDataSource gen " + m_generation + " table " + m_tableName + " partition " + m_partitionId); es.submit(m_firstAction); } if (m_queuedActions.size()>0) { for (RunnableWithES queuedR : m_queuedActions) { queuedR.setExecutorService(es); es.submit(queuedR); } m_queuedActions.clear(); } m_executor = es; } } }
Source:
private void computeResultsForLiteral(Literal literal, List<String> columnNames, List<DataSchema.ColumnDataType> columnTypes, List<Object> row) { Object fieldValue = literal.getFieldValue(); columnNames.add(fieldValue.toString()); switch (literal.getSetField()) { case SHORT_VALUE: columnTypes.add(DataSchema.ColumnDataType.INT); row.add((int) literal.getShortValue()); break; case INT_VALUE: columnTypes.add(DataSchema.ColumnDataType.INT); row.add(literal.getIntValue()); break; case LONG_VALUE: columnTypes.add(DataSchema.ColumnDataType.LONG); row.add(literal.getLongValue()); break; case DOUBLE_VALUE: columnTypes.add(DataSchema.ColumnDataType.DOUBLE); row.add(literal.getDoubleValue()); break; case BOOL_VALUE: columnTypes.add(DataSchema.ColumnDataType.STRING); row.add(new Boolean(literal.getBoolValue()).toString()); break; case STRING_VALUE: columnTypes.add(DataSchema.ColumnDataType.STRING); System.out.println("literal.getStringValue() = " + literal.getStringValue()); row.add(literal.getStringValue()); break; case BINARY_VALUE: columnTypes.add(DataSchema.ColumnDataType.BYTES); row.add(BytesUtils.toHexString(literal.getBinaryValue())); break; case BYTE_VALUE: columnTypes.add(DataSchema.ColumnDataType.BYTES); row.add(BytesUtils.toHexString(new byte[]{literal.getByteValue()})); break; } }

Target:
private void computeResultsForLiteral(Literal literal, List<String> columnNames, List<DataSchema.ColumnDataType> columnTypes, List<Object> row) { Object fieldValue = literal.getFieldValue(); columnNames.add(fieldValue.toString()); switch (literal.getSetField()) { case BOOL_VALUE: columnTypes.add(DataSchema.ColumnDataType.STRING); row.add(new Boolean(literal.getBoolValue()).toString()); break; case BYTE_VALUE: columnTypes.add(DataSchema.ColumnDataType.INT); row.add((int)literal.getByteValue()); break; case SHORT_VALUE: columnTypes.add(DataSchema.ColumnDataType.INT); row.add((int) literal.getShortValue()); break; case INT_VALUE: columnTypes.add(DataSchema.ColumnDataType.INT); row.add(literal.getIntValue()); break; case LONG_VALUE: columnTypes.add(DataSchema.ColumnDataType.LONG); row.add(literal.getLongValue()); break; case DOUBLE_VALUE: columnTypes.add(DataSchema.ColumnDataType.DOUBLE); row.add(literal.getDoubleValue()); break; case STRING_VALUE: columnTypes.add(DataSchema.ColumnDataType.STRING); row.add(literal.getStringValue()); break; case BINARY_VALUE: columnTypes.add(DataSchema.ColumnDataType.BYTES); row.add(BytesUtils.toHexString(literal.getBinaryValue())); break; } }
Source:
private void createPOJO(TypeDeclarationDescr typeDescr) { SafeTypeResolver typeResolver = new SafeTypeResolver(pkg.getTypeResolver()); DescrTypeDefinition descrDeclaredTypeDefinition = new DescrTypeDefinition(packageDescr, typeDescr, typeResolver); descrDeclaredTypeDefinition.getErrors().forEach(builder::addBuilderResult); ClassOrInterfaceDeclaration generatedClass = new GeneratedClassDeclaration(descrDeclaredTypeDefinition, Arrays.asList(GeneratedFact.class, AccessibleFact.class)) .toClassDeclaration(); packageModel.addGeneratedPOJO(generatedClass); addTypeMetadata(typeDescr.getTypeName()); }

Target:
private void createPOJO(TypeDeclarationDescr typeDescr) { SafeTypeResolver typeResolver = new SafeTypeResolver(pkg.getTypeResolver()); DescrTypeDefinition descrDeclaredTypeDefinition = new DescrTypeDefinition(packageDescr, typeDescr, typeResolver); descrDeclaredTypeDefinition.getErrors().forEach(builder::addBuilderResult); ClassOrInterfaceDeclaration generatedClass = new GeneratedClassDeclaration(descrDeclaredTypeDefinition, MARKER_INTERFACES) .toClassDeclaration(); packageModel.addGeneratedPOJO(generatedClass); addTypeMetadata(typeDescr.getTypeName()); }
Source:
public SecurityKey build() { final SecurityKey securityKey = new SecurityKey(this.dlmsDevice, this.securityKeyType, this.key, this.validFrom, this.validTo); securityKey.setVersion(this.version); securityKey.setValidFrom(this.validFrom); if (this.validTo != null) { securityKey.setValidTo(this.validTo); } return securityKey; }

Target:
public SecurityKey build() { final SecurityKey securityKey = new SecurityKey(this.dlmsDevice, this.securityKeyType, this.key, this.validFrom, this.validTo); securityKey.setVersion(this.version); securityKey.setValidFrom(this.validFrom); securityKey.setValidTo(this.validTo); return securityKey; }