auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static <T> List<Field> build(Class<T> modelClass) { ClientLogger logger = new ClientLogger(FieldBuilder.class); java.lang.reflect.Field[] fields = modelClass.getFields(); List<Field> searchFieldList = new ArrayList<>(); for (java.lang.reflect.Field field: fields) { Annotation[] annotations = field.getAnnotations(); for (Annotation annotation : annotations) { if (annotation instanceof FieldIgnore) { continue; } Field searchField = new Field(); searchField.setName(field.getName()); searchField.setType(covertToDataType(field, logger)); if (annotation instanceof SimpleFieldProperty) { buildSimpleField(searchField, (SimpleFieldProperty) annotation); searchFieldList.add(searchField); } else if (annotation instanceof SearchableFieldProperty) { buildSearchableField(searchField, (SearchableFieldProperty) annotation); searchFieldList.add(searchField); } else if (annotation instanceof FieldProperty) { buildField(searchField, (FieldProperty) annotation); searchFieldList.add(searchField); } logger.info("The property is not a search field.", field.getName()); } } return searchFieldList; }

Target:
public static <T> List<Field> build(Class<T> modelClass) { ClientLogger logger = new ClientLogger(FieldBuilder.class); return build(modelClass, new Stack<>(), logger); }
Source:
public void each(MatrixProcedure procedure) { int l = 0; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { if (j == columnIndices[l]) { procedure.apply(i,j,values[l++]); } else { procedure.apply(i,j,0); } } } }

Target:
public void each(MatrixProcedure procedure) { int k = 0; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { if (j == columnIndices[k]) { procedure.apply(i, j, values[k]); k++; } else { procedure.apply(i, j, 0); } } } }
Source:
protected String inferRootUrl() { if (isProtocolEnabled("https")) { Integer port = getHttpsPort(); checkNotNull(port, "HTTPS_PORT sensors not set; is an acceptable port available?"); return String.format("https://%s:%s/", getHostname(), port); } else if (isProtocolEnabled("http")) { Integer port = getHttpPort(); checkNotNull(port, "HTTP_PORT sensors not set; is an acceptable port available?"); return String.format("http://%s:%s/", getHostname(), port); } else { throw new IllegalStateException("HTTP and HTTPS protocols not enabled for "+entity+"; enabled protocols are "+getEnabledProtocols()); } }

Target:
protected String inferRootUrl() { if (isProtocolEnabled("https")) { Integer port = getHttpsPort(); checkNotNull(port, "HTTPS_PORT sensors not set; is an acceptable port available?"); HostAndPort accessibleAddress = BrooklynAccessUtils.getBrooklynAccessibleAddress(getEntity(), port); return String.format("https://%s:%s/", accessibleAddress.getHostText(), accessibleAddress.getPort()); } else if (isProtocolEnabled("http")) { Integer port = getHttpPort(); checkNotNull(port, "HTTP_PORT sensors not set; is an acceptable port available?"); HostAndPort accessibleAddress = BrooklynAccessUtils.getBrooklynAccessibleAddress(getEntity(), port); return String.format("http://%s:%s/", accessibleAddress.getHostText(), accessibleAddress.getPort()); } else { throw new IllegalStateException("HTTP and HTTPS protocols not enabled for "+entity+"; enabled protocols are "+getEnabledProtocols()); } }
Source:
public static void validateTrue(final boolean condition, final String msg) { if (!condition) { throw new IllegalArgumentException(msg); } }

Target:
private static void validateTrue(final boolean condition, final String msg) { if (!condition) { throw new IllegalArgumentException(msg); } }
Source:
public boolean isArrayType() { return isArray(); }

Target:
public boolean isArrayType() { return getArrayDepth() > 0; }
Source:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vm_name", "description", "domain", "os", "osType", "creation_date", "num_of_monitors", "allowConsoleReconnect", "usb_policy", "is_auto_suspend", "auto_startup", "dedicated_vm_for_vds", "default_display_type", "priority", "default_boot_sequence", "initrd_url", "kernel_url", "kernel_params", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled","deleteProtected","db_generation", "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties" })); }

Target:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vm_name", "description", "domain", "os", "osType", "creation_date", "num_of_monitors", "allowConsoleReconnect", "usb_policy", "is_auto_suspend", "auto_startup", "dedicated_vm_for_vds", "default_display_type", "priority", "default_boot_sequence", "initrd_url", "kernel_url", "kernel_params", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled","deleteProtected","dbGeneration", "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties" })); }
Source:
private void setAppropriateView() { Log.v("Allergon", "Count " + mRvAllergens.getAdapter().getItemCount()); if (mEmptyMessageView != null && mRvAllergens.getAdapter() != null) { boolean isListEmpty = mRvAllergens.getAdapter().getItemCount() == 0; mEmptyMessageView.setVisibility(isListEmpty ? View.VISIBLE : View.GONE); mRvAllergens.setVisibility(isListEmpty ? View.GONE : View.VISIBLE); } }

Target:
private void setAppropriateView() { if (mEmptyMessageView != null && mAdapter != null) { boolean isListEmpty = mAdapter.getItemCount() == 0; mEmptyMessageView.setVisibility(isListEmpty ? View.VISIBLE : View.GONE); mRvAllergens.setVisibility(isListEmpty ? View.GONE : View.VISIBLE); } }
Source:
private List<String> filterContent(List<String> contentLines) { ImmutableList.Builder<String> result = ImmutableList.builder(); for (int i = 0; i < contentLines.size(); i++) { String line = contentLines.get(i); if (isSpecialLine(line) || isBlank(line)) { continue; } while (line.endsWith(LINE_ESCAPE)) { checkState(i + 1 < contentLines.size(), "There no more lines, while the end of the line was escaped"); line = line.substring(0, line.length() - 1) + "\n" + contentLines.get(++i); } result.add(unescapeLine(line)); } return result.build(); }

Target:
private List<String> filterContent(List<String> contentLines) { return contentLines.stream() .filter(s -> !(isSpecialLine(s) || isBlank(s))) .map(AnnotatedFileParser::unescapeLine) .map(line -> line.replace(NEW_LINE_LITERAL, "\n")) .collect(toList()); }
Source:
public void setupNotificationChannel(Context context, String id, String name) { Timber.i("Creating notification channel with id/name: %s/%s",id, name); NotificationManager manager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel mNotificationChannel = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_DEFAULT); mNotificationChannel.setShowBadge(true); mNotificationChannel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PUBLIC); manager.createNotificationChannel(mNotificationChannel); }

Target:
public void setupNotificationChannel(Context context, String id, String name) { Timber.i("Creating notification channel with id/name: %s/%s",id, name); NotificationManager manager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel notificationChannel = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_DEFAULT); notificationChannel.setShowBadge(true); notificationChannel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PUBLIC); manager.createNotificationChannel(notificationChannel); }
Source:
public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final String cqueryStatusFieldId = "org.eclipse.lsp4e.cpp.status"; final int width = 28; IWorkbenchWindow[] Workbenchwindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow window : Workbenchwindows) { StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager(); if (statusLine.find(cqueryStatusFieldId) != null) { statusLine.remove(cqueryStatusFieldId); } StatusLineContributionItem cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width); statusLine.add(cqueryStatusField); String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs()) : Messages.CqueryStateIdle; cqueryStatusField.setText(msg); } } }); }

Target:
public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final String cqueryStatusFieldId = "org.eclipse.lsp4e.cpp.status"; final int width = 28; StatusLineContributionItem cqueryStatusField; IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow window : workbenchWindows) { StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager(); if (statusLine.find(cqueryStatusFieldId) != null) { cqueryStatusField = (StatusLineContributionItem) statusLine.find(cqueryStatusFieldId); } else { cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width); statusLine.add(cqueryStatusField); } String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs()) : Messages.CqueryStateIdle; cqueryStatusField.setText(msg); } } }); }
Source:
private boolean isGetClassOnArgument(ExpressionTree tree) { ExpressionTree expressionTree = removeParenthesis(tree); if (expressionTree.is(Tree.Kind.METHOD_INVOCATION)) { ExpressionTree methodSelect = ((MethodInvocationTree) expressionTree).methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { ExpressionTree expression = ((MemberSelectExpressionTree) methodSelect).expression(); return isArgument(expression); } } return false; }

Target:
private boolean isGetClassOnArgument(ExpressionTree tree) { ExpressionTree expressionTree = removeParenthesis(tree); if (expressionTree.is(Tree.Kind.METHOD_INVOCATION) && GETCLASS_MATCHER.matches((MethodInvocationTree) expressionTree)) { ExpressionTree methodSelect = ((MethodInvocationTree) expressionTree).methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { ExpressionTree expression = ((MemberSelectExpressionTree) methodSelect).expression(); return isArgument(expression); } } return false; }
Source:
public static long sumHistogramEntries(HistogramMetric histogram) { return LongStream.of(histogram.value()).reduce(Long::sum).orElse(0); }

Target:
public static long sumHistogramEntries(HistogramMetric histogram) { if (histogram == null) return 0; long sum = 0; for (int i = 0; i < histogram.value().length; ++i) sum += histogram.value()[i]; return sum; }
Source:
public Hardware apply(HardwareFlavour from) { double minRamSize = (int) from.hardware().ram(); if (from.hardware().ram() < 1) { minRamSize = 0.5; } List<Volume> volumes = new ArrayList<Volume>(); for (HardwareFlavour.Hardware.Hdd hdd : from.hardware().hdds()) { Volume vol = new VolumeBuilder() .bootDevice(hdd.isMain()) .device("hdd") .type(Volume.Type.LOCAL) .size((float) hdd.size()) .build(); volumes.add(vol); } List<Processor> processors = new ArrayList<Processor>(); for (int i = 0; i < from.hardware().coresPerProcessor(); i++) { Processor proc = new Processor(from.hardware().vcore(), 1d); processors.add(proc); } final HardwareBuilder builder; builder = new HardwareBuilder() .ids(from.name()) .name(from.name()) .ram((int) (minRamSize * 1024)) .volumes(volumes) .processors(ImmutableList.copyOf(processors)); return builder.build(); }

Target:
public Hardware apply(HardwareFlavour from) { double minRamSize = (int) from.hardware().ram(); if (from.hardware().ram() < 1) { minRamSize = 0.5; } List<Volume> volumes = new ArrayList<Volume>(); for (HardwareFlavour.Hardware.Hdd hdd : from.hardware().hdds()) { Volume vol = new VolumeBuilder() .bootDevice(hdd.isMain()) .device("hdd") .type(Volume.Type.LOCAL) .size((float) hdd.size()) .build(); volumes.add(vol); } List<Processor> processors = new ArrayList<Processor>(); for (int i = 0; i < from.hardware().coresPerProcessor(); i++) { Processor proc = new Processor(from.hardware().vcore(), 1d); processors.add(proc); } final HardwareBuilder builder; builder = new HardwareBuilder() .ids(from.id()) .name(from.name()) .ram((int) (minRamSize * 1024)) .volumes(volumes) .processors(ImmutableList.copyOf(processors)); return builder.build(); }
Source:
public PullCommand setRebase(boolean useRebase) { checkCallable(); if (useRebase) { pullRebaseMode = PullRebaseMode.REBASE; } else { pullRebaseMode = PullRebaseMode.NO_REBASE; } return this; }

Target:
public PullCommand setRebase(boolean useRebase) { checkCallable(); pullRebaseMode = useRebase ? PullRebaseMode.REBASE : PullRebaseMode.NO_REBASE; return this; }
Source:
private void initMainDirectionalLight() { mainDirectionalLight.lightType = LightComponent.LightType.DIRECTIONAL; mainDirectionalLight.lightAmbientIntensity = 0.75f; mainDirectionalLight.lightDiffuseIntensity = 0.75f; }

Target:
private void initMainDirectionalLight() { mainDirectionalLight.lightType = LightComponent.LightType.DIRECTIONAL; mainDirectionalLight.lightAmbientIntensity = 0.75f; mainDirectionalLight.lightDiffuseIntensity = 0.75f; mainDirectionalLight.lightSpecularIntensity = 0.02f; mainDirectionalLight.lightSpecularPower = 100f; }
Source:
public void deleteTempFileAndFolder() { try { if ( aliasingIsActive() ) { FileObject srcFile = KettleVFS.getFileObject( temporaryFilePath, variableSpace ); srcFile.getParent().deleteAll(); } } catch ( FileSystemException | KettleFileException e ) { log.logError( e.getMessage() ); } }

Target:
public void deleteTempFileAndFolder() { try { if ( aliasingIsActive() ) { FileObject srcFile = KettleVFS.getFileObject( temporaryFilePath, variableSpace ); srcFile.getParent().deleteAll(); } } catch ( FileSystemException | KettleFileException e ) { log.logError( e.getMessage(), e ); } }
Source:
private Path writeNestedWithNullsSampleParquetFile(Configuration conf, boolean dictionaryEncoding, CompressionCodecName compression) throws IOException { File file = tempFolder.newFile(); file.delete(); Path path = new Path(file.toURI()); ParquetWriter<Group> writer = ExampleParquetWriter.builder(path) .withConf(conf) .withWriteMode(ParquetFileWriter.Mode.OVERWRITE) .withCompressionCodec(compression) .withDictionaryEncoding(dictionaryEncoding) .withType(schemaNestedWithNulls) .withPageWriteChecksumEnabled(ParquetOutputFormat.getPageWriteChecksumEnabled(conf)) .build(); GroupFactory groupFactory = new SimpleGroupFactory(schemaNestedWithNulls); Random rand = new Random(42); for (int i = 0; i < numRecordsNestedWithNullsFile; i++) { Group group = groupFactory.newGroup(); if (rand.nextDouble() > nullRatio) { if (rand.nextDouble() > 0.5) { group.addGroup("c").append("id", (long) i).addGroup("d") .append("val", rand.nextInt() % 10); } else { group.addGroup("c").append("id", (long) i).addGroup("d") .append("val", rand.nextInt() % 10) .append("val", rand.nextInt() % 10) .append("val", rand.nextInt() % 10); } } writer.write(group); } writer.close(); return path; }

Target:
private Path writeNestedWithNullsSampleParquetFile(Configuration conf, boolean dictionaryEncoding, CompressionCodecName compression) throws IOException { File file = tempFolder.newFile(); file.delete(); Path path = new Path(file.toURI()); try (ParquetWriter<Group> writer = ExampleParquetWriter.builder(path) .withConf(conf) .withWriteMode(ParquetFileWriter.Mode.OVERWRITE) .withCompressionCodec(compression) .withDictionaryEncoding(dictionaryEncoding) .withType(schemaNestedWithNulls) .withPageWriteChecksumEnabled(ParquetOutputFormat.getPageWriteChecksumEnabled(conf)) .build()) { GroupFactory groupFactory = new SimpleGroupFactory(schemaNestedWithNulls); Random rand = new Random(42); for (int i = 0; i < numRecordsNestedWithNullsFile; i++) { Group group = groupFactory.newGroup(); if (rand.nextDouble() > nullRatio) { if (rand.nextDouble() > 0.5) { group.addGroup("c").append("id", (long) i).addGroup("d") .append("val", rand.nextInt() % 10); } else { group.addGroup("c").append("id", (long) i).addGroup("d") .append("val", rand.nextInt() % 10) .append("val", rand.nextInt() % 10) .append("val", rand.nextInt() % 10); } } writer.write(group); } } return path; }
Source:
public Transition(LineAssociation link, org.eclipse.uml2.uml.Transition transition) { id = link.getId(); fromID = link.getFrom(); toID = link.getTo(); trigger = null; List<Trigger> triggers = transition.getTriggers(); if (triggers.size() > 0) { trigger = triggers.get(0).getEvent().getLabel(); } if (link.getTurns() == 0) { List<Point> points = link.getRoute(); int center = points.size() / 2; route = points.subList(center, center + 1); } else { List<Point> points = link.getMinimalRoute(); route = points.subList(1, points.size() - 1); } anchors = new ArrayList<Point>(); List<Point> points = link.getMinimalRoute(); anchors.add(points.get(0)); anchors.add(points.get(points.size() - 1)); }

Target:
public Transition(LineAssociation link, org.eclipse.uml2.uml.Transition transition) { id = link.getId(); fromID = link.getFrom(); toID = link.getTo(); trigger = null; List<Trigger> triggers = transition.getTriggers(); if (triggers.size() > 0) { trigger = triggers.get(0).getEvent().getLabel(); } }
Source:
private void show(ExtMap context, String groupName, String groupUuid, List<String> memberGroups, List<String> memberUsers) { StringBuilder builder = new StringBuilder(); builder.append("Group: ").append(groupName).append("(").append(groupUuid).append(")"); if (memberGroups.isEmpty() && memberUsers.isEmpty()) { builder.append(" is empty."); } else { builder.append(" members:\n"); } for (String user : memberUsers) { builder.append(" user: ").append(user).append("\n"); } for (String group : memberGroups) { builder.append(" group: ").append(group).append("\n"); } String output = builder.toString().trim(); addContextMessage(context, false, output); }

Target:
private void show(ExtMap context, String groupName, String groupUuid, List<String> memberGroups, List<String> memberUsers) { StringBuilder builder = new StringBuilder(); builder.append("Group: ").append(groupName).append("(").append(groupUuid).append(")"); if (memberGroups.isEmpty() && memberUsers.isEmpty()) { builder.append(" has no members."); } else { builder.append(" members:\n"); } for (String user : memberUsers) { builder.append(" User: ").append(user).append("\n"); } for (String group : memberGroups) { builder.append(" Group: ").append(group).append("\n"); } String output = builder.toString().trim(); addContextMessage(context, false, output); }
Source:
public void shouldAddAmountRateAndSum() { final MockTime time = new MockTime(0); addAmountRateAndTotalMetricsToSensor(sensor, group, tags, metricNamePrefix, description1, description2); verifyAmountRateMetric(metrics, sensor, description1, time); verifySumMetric(metrics, sensor, description2, time, 60); assertThat(metrics.metrics().size(), equalTo(2 + 1)); }

Target:
public void shouldAddAmountRateAndSum() { StreamsMetricsImpl .addRateOfSumAndSumMetricsToSensor(sensor, group, tags, metricNamePrefix, description1, description2); final double valueToRecord1 = 18.0; final double valueToRecord2 = 72.0; final long defaultWindowSizeInSeconds = Duration.ofMillis(new MetricConfig().timeWindowMs()).getSeconds(); final double expectedRateMetricValue = (valueToRecord1 + valueToRecord2) / defaultWindowSizeInSeconds; verifyMetric(metricNamePrefix + "-rate", description1, valueToRecord1, valueToRecord2, expectedRateMetricValue); final double expectedSumMetricValue = 2 * valueToRecord1 + 2 * valueToRecord2; verifyMetric(metricNamePrefix + "-total", description2, valueToRecord1, valueToRecord2, expectedSumMetricValue); assertThat(metrics.metrics().size(), equalTo(2 + 1)); }
Source:
public void checkEntryContent(ActualEntry entry, String fileContent, String indexContent) { assertEquals(fileContent, entry.file); assertEquals(indexContent, entry.index); if (entry.indexContentLength != 0) assertEquals(fileContent.length(), entry.indexContentLength); }

Target:
public void checkEntryContent(ActualEntry entry, String fileContent, String indexContent) { assertEquals(fileContent, entry.file); assertEquals(indexContent, entry.index); if (entry.indexContentLength != 0) { assertEquals(fileContent.length(), entry.indexContentLength); } }
Source:
public static int[] range(final int start, final int length) { int[] ret = new int[length]; for (int i = 0; i < length; ++i) { ret[i] = start + i; } return ret; }

Target:
public static int[] range(final int start, final int length) { return IntStream.range(start, start + length).toArray(); }
Source:
Mono<EncryptResult> encrypt(EncryptOptions encryptOptions, Context context) { Objects.requireNonNull(encryptOptions, "'encryptOptions' cannot be null."); Objects.requireNonNull(encryptOptions.getAlgorithm(), "Encryption algorithm cannot be null."); Objects.requireNonNull(encryptOptions.getPlainText(), "Plain text content to be encrypted cannot be null."); EncryptionAlgorithm algorithm = encryptOptions.getAlgorithm(); byte[] iv = encryptOptions.getIv(); byte[] authenticatedData = encryptOptions.getAdditionalAuthenticatedData(); KeyOperationParameters parameters = new KeyOperationParameters() .setAlgorithm(algorithm) .setValue(encryptOptions.getPlainText()) .setIv(iv) .setAdditionalAuthenticatedData(authenticatedData); context = context == null ? Context.NONE : context; return service.encrypt(vaultUrl, keyName, version, apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Encrypting content with algorithm - {}", algorithm.toString())) .doOnSuccess(response -> logger.info("Retrieved encrypted content with algorithm- {}", algorithm.toString())) .doOnError(error -> logger.warning("Failed to encrypt content with algorithm - {}", algorithm.toString(), error)) .flatMap(keyOperationResultResponse -> Mono.just(new EncryptResult(keyOperationResultResponse.getValue().getResult(), algorithm, keyId))); }

Target:
Mono<EncryptResult> encrypt(EncryptOptions encryptOptions, Context context) { Objects.requireNonNull(encryptOptions, "'encryptOptions' cannot be null."); EncryptionAlgorithm algorithm = encryptOptions.getAlgorithm(); byte[] iv = encryptOptions.getIv(); byte[] authenticatedData = encryptOptions.getAdditionalAuthenticatedData(); KeyOperationParameters parameters = new KeyOperationParameters() .setAlgorithm(algorithm) .setValue(encryptOptions.getPlaintext()) .setIv(iv) .setAdditionalAuthenticatedData(authenticatedData); context = context == null ? Context.NONE : context; return service.encrypt(vaultUrl, keyName, version, apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Encrypting content with algorithm - {}", algorithm.toString())) .doOnSuccess(response -> logger.info("Retrieved encrypted content with algorithm- {}", algorithm.toString())) .doOnError(error -> logger.warning("Failed to encrypt content with algorithm - {}", algorithm.toString(), error)) .flatMap(keyOperationResultResponse -> Mono.just(new EncryptResult(keyOperationResultResponse.getValue().getResult(), algorithm, keyId))); }
Source:
public void should_buildQueryExpressionModel_return_QueryExpressionModel_from_bom() throws Exception { final QueryExpressionModel model = queryExpressionProvider.buildQueryExpressionModel(); assertThat(model).isNotNull(); assertThat(model.getBusinessObjects()).hasSize(1); final BusinessObjectExpressionQuery businessObjectExpressionQuery = model.getBusinessObjects().get(0); assertThat(businessObjectExpressionQuery.getQualifiedName()).isEqualTo("org.bonita.Employee"); assertThat(businessObjectExpressionQuery.getQueryExpressions()).extracting("name").contains("Employee.find", "Employee.findByEmployeeId", "Employee.findByPersistenceId"); for (final Expression exp : businessObjectExpressionQuery.getQueryExpressions()) { ExpressionAssert.assertThat(exp).hasType(queryExpressionProvider.getExpressionType()); assertThat(exp.getName()).isNotEmpty(); assertThat(exp.getContent()).isNotEmpty(); assertThat(exp.getType()).isNotEmpty(); assertThat(exp.getReferencedElements()).isNotEmpty(); } }

Target:
public void should_buildQueryExpressionModel_return_QueryExpressionModel_from_bom() throws Exception { final QueryExpressionModel model = queryExpressionProvider.buildQueryExpressionModel(); assertThat(model).isNotNull(); assertThat(model.getBusinessObjects()).hasSize(1); final BusinessObjectExpressionQuery businessObjectExpressionQuery = model.getBusinessObjects().get(0); assertThat(businessObjectExpressionQuery.getQualifiedName()).isEqualTo("org.bonita.Employee"); assertThat(businessObjectExpressionQuery.getQueryExpressions()).extracting("name").containsOnly("Employee.find", "Employee.findByEmployeeId", "Employee.findByPersistenceId"); for (final Expression exp : businessObjectExpressionQuery.getQueryExpressions()) { ExpressionAssert.assertThat(exp).hasType(queryExpressionProvider.getExpressionType()); assertThat(exp.getName()).isNotEmpty(); assertThat(exp.getContent()).isNotEmpty(); assertThat(exp.getType()).isNotEmpty(); assertThat(exp.getReferencedElements()).isNotEmpty(); } }
Source:
@Override public void run() { List<String> listOptions = listActionConfig.listType; if (listOptions == null) { try { printing.printAllSanitizedSecrets(keywhizClient.allSecrets()); } catch (IOException e) { throw Throwables.propagate(e); } return; } List<String> options = Arrays.asList(listOptions.get(0).split(",")); String firstOption = options.get(0).toLowerCase().trim(); try { switch (firstOption) { case "groups": printing.printAllGroups(keywhizClient.allGroups()); break; case "clients": printing.printAllClients(keywhizClient.allClients()); break; case "secrets": if (listActionConfig.idx == null && listActionConfig.num == null) { printing.printAllSanitizedSecrets(keywhizClient.allSecrets()); } else if (listActionConfig.idx != null && listActionConfig.num != null) { if (listActionConfig.idx < 0 || listActionConfig.num < 0) { throw new AssertionError("Both idx and num must be positive for batched secret queries"); } printing.printAllSanitizedSecrets(keywhizClient.allSecretsBatched(listActionConfig.idx, listActionConfig.num)); } else { throw new AssertionError("Both idx and num must be provided for batched secret queries"); } break; default: throw new AssertionError("Invalid list option: " + firstOption); } } catch(IOException e) { throw Throwables.propagate(e); } }

Target:
@Override public void run() { List<String> listOptions = listActionConfig.listType; if (listOptions == null) { try { printing.printAllSanitizedSecrets(keywhizClient.allSecrets()); } catch (IOException e) { throw Throwables.propagate(e); } return; } List<String> options = Arrays.asList(listOptions.get(0).split(",")); String firstOption = options.get(0).toLowerCase().trim(); try { switch (firstOption) { case "groups": printing.printAllGroups(keywhizClient.allGroups()); break; case "clients": printing.printAllClients(keywhizClient.allClients()); break; case "secrets": if (listActionConfig.idx == null && listActionConfig.num == null) { printing.printAllSanitizedSecrets(keywhizClient.allSecrets()); } else if (listActionConfig.idx != null && listActionConfig.num != null) { checkArgument(listActionConfig.idx >= 0); checkArgument(listActionConfig.num >= 0); if (listActionConfig.newestFirst == null) { printing.printAllSanitizedSecrets(keywhizClient.allSecretsBatched(listActionConfig.idx, listActionConfig.num, true)); } else { printing.printAllSanitizedSecrets(keywhizClient.allSecretsBatched(listActionConfig.idx, listActionConfig.num, listActionConfig.newestFirst)); } } else { throw new AssertionError("Both idx and num must be provided for batched secret queries"); } break; default: throw new AssertionError("Invalid list option: " + firstOption); } } catch(IOException e) { throw Throwables.propagate(e); } }
Source:
public void prunePacked() throws IOException { ObjectDirectory objdb = repo.getObjectDatabase(); Collection<PackFile> packs = objdb.getPacks(); File objects = repo.getObjectsDirectory(); String[] fanout = objects.list(); if (fanout != null && fanout.length > 0) { pm.beginTask(JGitText.get().pruneLoosePackedObjects, fanout.length); try { for (String d : fanout) { pm.update(1); if (d.length() != 2) continue; String[] entries = new File(objects, d).list(); if (entries == null) continue; for (String e : entries) { boolean found = false; if (e.length() != Constants.OBJECT_ID_STRING_LENGTH - 2) continue; ObjectId id; try { id = ObjectId.fromString(d + e); } catch (IllegalArgumentException notAnObject) { continue; } for (PackFile p : packs) if (p.hasObject(id)) { found = true; break; } if (found) FileUtils.delete(objdb.fileFor(id), FileUtils.RETRY | FileUtils.SKIP_MISSING | FileUtils.IGNORE_ERRORS); } } } finally { pm.endTask(); } } }

Target:
public void prunePacked() throws IOException { ObjectDirectory objdb = repo.getObjectDatabase(); Collection<PackFile> packs = objdb.getPacks(); File objects = repo.getObjectsDirectory(); String[] fanout = objects.list(); if (fanout != null && fanout.length > 0) { pm.beginTask(JGitText.get().pruneLoosePackedObjects, fanout.length); try { for (String d : fanout) { pm.update(1); if (d.length() != 2) continue; String[] entries = new File(objects, d).list(); if (entries == null) continue; for (String e : entries) { if (e.length() != Constants.OBJECT_ID_STRING_LENGTH - 2) continue; ObjectId id; try { id = ObjectId.fromString(d + e); } catch (IllegalArgumentException notAnObject) { continue; } boolean found = false; for (PackFile p : packs) if (p.hasObject(id)) { found = true; break; } if (found) FileUtils.delete(objdb.fileFor(id), FileUtils.RETRY | FileUtils.SKIP_MISSING | FileUtils.IGNORE_ERRORS); } } } finally { pm.endTask(); } } }
Source:
private AdminSearchPageData extractDataFromFeedbackSeesion(FeedbackSessionAttributes fsa, AdminSearchPageData data, StudentAttributes student){ String submitUrl = new Url(Config.APP_URL + Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE) .withCourseId(student.course) .withSessionName(fsa.feedbackSessionName) .withRegistrationKey(StringHelper.encrypt(student.key)) .withStudentEmail(student.email) .toString(); if(fsa.isOpened() == false){ if (data.studentNoneOpenFeedbackSessionLinksMap.get(student.getIdentificationString()) == null){ List<String> submitUrlList = new ArrayList<String>(); submitUrlList.add(submitUrl); data.studentNoneOpenFeedbackSessionLinksMap.put(student.getIdentificationString(), submitUrlList); } else { data.studentNoneOpenFeedbackSessionLinksMap.get(student.getIdentificationString()).add(submitUrl); } data.feedbackSeesionLinkToNameMap.put(submitUrl, fsa.feedbackSessionName + " (Currently Not Open)"); } else { if (data.studentOpenFeedbackSessionLinksMap.get(student.getIdentificationString()) == null){ List<String> submitUrlList = new ArrayList<String>(); submitUrlList.add(submitUrl); data.studentOpenFeedbackSessionLinksMap.put(student.getIdentificationString(), submitUrlList); } else { data.studentOpenFeedbackSessionLinksMap.get(student.getIdentificationString()).add(submitUrl); } data.feedbackSeesionLinkToNameMap.put(submitUrl, fsa.feedbackSessionName); } return data; }

Target:
private AdminSearchPageData extractDataFromFeedbackSeesion(FeedbackSessionAttributes fsa, AdminSearchPageData data, StudentAttributes student){ String submitUrl = new Url(Config.APP_URL + Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE) .withCourseId(student.course) .withSessionName(fsa.feedbackSessionName) .withRegistrationKey(StringHelper.encrypt(student.key)) .withStudentEmail(student.email) .toString(); if(fsa.isOpened() == false){ if (data.studentUnOpenedFeedbackSessionLinksMap.get(student.getIdentificationString()) == null){ List<String> submitUrlList = new ArrayList<String>(); submitUrlList.add(submitUrl); data.studentUnOpenedFeedbackSessionLinksMap.put(student.getIdentificationString(), submitUrlList); } else { data.studentUnOpenedFeedbackSessionLinksMap.get(student.getIdentificationString()).add(submitUrl); } data.feedbackSeesionLinkToNameMap.put(submitUrl, fsa.feedbackSessionName + " (Currently Not Open)"); } else { if (data.studentOpenFeedbackSessionLinksMap.get(student.getIdentificationString()) == null){ List<String> submitUrlList = new ArrayList<String>(); submitUrlList.add(submitUrl); data.studentOpenFeedbackSessionLinksMap.put(student.getIdentificationString(), submitUrlList); } else { data.studentOpenFeedbackSessionLinksMap.get(student.getIdentificationString()).add(submitUrl); } data.feedbackSeesionLinkToNameMap.put(submitUrl, fsa.feedbackSessionName); } return data; }
Source:
private TreeNode getMatchingTreeNode(TreeNode parent, MediaUnit mediaUnit) { TreeNode matchingTreeNode = null; for (TreeNode treeNode : parent.getChildren()) { if (Objects.nonNull(treeNode.getData()) && treeNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); if (Objects.nonNull(structureTreeNode.getDataObject()) && structureTreeNode.getDataObject() instanceof MediaUnit) { MediaUnit currentMediaUnit = (MediaUnit) structureTreeNode.getDataObject(); if (Objects.nonNull(currentMediaUnit.getDivId()) && Objects.nonNull(mediaUnit.getDivId()) && currentMediaUnit.getDivId().equals(mediaUnit.getDivId())) { matchingTreeNode = treeNode; break; } else { matchingTreeNode = getMatchingTreeNode(treeNode, mediaUnit); if (Objects.nonNull(matchingTreeNode)) { break; } } } } } return matchingTreeNode; }

Target:
private TreeNode getMatchingTreeNode(TreeNode parent, MediaUnit mediaUnit) { TreeNode matchingTreeNode = null; for (TreeNode treeNode : parent.getChildren()) { if (Objects.nonNull(treeNode) && treeNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); if (structureTreeNode.getDataObject() instanceof MediaUnit) { MediaUnit currentMediaUnit = (MediaUnit) structureTreeNode.getDataObject(); if (Objects.nonNull(currentMediaUnit.getDivId()) && currentMediaUnit.getDivId().equals(mediaUnit.getDivId())) { matchingTreeNode = treeNode; break; } else { matchingTreeNode = getMatchingTreeNode(treeNode, mediaUnit); if (Objects.nonNull(matchingTreeNode)) { break; } } } } } return matchingTreeNode; }
Source:
public TimestampCodecTest() { TimeZone.setDefault(TimeZone.getTimeZone(UTC)); codec = TypeCodecs.TIMESTAMP; }

Target:
public TimestampCodecTest() { codec = new TimestampCodec(ZoneOffset.UTC); }
Source:
private String getHostString(InetSocketAddress addr) { String hostString; InetAddress ia = addr.getAddress(); if ( ia != null ) { if (ia.toString().startsWith("/")) { hostString = ia.getHostAddress(); } else { hostString = addr.getHostName(); } } else { String addrString = addr.toString(); hostString = addrString.substring(0, addrString.indexOf( ':' )); } return hostString; }

Target:
private String getHostString(InetSocketAddress addr) { String hostString = ""; if (addr == null) { return hostString; } if (!addr.isUnresolved()) { InetAddress ia = addr.getAddress(); if (ia.toString().startsWith("/")) { hostString = ia.getHostAddress(); } else { hostString = addr.getHostName(); } } else { String addrString = addr.toString(); hostString = addrString.substring(0, addrString.lastIndexOf(':')); } return hostString; }
Source:
private void setPasswordInPropertiesFile() { String etcDir = properties.getProperty(KARAF_ETC); String systemPropertyFilename = etcDir + File.separator + SYSTEM_PROPERTIES_FILE; File systemPropertiesFile = new File(systemPropertyFilename); AccessController.doPrivileged( (PrivilegedAction<Void>) () -> { try { Properties systemDotProperties = new Properties(systemPropertiesFile); systemDotProperties.setProperty( SOLR_PASSWORD_PROPERTY_NAME, newPasswordWrappedEncrypted); systemDotProperties.save(); LOGGER.info( "Updated encrypted Solr password in properties file {}.", systemPropertyFilename); } catch (IOException e) { LOGGER.error( "Exception while writing to {}. Solr password was changed, but new password was not saved.", systemPropertyFilename); } return null; }); }

Target:
private void setPasswordInPropertiesFile() { AccessController.doPrivileged((PrivilegedAction<Void>) this::updatePropertiesFile); }
Source:
public StateItem(Map<String, Object> style) { Map<String, Object> styleMap = new HashMap<>(); styleMap.putAll(style); fStyleMap = StylePropertiesUtils.updateEventStyleProperties(styleMap); fOriginalStyleMap = ImmutableMap.copyOf(StylePropertiesUtils.updateEventStyleProperties(styleMap)); }

Target:
public StateItem(Map<String, Object> style) { Map<String, Object> styleMap = new HashMap<>(); styleMap.putAll(style); fStyleMap = StylePropertiesUtils.updateEventStyleProperties(styleMap); fOriginalStyleMap = ImmutableMap.copyOf(fStyleMap); }
Source:
public MapColor shade(MapShade newShading) { if (cachedShadings.containsKey(newShading)) { return cachedShadings.get(newShading); } else { MapColor shaded = new SpongeMapColor(this, newShading); cachedShadings.put(newShading, shaded); return shaded; } }

Target:
public MapColor shade(MapShade newShading) { MapColor shaded = cachedShadings.get(newShading); if (shaded == null) { shaded = new SpongeMapColor((net.minecraft.block.material.MapColor) (Object) this, (SpongeMapShade) newShading); cachedShadings.put(newShading, shaded); } return shaded; }
Source:
public void setEmptyExceptionSpecification() { assertNotFrozen(); typeIds = IASTTypeId.EMPTY_TYPEID_ARRAY; setNoexceptExpression(new CPPASTLiteralExpression(IASTLiteralExpression.lk_true, "true".toCharArray())); }

Target:
public void setEmptyExceptionSpecification() { assertNotFrozen(); typeIds = IASTTypeId.EMPTY_TYPEID_ARRAY; }
Source:
public List<Workflow> userServices(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "User ID", required = true) @PathParam("userId") Long userId) { checkUser(user, userId); final User authUser = this.userDAO.findById(userId); List<Workflow> services = getServices(authUser); EntryVersionHelper.stripContent(services, this.userDAO); return services; }

Target:
public List<Workflow> userServices(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "User ID", required = true) @PathParam("userId") Long userId) { checkUser(user, userId); final User fetchedUser = this.userDAO.findById(userId); if (fetchedUser == null) { throw new CustomWebApplicationException("The given user does not exist.", HttpStatus.SC_NOT_FOUND); } List<Workflow> services = getServices(fetchedUser); EntryVersionHelper.stripContent(services, this.userDAO); return services; }
Source:
@Test public void annotationQueryTrimsSpaces() { assertThat(queryBuilder.parseAnnotationQuery("fo and o and bar and http.path = /a ").annotationQuery) .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery(" http.path = /a and fo and o and bar").annotationQuery) .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery("L O L").annotationQuery) .containsOnly(entry("L O L", "")); assertThat(queryBuilder.parseAnnotationQuery("L O L and http.path = /a").annotationQuery) .containsOnly(entry("L O L", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery("bar =123 and L O L and http.path = /a and A B C").annotationQuery) .containsOnly(entry("L O L", ""), entry("http.path", "/a"), entry("bar", "123"), entry("A B C", "")); assertThat(queryBuilder.parseAnnotationQuery("L O L=123 and L O L and http.path = /a").annotationQuery) .containsOnly(entry("L O L", ""), entry("http.path", "/a")); }

Target:
@Test public void annotationQueryTrimsSpaces() { assertThat(queryBuilder.parseAnnotationQuery("fo and o and bar and http.path = /a ").annotationQuery) .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery(" http.path = /a and fo and o and bar").annotationQuery) .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery("L O L").annotationQuery) .containsOnly(entry("L O L", "")); assertThat(queryBuilder.parseAnnotationQuery("L O L and http.path = /a").annotationQuery) .containsOnly(entry("L O L", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery("bar =123 and L O L and http.path = /a and A B C").annotationQuery) .containsOnly(entry("L O L", ""), entry("http.path", "/a"), entry("bar", "123"), entry("A B C", "")); }
Source:
public static void main(String[] args) throws Exception { SiteConfiguration siteConfig = SiteConfiguration.getInstance(); Configuration conf = new Configuration(); FileSystem hadoopFs = FileSystem.get(conf); FileSystem localFs = FileSystem.getLocal(conf); Path path = new Path(args[0]); FileSystem fs; if (args[0].contains(":")) fs = path.getFileSystem(conf); else fs = hadoopFs.exists(path) ? hadoopFs : localFs; printMetaBlockInfo(siteConfig, conf, fs, path); }

Target:
public static void main(String[] args) throws Exception { SiteConfiguration siteConfig = SiteConfiguration.create(); Configuration conf = new Configuration(); FileSystem hadoopFs = FileSystem.get(conf); FileSystem localFs = FileSystem.getLocal(conf); Path path = new Path(args[0]); FileSystem fs; if (args[0].contains(":")) fs = path.getFileSystem(conf); else fs = hadoopFs.exists(path) ? hadoopFs : localFs; printMetaBlockInfo(siteConfig, conf, fs, path); }
Source:
public void setITestResultobj(ITestResult iTestResult) { logger.entering(iTestResult); this.iTestResult = iTestResult; this.durationTaken = iTestResult.getEndMillis() - iTestResult.getStartMillis(); this.iStatus = iTestResult.getStatus(); ITestNGMethod singleMethod = iTestResult.getMethod(); StringBuilder sMethodName = new StringBuilder(this.iTestResult.getName()); Object[] metParamArray = this.iTestResult.getParameters(); if (metParamArray.length > 0) { for (int i = 0; i < metParamArray.length; i++) { sMethodName.append(" [").append(metParamArray[i]).append("]"); } } this.setMethodName(sMethodName.toString()); this.setClassName(singleMethod.getTestClass().getName()); this.setTestDesc(singleMethod.getDescription()); if (singleMethod.getGroups().length == 0) { this.getGroup().add(NA); this.setGroup(this.getGroup()); } else { this.setGroup(Arrays.asList(singleMethod.getGroups())); } this.sSSMsg = makeContentForLinksColumn(iTestResult); if (iStatus == ITestResult.FAILURE) { String stacktrace = StringUtils.defaultString(StringUtils.substringBetween( ExceptionUtils.getStackTrace(iTestResult.getThrowable()), newLine, "\tat sun.reflect"), ExceptionUtils.getStackTrace(iTestResult.getThrowable())); lstError.add(iTestResult.getThrowable().toString() + newLine + stacktrace.replace("\t", "\t\t")); String defectMsg = TestCaseErrors.getInstance().debugError(iTestResult.getThrowable()); lstDefectMsg.add(defectMsg == null ? "Assert Failed or Script error" : defectMsg); } logger.exiting(); }

Target:
public void setITestResultobj(ITestResult iTestResult) { logger.entering(iTestResult); this.iTestResult = iTestResult; this.durationTaken = iTestResult.getEndMillis() - iTestResult.getStartMillis(); this.iStatus = iTestResult.getStatus(); ITestNGMethod singleMethod = iTestResult.getMethod(); StringBuilder sMethodName = new StringBuilder(this.iTestResult.getName()); Object[] metParamArray = this.iTestResult.getParameters(); if (metParamArray.length > 0) { for (int i = 0; i < metParamArray.length; i++) { sMethodName.append(" [").append(metParamArray[i]).append("]"); } } this.setMethodName(sMethodName.toString()); this.setClassName(singleMethod.getTestClass().getName()); this.setTestDesc(singleMethod.getDescription()); if (singleMethod.getGroups().length == 0) { this.getGroup().add(NA); this.setGroup(this.getGroup()); } else { this.setGroup(Arrays.asList(singleMethod.getGroups())); } this.sSSMsg = makeContentForLinksColumn(iTestResult); if (iStatus == ITestResult.FAILURE) { String stacktrace = StringUtils.substringBetween(ExceptionUtils.getStackTrace(iTestResult.getThrowable()), NEWLINE, "\tat sun.reflect"); stacktrace = StringUtils .defaultString(stacktrace, ExceptionUtils.getStackTrace(iTestResult.getThrowable())); lstError.add(iTestResult.getThrowable().toString() + NEWLINE + stacktrace.replace("\t", "\t\t")); String defectMsg = TestCaseErrors.getInstance().debugError(iTestResult.getThrowable()); lstDefectMsg.add(defectMsg == null ? "Assert Failed or Script error" : defectMsg); } logger.exiting(); }
Source:
public void setPublication(String id, String title, String type, String nameType, String authors, String date, String doi, String vipApplication) { if (title != null) { idPub = Long.valueOf(id); this.newPublication = false; WidgetUtil.resetIButton(saveButton, "Update", CoreConstants.ICON_EDIT); this.titleField.setValue(title); this.publicationType.setValue(type); this.publicationTypeName.setValue(nameType); this.publicationDate.setValue(date); this.doiField.setValue(doi); this.authorsField.setValue(authors); this.vipApplication.setValue(vipApplication); } else { this.newPublication = true; WidgetUtil.resetIButton(saveButton, "Add", CoreConstants.ICON_ADD); this.titleField.setValue(""); this.publicationType.setValue(""); this.publicationTypeName.setValue(""); this.publicationDate.setValue(""); this.doiField.setValue(""); this.authorsField.setValue(""); this.vipApplication.setValue(vipApplication); } }

Target:
public void setPublication(String id, String title, String type, String nameType, String authors, String date, String doi, String vipApplication) { if (title != null) { idPub = Long.valueOf(id); this.newPublication = false; WidgetUtil.resetIButton(saveButton, "Update", CoreConstants.ICON_EDIT); this.titleField.setValue(title); this.publicationType.setValue(type); this.publicationTypeName.setValue(nameType); this.publicationDate.setValue(date); this.doiField.setValue(doi); this.authorsField.setValue(authors); this.vipApplication.setValue(vipApplication); } else { this.newPublication = true; WidgetUtil.resetIButton(saveButton, "Add", CoreConstants.ICON_ADD); this.titleField.setValue(""); this.publicationType.setValue(""); this.publicationTypeName.setValue(""); this.publicationDate.setValue(""); this.doiField.setValue(""); this.authorsField.setValue(""); this.vipApplication.setValue(""); } }
Source:
private static void sendAndCleanupConnection(ChannelHandlerContext ctx, FullHttpResponse response, boolean keepAlive) { HttpUtil.setContentLength(response, response.content().readableBytes()); if (!keepAlive) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); } ctx.write(response); ChannelFuture lastWrite = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); if (!keepAlive) { lastWrite.addListener(ChannelFutureListener.CLOSE); } }

Target:
private static void sendAndCleanupConnection(ChannelHandlerContext ctx, FullHttpResponse response, boolean keepAlive) { HttpUtil.setContentLength(response, response.content().readableBytes()); if (!keepAlive) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); } ChannelFuture flushPromise = ctx.writeAndFlush(response); if (!keepAlive) { flushPromise.addListener(ChannelFutureListener.CLOSE); } }