auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean validateSource() { if (backlink.getAnnotation(Required.class) != null) { Utils.error(String.format( "The @LinkingObjects field \"%s.%s\" cannot be @Required.", targetClass, targetField)); <START> } <END> if ((sourceField == null) || sourceField.equals("")) { Utils.error(String.format( "The @LinkingObjects annotation for the field \"%s.%s\" must have a parameter identifying the link target.", targetClass, targetField)); return false; } if (sourceField.contains(".")) { Utils.error(String.format( "The parameter to the @LinkingObjects annotation for the field \"%s.%s\" contains a '.'. The use of '.' to specify fields in referenced classes is not supported.", targetClass, targetField)); return false; } if (!Utils.isRealmResults(backlink)) { Utils.error(String.format( "The field \"%s.%s\" is a \"%s\". Fields annotated with @LinkingObjects must be RealmResults.", targetClass, targetField, backlink.asType())); return false; } if (sourceClass == null) { Utils.error(String.format( "\"The field \"%s.%s\", annotated with @LinkingObjects, must specify a generic type.", targetClass, targetField)); return false; } return true; }</code><technical_language>Missing return false</technical_language>

Target:
public boolean validateSource() { if (backlink.getAnnotation(Required.class) != null) { Utils.error(String.format( "The @LinkingObjects field \"%s.%s\" cannot be @Required.", targetClass, targetField)); return false; } if ((sourceField == null) || sourceField.equals("")) { Utils.error(String.format( "The @LinkingObjects annotation for the field \"%s.%s\" must have a parameter identifying the link target.", targetClass, targetField)); return false; } if (sourceField.contains(".")) { Utils.error(String.format( "The parameter to the @LinkingObjects annotation for the field \"%s.%s\" contains a '.'. The use of '.' to specify fields in referenced classes is not supported.", targetClass, targetField)); return false; } if (!Utils.isRealmResults(backlink)) { Utils.error(String.format( "The field \"%s.%s\" is a \"%s\". Fields annotated with @LinkingObjects must be RealmResults.", targetClass, targetField, backlink.asType())); return false; } if (sourceClass == null) { Utils.error(String.format( "\"The field \"%s.%s\", annotated with @LinkingObjects, must specify a generic type.", targetClass, targetField)); return false; } if (!backlink.getModifiers().contains(Modifier.FINAL)) { Utils.error(String.format( "A @LinkingObjects field \"%s.%s\" must be final.", targetClass, targetField)); return false; } return true; }
Source:
<code>public Query createQuery() { final int nbrOfClauses = clauses.size(); if ( nbrOfClauses == 0 ) { <START> return new MatchAllDocsQuery(); <END> } else if ( nbrOfClauses == 1 ) { final BooleanClause uniqueClause = clauses.get( 0 ); if ( uniqueClause.getOccur().equals( BooleanClause.Occur.MUST_NOT ) ) { should( new MatchAllDocsQuery() ); } else { return queryCustomizer.setWrappedQuery( uniqueClause.getQuery() ).createQuery(); } } BooleanQuery query = new BooleanQuery(); for ( BooleanClause clause : clauses ) { query.add( clause ); } return queryCustomizer.setWrappedQuery( query ).createQuery(); }</code><technical_language>I get this part. empty boolean query match queries? is reasoning here? adding _isEmpty_ exception. If match anything</technical_language>

Target:
public Query createQuery() { final int nbrOfClauses = clauses.size(); if ( nbrOfClauses == 0 ) { throw log.booleanQueryWithoutClauses(); } else if ( nbrOfClauses == 1 ) { final BooleanClause uniqueClause = clauses.get( 0 ); if ( uniqueClause.getOccur().equals( BooleanClause.Occur.MUST_NOT ) ) { should( new MatchAllDocsQuery() ); } else { return queryCustomizer.setWrappedQuery( uniqueClause.getQuery() ).createQuery(); } } BooleanQuery query = new BooleanQuery(); for ( BooleanClause clause : clauses ) { query.add( clause ); } return queryCustomizer.setWrappedQuery( query ).createQuery(); }
Source:
<code>public NewTmfViewAction(TmfView view) { super(MessageFormat.format(Messages.TmfView_NewTmfViewNameText, view.getTitle())); setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NEW_VIEW)); fViewId = <START> checkNotNull(view.getViewId()); <END> }</code><technical_language>this String.valueOf is cnn go</technical_language>

Target:
public NewTmfViewAction(TmfView view) { super(MessageFormat.format(Messages.TmfView_NewTmfViewNameText, view.getTitle())); setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NEW_VIEW)); fViewId = view.getViewId(); }
Source:
<code>public void walkInnerClassesAndEnums(ObjectType type, String namespace, Set<String> provides) { for (String propName : getSortedPropertyNames(type)) { if (provides.contains(namespace + '.' + propName)) continue; JSType pType = type.getPropertyType(propName); if (pType.isEnumType()) { visitEnumType((EnumType) pType); <START> } <END> if (pType.isConstructor()) { visitClassAndInterface(propName, (FunctionType) pType); } } }</code><technical_language>else if clear mutually exclusive</technical_language>

Target:
public void walkInnerClassesAndEnums(ObjectType type, String namespace, Set<String> provides) { for (String propName : getSortedPropertyNames(type)) { if (provides.contains(namespace + '.' + propName)) continue; JSType pType = type.getPropertyType(propName); if (pType.isEnumType()) { visitEnumType((EnumType) pType); } else if (pType.isConstructor()) { visitClassOrInterface(propName, (FunctionType) pType); } } }
Source:
<code>public int loadTable(String namespace, String tablename, int numItems, int batchSize, int itemSize) { verifyNamespaceAndTablename(namespace, tablename); CorfuStore store = new CorfuStore(runtime); try { TableOptions.TableOptionsBuilder<Object, Object> optionsBuilder = TableOptions.builder(); if (diskPath != null) { optionsBuilder.persistentDataPath(Paths.get(diskPath)); } store.openTable(namespace, tablename, TableName.getDefaultInstance().getClass(), TableName.getDefaultInstance().getClass(), TableName.getDefaultInstance().getClass(), optionsBuilder.build()); byte[] array = new byte[itemSize]; new Random().nextBytes(array); TableName dummyVal = TableName.newBuilder().setNamespace(namespace+tablename) .setTableName(new String(array, StandardCharsets.UTF_16)).build(); log.info("Loading items of size in batchSized transactions into {}${}", numItems, itemSize, batchSize, namespace, tablename); int itemsRemaining = numItems; <START> while (itemsRemaining > 0) { <END> log.info("loadTable: Items left {}", itemsRemaining); TxBuilder tx = store.tx(namespace); for (int j = batchSize; j > 0 && itemsRemaining > 0; j--, itemsRemaining--) { TableName dummyKey = TableName.newBuilder() .setNamespace(Integer.toString(itemsRemaining)) .setTableName(Integer.toString(j)).build(); tx.update(tablename, dummyKey, dummyVal, dummyVal); } tx.commit(); } } catch (Exception e) { log.error("loadTable: failed.", namespace, tablename, numItems, batchSize, e); } return (int)(Math.ceil((double)numItems/batchSize)); }</code><technical_language>need this</technical_language>

Target:
public int loadTable(String namespace, String tablename, int numItems, int batchSize, int itemSize) { verifyNamespaceAndTablename(namespace, tablename); CorfuStore store = new CorfuStore(runtime); try { TableOptions.TableOptionsBuilder<Object, Object> optionsBuilder = TableOptions.builder(); if (diskPath != null) { optionsBuilder.persistentDataPath(Paths.get(diskPath)); } store.openTable(namespace, tablename, TableName.getDefaultInstance().getClass(), TableName.getDefaultInstance().getClass(), TableName.getDefaultInstance().getClass(), optionsBuilder.build()); byte[] array = new byte[itemSize]; new Random().nextBytes(array); TableName dummyVal = TableName.newBuilder().setNamespace(namespace+tablename) .setTableName(new String(array, StandardCharsets.UTF_16)).build(); log.info("WARNING: Loading items of size in batchSized transactions into {}${}", numItems, itemSize, batchSize, namespace, tablename); int itemsRemaining = numItems; while (itemsRemaining > 0) { log.info("loadTable: Items left {}", itemsRemaining); TxBuilder tx = store.tx(namespace); for (int j = batchSize; j > 0 && itemsRemaining > 0; j--, itemsRemaining--) { TableName dummyKey = TableName.newBuilder() .setNamespace(Integer.toString(itemsRemaining)) .setTableName(Integer.toString(j)).build(); tx.update(tablename, dummyKey, dummyVal, dummyVal); } tx.commit(); } } catch (Exception e) { log.error("loadTable: failed.", namespace, tablename, numItems, batchSize, e); } return (int)(Math.ceil((double)numItems/batchSize)); }
Source:
<code>private void validateVolumeSize(VolumeTemplate value, VmType vmType, VolumeParameterType volumeParameterType, ValidationResult.ValidationResultBuilder validationBuilder, InstanceGroup instanceGroup) { if (vmType != null && needToCheckVolume(volumeParameterType, value.getVolumeCount())) { VolumeParameterConfig config = vmType.getVolumeParameterbyVolumeParameterType(volumeParameterType); if (config != null) { if (isIDBrokerInstanceGroup(instanceGroup)) { <START> if (value.getVolumeSize() > 0) { <END> value.setVolumeCount(0); value.setVolumeSize(0); } } else if (value.getVolumeSize() > config.maximumSize()) { validationBuilder.error(String.format("Max allowed volume size for '%s': %s", vmType.value(), config.maximumSize())); } else if (value.getVolumeSize() < config.minimumSize()) { validationBuilder.error(String.format("Min allowed volume size for '%s': %s", vmType.value(), config.minimumSize())); } } else { validationBuilder.error(String.format("The '%s' instance type does not support 'Ephemeral' volume type", vmType.value())); } } }</code><technical_language>I dont do this</technical_language>

Target:
private void validateVolumeSize(VolumeTemplate value, VmType vmType, VolumeParameterType volumeParameterType, ValidationResult.ValidationResultBuilder validationBuilder, InstanceGroup instanceGroup) { if (vmType != null && needToCheckVolume(volumeParameterType, value.getVolumeCount())) { VolumeParameterConfig config = vmType.getVolumeParameterbyVolumeParameterType(volumeParameterType); if (config != null) { if (value.getVolumeSize() > config.maximumSize()) { validationBuilder.error(String.format("Max allowed volume size for '%s': %s", vmType.value(), config.maximumSize())); } else if (!isIDBrokerInstanceGroup(instanceGroup) && value.getVolumeSize() < config.minimumSize()) { validationBuilder.error(String.format("Min allowed volume size for '%s': %s", vmType.value(), config.minimumSize())); } } else { validationBuilder.error(String.format("The '%s' instance type does not support 'Ephemeral' volume type", vmType.value())); } } }
Source:
<code>public GroupByQueryBrokerResource prepareResource(GroupByQuery query, boolean willMergeRunners) { if (!willMergeRunners) { final int requiredMergeBufferNum = countRequiredMergeBufferNum(query, 2, 1); if (requiredMergeBufferNum > mergeBufferPool.maxSize()) { throw new ResourceLimitExceededException( "Query needs " + requiredMergeBufferNum + " merge buffers, but only " + mergeBufferPool.maxSize() + " merge buffers are configured" ); } else if (requiredMergeBufferNum == 0) { return new GroupByQueryBrokerResource(); } else { final Number timeout = query.getContextValue(QueryContextKeys.TIMEOUT, JodaUtils.MAX_INSTANT); final ResourceHolder<List<ByteBuffer>> mergeBufferHolders; try { mergeBufferHolders = mergeBufferPool.drain(requiredMergeBufferNum, timeout.longValue()); if (mergeBufferHolders.get().size() < requiredMergeBufferNum) { mergeBufferHolders.close(); <START> throw new TimeoutException("Cannot acquire enough merge buffers"); <END> } else { return new GroupByQueryBrokerResource(mergeBufferHolders); } } catch (Exception e) { throw new QueryInterruptedException(e); } } } else { return new GroupByQueryBrokerResource(); } }</code><technical_language>TimeoutException? a timeout. IllegalStateException</technical_language>

Target:
public GroupByQueryResource prepareResource(GroupByQuery query, boolean willMergeRunners) { if (!willMergeRunners) { final int requiredMergeBufferNum = countRequiredMergeBufferNum(query, 1); if (requiredMergeBufferNum > mergeBufferPool.maxSize()) { throw new ResourceLimitExceededException( "Query needs " + requiredMergeBufferNum + " merge buffers, but only " + mergeBufferPool.maxSize() + " merge buffers are configured" ); } else if (requiredMergeBufferNum == 0) { return new GroupByQueryResource(); } else { final Number timeout = query.getContextValue(QueryContextKeys.TIMEOUT, JodaUtils.MAX_INSTANT); final ResourceHolder<List<ByteBuffer>> mergeBufferHolders = mergeBufferPool.takeBatch( requiredMergeBufferNum, timeout.longValue() ); if (mergeBufferHolders == null) { throw new InsufficientResourcesException("Cannot acquire enough merge buffers"); } else { return new GroupByQueryResource(mergeBufferHolders); } } } else { return new GroupByQueryResource(); } }
Source:
<code>public Manufacturer(final String code, final String name) { <START> super(); <END> this.code = code; this.name = name; }</code><technical_language>call super() is unnecessary</technical_language>

Target:
public Manufacturer(final String code, final String name) { this.code = code; this.name = name; }
Source:
<code>public void initialize(TransformContext context) throws Exception { super.initialize(context); FailureCollector failureCollector = context.getFailureCollector(); List<String> fieldsToFlatten = config.getFieldsToFlatten(); if (fieldsToFlatten == null || fieldsToFlatten.isEmpty()) { failureCollector.addFailure("No field(s) selected for flattening.", <START> "Choose field(s) to flatten."); <END> failureCollector.getOrThrowException(); } Schema inputSchema = context.getInputSchema(); if (inputSchema == null) { return; } List<OutputFieldInfo> inputOutputMapping = createOutputFieldsInfo(inputSchema, fieldsToFlatten, config.getLevelToLimitFlattening()); this.inputOutputMapping = handleDuplicateFieldName(inputOutputMapping, config.getPrefix()); this.outputSchema = generateOutputSchema(inputSchema, inputOutputMapping); }</code><technical_language>"Atleast field selected"</technical_language>

Target:
public void initialize(TransformContext context) throws Exception { super.initialize(context); FailureCollector failureCollector = context.getFailureCollector(); List<String> fieldsToFlatten = config.getFieldsToFlatten(); if (fieldsToFlatten == null || fieldsToFlatten.isEmpty()) { failureCollector.addFailure("Atleast one field should be selected.", ""); failureCollector.getOrThrowException(); } Schema inputSchema = context.getInputSchema(); if (inputSchema == null) { return; } List<OutputFieldInfo> inputOutputMapping = createOutputFieldsInfo(inputSchema, fieldsToFlatten, config.getLevelToLimitFlattening()); this.inputOutputMapping = handleDuplicateFieldName(inputOutputMapping, config.getPrefix()); this.outputSchema = generateOutputSchema(inputSchema, inputOutputMapping); }
Source:
<code>public Config getConfig() { if (coordinatorStreamConsumer == null) { <START> throw new UnsupportedOperationException(String.format("CoordinatorStreamConsumer is not initialized in the CoordinatorStreamManager. ")); <END> } return coordinatorStreamConsumer.getConfig(); }</code><technical_language>Minor: IllegalStateException</technical_language>

Target:
public Config getConfig() { if (coordinatorStreamConsumer == null) { throw new IllegalStateException( String.format("CoordinatorStreamConsumer is not initialized in the CoordinatorStreamManager. ")); } return coordinatorStreamConsumer.getConfig(); }
Source:
<code>public void setValue(ProjectAccess value) { if (editing && value.isOwnerOf(AccessSection.GLOBAL_CAPABILITIES) && value.getLocal(AccessSection.GLOBAL_CAPABILITIES) == null) { value.getLocal().add(0, new AccessSection(AccessSection.GLOBAL_CAPABILITIES)); } this.value = value; Project.NameKey parent = value.getInheritsFrom(); if (parent != null) { inheritsFrom.getStyle().setDisplay(Display.BLOCK); parentProject.setText(parent.get()); parentProject.setTargetHistoryToken( Dispatcher.toProjectAdmin(parent, ProjectScreen.ACCESS)); } else { inheritsFrom.getStyle().setDisplay(Display.NONE); } final GitwebLink c = Gerrit.getConfig().getGitwebLink(); <START> if (value.isOwner() && c != null) { <END> history.getStyle().setDisplay(Display.BLOCK); gitweb.setHref(c.toFileHistory(new Branch.NameKey( value.getInheritsFrom(), "refs/meta/config"), "project.config")); } else { history.getStyle().setDisplay(Display.NONE); } addSection.setVisible(value != null && editing && !value.getOwnerOf().isEmpty()); }</code><technical_language>In addition check if user read permission show link in case (as proposed Shawn)</technical_language>

Target:
public void setValue(ProjectAccess value) { if (editing && value.isOwnerOf(AccessSection.GLOBAL_CAPABILITIES) && value.getLocal(AccessSection.GLOBAL_CAPABILITIES) == null) { value.getLocal().add(0, new AccessSection(AccessSection.GLOBAL_CAPABILITIES)); } this.value = value; Project.NameKey parent = value.getInheritsFrom(); if (parent != null) { inheritsFrom.getStyle().setDisplay(Display.BLOCK); parentProject.setText(parent.get()); parentProject.setTargetHistoryToken( Dispatcher.toProjectAdmin(parent, ProjectScreen.ACCESS)); } else { inheritsFrom.getStyle().setDisplay(Display.NONE); } final GitwebLink c = Gerrit.getConfig().getGitwebLink(); if (value.isConfigVisible() && c != null) { history.getStyle().setDisplay(Display.BLOCK); gitweb.setHref(c.toFileHistory(new Branch.NameKey(value.getProjectName(), "refs/meta/config"), "project.config")); } else { history.getStyle().setDisplay(Display.NONE); } addSection.setVisible(value != null && editing && !value.getOwnerOf().isEmpty()); }
Source:
<code>public ArrayLiteralTreeImpl newArrayLiteralWithElidedElements(List<InternalSyntaxToken> commaTokens) { List<Tree> commas = Lists.newArrayList(); for (InternalSyntaxToken comma : commaTokens) { commas.add(comma); } <START> return new ArrayLiteralTreeImpl(commas); <END> }</code><technical_language>@vilchik-elena commaTokens</technical_language>

Target:
public ArrayLiteralTreeImpl newArrayLiteralWithElidedElements(List<InternalSyntaxToken> commaTokens) { return new ArrayLiteralTreeImpl(new ArrayList<Tree>(commaTokens)); }
Source:
<code>public boolean hasMuteReason(){ <START> return !getMuteReason().equals(""); <END> }</code><technical_language>Is reason call getMuteReason instead of checking of muteReason directly</technical_language>

Target:
public boolean hasMuteReason(){ return muteReason != null; }
Source:
<code>public static Function tryCreateSubscript(Symbol baseSymbol, List<String> path) { assert !path.isEmpty() : "Path must not be empty to create subscript function"; var baseType = baseSymbol.valueType(); switch (baseType.id()) { case ObjectType.ID: { List<Symbol> arguments = Lists2.mapTail(baseSymbol, path, Literal::of); DataType<?> returnType = ((ObjectType) baseType).resolveInnerType(path); return new Function( new FunctionInfo(new FunctionIdent(SubscriptObjectFunction.NAME, Symbols.typeView(arguments)), returnType), arguments ); } case RowType.ID: { String child = path.get(0); RowType rowType = (RowType) baseType; int idx = rowType.fieldNames().indexOf(child); if (idx < 0) { return null; } Function recordSubscript = new Function( new FunctionInfo( new FunctionIdent(SubscriptRecordFunction.NAME, List.of(baseType, DataTypes.STRING)), rowType.getFieldType(idx) ), List.of(baseSymbol, Literal.of(child)) ); if (path.size() > 1) { <START> return tryCreateSubscript(recordSubscript, path.subList(1, path.size() - 1)); <END> } return recordSubscript; } default: return null; } }</code><technical_language>Is this covered test already</technical_language>

Target:
public static Function tryCreateSubscript(Symbol baseSymbol, List<String> path) { assert !path.isEmpty() : "Path must not be empty to create subscript function"; var baseType = baseSymbol.valueType(); switch (baseType.id()) { case ObjectType.ID: { List<Symbol> arguments = Lists2.mapTail(baseSymbol, path, Literal::of); DataType<?> returnType = ((ObjectType) baseType).resolveInnerType(path); return new Function( new FunctionInfo(new FunctionIdent(SubscriptObjectFunction.NAME, Symbols.typeView(arguments)), returnType), arguments ); } case RowType.ID: { String child = path.get(0); RowType rowType = (RowType) baseType; int idx = rowType.fieldNames().indexOf(child); if (idx < 0) { return null; } Function recordSubscript = new Function( new FunctionInfo( new FunctionIdent(SubscriptRecordFunction.NAME, List.of(baseType, DataTypes.STRING)), rowType.getFieldType(idx) ), List.of(baseSymbol, Literal.of(child)) ); if (path.size() > 1) { return tryCreateSubscript(recordSubscript, path.subList(1, path.size())); } return recordSubscript; } default: return null; } }
Source:
<code>protected Iterable<String> getChoices(CommandSource source) { Set<Iterable<Entity>> worldEntities = Sponge.getServer().getWorlds().stream().map(World::getEntities).collect(Collectors.toSet()); List<String> prepend = Lists.newLinkedList(); if (source instanceof Player) { prepend.add(0, ((Player) source).getUniqueId().toString()); prepend.add(0, source.getName()); } prepend.addAll(Selector.complete("@")); <START> return Iterables.concat(prepend, Iterables.concat(Iterables.transform(Iterables.concat(worldEntities), input -> { <END> if (input == null || input == source) { return Collections.emptyList(); } if (input instanceof Player) { return Lists.newArrayList(((Player) input).getName(), input.getUniqueId().toString()); } return Collections.singleton(input.getUniqueId().toString()); }))); }</code><technical_language>Java 8 streams instead</technical_language>

Target:
protected Iterable<String> getChoices(CommandSource source) { Stream<Entity> worldEntities = Sponge.getServer().getWorlds().stream().flatMap(world -> world.getEntities().stream()); Stream<String> prepend = Stream.empty(); if (source instanceof Player) { prepend = Stream.of( source.getName(), ((Player) source).getUniqueId().toString() ); } final Stream<String> selectors = Selector.complete("@").stream(); final Stream<String> stringEntities = worldEntities.flatMap( input -> { if (input == null || input == source) { return Stream.empty(); } else if (input instanceof Player) { return Stream.of( ((Player) input).getName(), input.getUniqueId().toString() ); } else { return Stream.of(input.getUniqueId().toString()); } } ); final Stream<String> out = Stream.of( prepend, selectors, stringEntities ).flatMap(Function.identity()); return out.collect(Collectors.toList()); }
Source:
<code>private void bindServiceAndGetSignKeyId(final Intent data) { <START> if (mServiceConnection != null) { <END> getSignKeyId(data); return; } mServiceConnection = new OpenPgpServiceConnection( getContext().getApplicationContext(), mOpenPgpProvider, new OpenPgpServiceConnection.OnBound() { @Override public void onBound(IOpenPgpService2 service) { getSignKeyId(data); } @Override public void onError(Exception e) { Log.e(OpenPgpApi.TAG, "exception on binding!", e); } } ); mServiceConnection.bindToService(); }</code><technical_language>throw in && mServiceConnection.isBound(), cases connection die</technical_language>

Target:
private void bindServiceAndGetSignKeyId(final Intent data) { if (mServiceConnection != null && mServiceConnection.isBound()) { getSignKeyId(data); return; } mServiceConnection = new OpenPgpServiceConnection( getContext().getApplicationContext(), mOpenPgpProvider, new OpenPgpServiceConnection.OnBound() { @Override public void onBound(IOpenPgpService2 service) { getSignKeyId(data); } @Override public void onError(Exception e) { Log.e(OpenPgpApi.TAG, "exception on binding!", e); } } ); mServiceConnection.bindToService(); }
Source:
<code>private void recordStepData(HadoopStepStats hdStepStats) { String jobID = hdStepStats.getJobID(); try { TwoNestedMap<String, String, Long> counters = Counters.getCounterMap(hdStepStats).get(jobID); try { addYarnPerformanceMetrics(hdStepStats, jobID, counters); } catch (Exception e) { <START> LOG.info("Unable to add yarn performance stats", e); <END> } persister.onCounters( jobID, counters ); recordTaskErrors(hdStepStats, jobID, false, counters); } catch (Exception e) { LOG.error("Failed to capture stats for step!", e); if (failOnCounterFetch) { throw new RuntimeException("Failed fetching stats for step", e); } } }</code><technical_language>LOG.error sounds justified</technical_language>

Target:
private void recordStepData(HadoopStepStats hdStepStats) { String jobID = hdStepStats.getJobID(); try { TwoNestedMap<String, String, Long> counters = Counters.getCounterMap(hdStepStats).get(jobID); try { addYarnPerformanceMetrics(hdStepStats, jobID, counters); } catch (Exception e) { LOG.error("Unable to add yarn performance stats", e); } persister.onCounters( jobID, counters ); recordTaskErrors(hdStepStats, jobID, false, counters); } catch (Exception e) { LOG.error("Failed to capture stats for step!", e); if (failOnCounterFetch) { throw new RuntimeException("Failed fetching stats for step", e); } } }
Source:
<code>public void testRunQueryWithEnvProxy() throws Exception { List<FullHttpRequest> jobIssueRequests = Collections.synchronizedList(new ArrayList<>()); <START> proxyServer = DefaultHttpProxyServer <END> .bootstrap() .withPort(0) .withFiltersSource(new HttpFiltersSourceAdapter() { @Override public int getMaximumRequestBufferSizeInBytes() { return 1024 * 1024; } @Override public HttpFilters filterRequest(HttpRequest httpRequest, ChannelHandlerContext channelHandlerContext) { return new HttpFiltersAdapter(httpRequest) { @Override public HttpResponse clientToProxyRequest(HttpObject httpObject) { assert httpObject instanceof FullHttpRequest; FullHttpRequest fullHttpRequest = (FullHttpRequest) httpObject; if (httpRequest.getUri().contains("/v3/job/issue")) { jobIssueRequests.add(fullHttpRequest.copy()); } return null; } }; } }).start(); copyResource("acceptance/td/td/td.dig", projectDir.resolve("workflow.dig")); copyResource("acceptance/td/td/query.sql", projectDir.resolve("query.sql")); String proxyUrl = "http://" + proxyServer.getListenAddress().getHostString() + ":" + proxyServer.getListenAddress().getPort(); runWorkflow(ImmutableMap.of("http_proxy", proxyUrl), ImmutableList.of("td.use_ssl=false")); assertThat(jobIssueRequests.size(), is(greaterThan(0))); }</code><technical_language>moving codes a new private method returns HttpProxyServerBootstrap calling this method testRunQueryOnServerWithEnvProxy() reduce duplicated codes</technical_language>

Target:
public void testRunQueryWithEnvProxy() throws Exception { List<FullHttpRequest> requests = Collections.synchronizedList(new ArrayList<>()); proxyServer = startRequestTrackingProxy(requests); copyResource("acceptance/td/td/td.dig", projectDir.resolve("workflow.dig")); copyResource("acceptance/td/td/query.sql", projectDir.resolve("query.sql")); String proxyUrl = "http://" + proxyServer.getListenAddress().getHostString() + ":" + proxyServer.getListenAddress().getPort(); runWorkflow(ImmutableMap.of("http_proxy", proxyUrl), ImmutableList.of("td.use_ssl=false")); assertThat(requests.stream().filter(req -> req.getUri().contains("/v3/job/issue")).count(), is(greaterThan(0L))); }
Source:
<code>public void leaveNode(Tree tree) { if (tree.is(CONDITIONAL_EXPRS)) { ExpressionComplexity currentExpression = Iterables.getLast(statementLevel); currentExpression.decrementNestedExprLevel(); if (currentExpression.isOnFirstExprLevel()) { int complexity = currentExpression.getExprNumberOfOperator(); if (complexity > max) { String message = String.format(MESSAGE, complexity, max); <START> getContext().addIssue(this, tree, message, complexity - max); <END> } currentExpression.resetExprOperatorCounter(); } } else if (tree.is(SCOPES)) { statementLevel.remove(statementLevel.size() - 1); } }</code><technical_language>![MAJOR](<LINK_0> Cast of operands of this substraction operation a "double". [![rule](<LINK_2>](<LINK_1></technical_language>

Target:
public void leaveNode(Tree tree) { if (tree.is(CONDITIONAL_EXPRS)) { ExpressionComplexity currentExpression = Iterables.getLast(statementLevel); currentExpression.decrementNestedExprLevel(); if (currentExpression.isOnFirstExprLevel()) { int complexity = currentExpression.getExprNumberOfOperator(); if (complexity > max) { String message = String.format(MESSAGE, complexity, max); getContext().addIssue(this, tree, message, (double) (complexity - max)); } currentExpression.resetExprOperatorCounter(); } } else if (tree.is(SCOPES)) { statementLevel.remove(statementLevel.size() - 1); } }
Source:
<code>public JdbcConnection(String propertiesFileName) throws IOException { BufferedReader propertiesFileReader = new BufferedReader(new FileReader(new File(propertiesFileName))); try { properties = new Properties(); properties.load(propertiesFileReader); }finally { propertiesFileReader.close(); } jdbcUrl = properties.getProperty(JDBC_URL); user = properties.getProperty(JDBC_USER); password = properties.getProperty(JDBC_PASSWORD); timeout = Integer.parseInt(properties.getProperty(JDBC_TIMEOUT, "600")); LOGGER.info("url {}", jdbcUrl); LOGGER.info("user {}", user); LOGGER.info("password {}", password); <START> LOGGER.info("timeout {}", timeout); <END> }</code><technical_language>join this 4 log statements</technical_language>

Target:
public JdbcConnection(String propertiesFileName) throws IOException { BufferedReader propertiesFileReader = new BufferedReader(new FileReader(new File(propertiesFileName))); try { properties = new Properties(); properties.load(propertiesFileReader); }finally { propertiesFileReader.close(); } jdbcUrl = properties.getProperty(JDBC_URL); user = properties.getProperty(JDBC_USER); password = properties.getProperty(JDBC_PASSWORD); timeout = Integer.parseInt(properties.getProperty(JDBC_TIMEOUT, "600")); LOGGER.info("url {}, user {}, password {}, timeout {}", jdbcUrl, user, password, timeout); }
Source:
<code>public O loadClassFromJar(String jarPath, String classFqdn) throws ClassNotFoundException, MalformedURLException, InstantiationException, IllegalAccessException { ClassLoader classLoader; if (isClassLoadedFromParent(classFqdn)) { classLoader = parentClassLoader; } else { synchronized (cachedClassLoaders) { classLoader = findCachedClassLoader(jarPath); if (classLoader == null) { classLoader = getJarAddedClassLoader(jarPath); } } } O actualObject = initInstanceFromClassloader(classFqdn, classLoader); <START> return createClassLoaderAwareProxyInstance(classLoader, actualObject); <END> }</code><technical_language>This return a proxy instance instead of actual object method call is routed this proxy set unset class loader correct ? Wont this method calls expensive ? Instead if set current thread's context class loader newly created classloader return instance wont work ? time a new classloader created, pass current classloader parent build a chain of classloaders. issue I see, if shaded parser jars conflicting versions of classes, users care of</technical_language>

Target:
public O loadClassFromJar(String jarPath, String classFqdn) throws ClassNotFoundException, MalformedURLException, InstantiationException, IllegalAccessException { ClassLoader classLoader; if (isClassLoadedFromParent(classFqdn)) { classLoader = parentClassLoader; } else { classLoader = findCachedClassLoader(jarPath); if (classLoader == null) { classLoader = getJarAddedClassLoader(jarPath); } } O actualObject = initInstanceFromClassloader(classFqdn, classLoader); return createClassLoaderAwareProxyInstance(classLoader, actualObject); }
Source:
<code>public String getErrorMessage() { return ""; <START> } <END></code><technical_language>result errorMessage applicable for workflows</technical_language>

Target:
public String getErrorMessage() { return mErrorMessage; }
Source:
<code>public static void configureXStreamMappings(XStream toConfigure) { Map<String, Class> XSTREAM_MAPPINGS = new HashMap<String, Class>() { <START> { <END> put("ExpressionElement", ExpressionElement.class); put("ExpressionIdentifier", ExpressionIdentifier.class); put("FactIdentifier", FactIdentifier.class); put("FactMapping", FactMapping.class); put("FactMappingType", FactMappingType.class); put("FactMappingValue", FactMappingValue.class); put("Scenario", Scenario.class); put("ScenarioSimulationModel", ScenarioSimulationModel.class); put("Simulation", Simulation.class); put("SimulationDescriptor", SimulationDescriptor.class); put("Import", Import.class); } }; XSTREAM_MAPPINGS.forEach(toConfigure::alias); }</code><technical_language>this syntax creating a subclass of HashMap everytime this method is invoked. please refactor avoid creation of this map</technical_language>

Target:
public static void configureXStreamMappings(XStream toConfigure) { toConfigure.alias("ExpressionElement", ExpressionElement.class); toConfigure.alias("ExpressionIdentifier", ExpressionIdentifier.class); toConfigure.alias("FactIdentifier", FactIdentifier.class); toConfigure.alias("FactMapping", FactMapping.class); toConfigure.alias("FactMappingType", FactMappingType.class); toConfigure.alias("FactMappingValue", FactMappingValue.class); toConfigure.alias("Scenario", Scenario.class); toConfigure.alias("ScenarioSimulationModel", ScenarioSimulationModel.class); toConfigure.alias("Simulation", Simulation.class); toConfigure.alias("SimulationDescriptor", SimulationDescriptor.class); toConfigure.alias("Import", Import.class); }
Source:
<code>public JobResult removeSpace(final String jobId, final String spaceName) { JobResult result = new JobResult(); result.setJobId(jobId); if (spaceName == null) { result.setStatus(JobStatus.BAD_REQUEST); <START> result.setResult("OrganizationalUnit name must be provided"); <END> return result; } try { organizationalUnitService.removeOrganizationalUnit(spaceName); result.setStatus(JobStatus.SUCCESS); } catch (Exception e) { result.setStatus(JobStatus.FAIL); String errMsg = e.getClass().getSimpleName() + " thrown when trying to remove '" + spaceName + "': " + e.getMessage(); result.setResult(errMsg); logger.error(errMsg, e); } return result; }</code><technical_language>I if result message "Space" instead of "OrganizationalUnit". do think</technical_language>

Target:
public JobResult removeSpace(final String jobId, final String spaceName) { JobResult result = new JobResult(); result.setJobId(jobId); if (spaceName == null) { result.setStatus(JobStatus.BAD_REQUEST); result.setResult("Space name must be provided"); return result; } try { organizationalUnitService.removeOrganizationalUnit(spaceName); result.setStatus(JobStatus.SUCCESS); } catch (Exception e) { result.setStatus(JobStatus.FAIL); String errMsg = e.getClass().getSimpleName() + " thrown when trying to remove '" + spaceName + "': " + e.getMessage(); result.setResult(errMsg); logger.error(errMsg, e); } return result; }
Source:
<code>public boolean hasNext() { boolean hasNext = source.hasNext(); if (!hasNext && prevTablet != null && prevTablet.getEndRow() != null) { Text defaultTabletRow = TabletsSection.getRow(prevTablet.getTableId(), null); if (range.contains(new Key(defaultTabletRow))) { throw new IllegalStateException( <START> "Read all tablets but did not see default tablet. Last tablet seen : " <END> + prevTablet.getExtent()); } } return hasNext; }</code><technical_language>necessarily true tablets read. "scanned range included default tablet, default tablet seen"</technical_language>

Target:
public boolean hasNext() { boolean hasNext = source.hasNext(); if (!hasNext && prevTablet != null && prevTablet.getEndRow() != null) { Text defaultTabletRow = TabletsSection.getRow(prevTablet.getTableId(), null); if (range.contains(new Key(defaultTabletRow))) { throw new IllegalStateException( "Scan range incudled default tablet, but did not see default tablet. Last tablet seen : " + prevTablet.getExtent()); } } return hasNext; }
Source:
<code>private void handleFailingChecks(DomainRouterVO router, List<String> failingChecks) { if (failingChecks == null || failingChecks.size() == 0) { return; } String alertMessage = "Health checks failed: " + failingChecks.size() + " failing checks on router " + router.getUuid(); _alertMgr.sendAlert(AlertType.ALERT_TYPE_DOMAIN_ROUTER, router.getDataCenterId(), router.getPodIdToDeployIn(), alertMessage, alertMessage); s_logger.warn(alertMessage + ". Checking failed health checks to see if router needs reboot"); <START> String checkFailsToRecreateVr = RouterHealthChecksFailuresToRecreateVr.valueIn(router.getDataCenterId()); StringBuilder failingChecksEvent = new StringBuilder("Router " + router.getUuid() + " has failing checks:"); boolean recreateRouter = false; for (String failedCheck : failingChecks) { failingChecksEvent.append(" ").append(failedCheck); if (StringUtils.isNotBlank(checkFailsToRecreateVr) && checkFailsToRecreateVr.contains(failedCheck)) { recreateRouter = true; } } <END> ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, Domain.ROOT_DOMAIN, EventTypes.EVENT_ROUTER_HEALTH_CHECKS, failingChecksEvent.toString()); if (recreateRouter) { s_logger.warn("Health Check Alert: Found failing checks in " + RouterHealthChecksFailuresToRecreateVrCK + ", attempting recreating router."); recreateRouter(router.getId()); } }</code><technical_language>check if a recreate worthy failure happened</technical_language>

Target:
private void handleFailingChecks(DomainRouterVO router, List<String> failingChecks) { if (failingChecks == null || failingChecks.size() == 0) { return; } String alertMessage = "Health checks failed: " + failingChecks.size() + " failing checks on router " + router.getUuid(); _alertMgr.sendAlert(AlertType.ALERT_TYPE_DOMAIN_ROUTER, router.getDataCenterId(), router.getPodIdToDeployIn(), alertMessage, alertMessage); s_logger.warn(alertMessage + ". Checking failed health checks to see if router needs recreate"); String checkFailsToRecreateVr = RouterHealthChecksFailuresToRecreateVr.valueIn(router.getDataCenterId()); StringBuilder failingChecksEvent = new StringBuilder(); boolean recreateRouter = false; for (int i = 0; i < failingChecks.size(); i++) { String failedCheck = failingChecks.get(i); if (i == 0) { failingChecksEvent.append("Router ") .append(router.getUuid()) .append(" has failing checks: "); } failingChecksEvent.append(failedCheck); if (i < failingChecks.size() - 1) { failingChecksEvent.append(", "); } if (StringUtils.isNotBlank(checkFailsToRecreateVr) && checkFailsToRecreateVr.contains(failedCheck)) { recreateRouter = true; } } ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, Domain.ROOT_DOMAIN, EventTypes.EVENT_ROUTER_HEALTH_CHECKS, failingChecksEvent.toString()); if (recreateRouter) { s_logger.warn("Health Check Alert: Found failing checks in " + RouterHealthChecksFailuresToRecreateVrCK + ", attempting recreating router."); recreateRouter(router.getId()); } }
Source:
<code>private Document removeAllChildrenButOne(Document doc, int index) { try { Document clone = (Document) doc.clone(); Element remainingChild = null; ArrayList<Element> recordNodes = (ArrayList<Element>) srwRecordXPath.selectNodes(clone); for (int i = 0; i < recordNodes.size(); i++) { Element currentRecord = recordNodes.get(i); if (i != index) { currentRecord.detach(); } else { remainingChild = currentRecord; } } return remainingChild.getDocument(); } catch (JDOMException e) { <START> e.printStackTrace(); <END> logger.error("Unable to remove children from given document."); return null; } }</code><technical_language>Please remove this e.printStackTrace() call</technical_language>

Target:
private Document removeAllChildrenButOne(Document doc, int index) { try { Document clone = (Document) doc.clone(); Element remainingChild = null; ArrayList<Element> recordNodes = (ArrayList<Element>) srwRecordXPath.selectNodes(clone); for (int i = 0; i < recordNodes.size(); i++) { Element currentRecord = recordNodes.get(i); if (i != index) { currentRecord.detach(); } else { remainingChild = currentRecord; } } if (Objects.equals(remainingChild, null)) { return clone; } return remainingChild.getDocument(); } catch (JDOMException e) { logger.error("Unable to remove children from given document."); return null; } }
Source:
<code>public Props getJobOverrideProperty(final Project project, final Flow flow, final String jobName, final String source) throws ProjectManagerException { <START> if (Double.compare(flow.getAzkabanFlowVersion(), Constants.AZKABAN_FLOW_VERSION_2_0) == 0) { <END> final int flowVersion = this.projectLoader .getLatestFlowVersion(flow.getProjectId(), flow.getVersion(), source); return getPropertiesFromFlowFile(flow, jobName, source, flowVersion); } else { return this.projectLoader.fetchProjectProperty(project, jobName + ".jor"); } }</code><technical_language>above, put check in a util method</technical_language>

Target:
public Props getJobOverrideProperty(final Project project, final Flow flow, final String jobName, final String source) throws ProjectManagerException { if (FlowLoaderUtils.isAzkabanFlowVersion20(flow.getAzkabanFlowVersion())) { final int flowVersion = this.projectLoader .getLatestFlowVersion(flow.getProjectId(), flow.getVersion(), source); return getPropertiesFromFlowFile(flow, jobName, source, flowVersion); } else { return this.projectLoader .fetchProjectProperty(project, jobName + Constants.JOB_OVERRIDE_SUFFIX); } }
Source:
<code>private void createSheet(Workbook wb, String name, String topleft, boolean app, boolean rep, int questionColumns) { Sheet sheet = wb.createSheet(name); Row row0 = sheet.createRow(0); row0.createCell(0).setCellValue(topleft); Row row1 = sheet.createRow(1); int i = 0; row1.createCell(i++).setCellValue("Identifier"); if (app) {row1.createCell(i++).setCellValue("Data approval status");} row1.createCell(i++).setCellValue("Display Name"); if (rep) {row1.createCell(i++).setCellValue("Repeat no");} row1.createCell(i++).setCellValue("Device identifier"); row1.createCell(i++).setCellValue("Instance"); row1.createCell(i++).setCellValue("Submission Date"); row1.createCell(i++).setCellValue("Submitter"); row1.createCell(i++).setCellValue("Duration"); row1.createCell(i++).setCellValue("Form version"); sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, i - 1)); for (int j = 0; j < questionColumns; j++) { <START> row1.createCell(i + j).setCellValue(j + "|Question" + j); <END> } }</code><technical_language>a good idea simulate real question IDs like.. e.g. 1230001</technical_language>

Target:
private void createSheet(Workbook wb, String name, String topleft, boolean app, boolean rep, int questionColumns) { Sheet sheet = wb.createSheet(name); Row row0 = sheet.createRow(0); row0.createCell(0).setCellValue(topleft); Row row1 = sheet.createRow(1); int i = 0; row1.createCell(i++).setCellValue("Identifier"); if (app) {row1.createCell(i++).setCellValue("Data approval status");} row1.createCell(i++).setCellValue("Display Name"); if (rep) {row1.createCell(i++).setCellValue("Repeat no");} row1.createCell(i++).setCellValue("Device identifier"); row1.createCell(i++).setCellValue("Instance"); row1.createCell(i++).setCellValue("Submission Date"); row1.createCell(i++).setCellValue("Submitter"); row1.createCell(i++).setCellValue("Duration"); row1.createCell(i++).setCellValue("Form version"); sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, i - 1)); for (int j = 0; j < questionColumns; j++) { row1.createCell(i + j).setCellValue((123000 + j) + "|Question" + j); } }
Source:
<code>T unFocus() { if (unFocusDelay > 0) { <START> unFocusDelayTimer.schedule(unFocusDelay); <END> } else { unFocusDelayTimer.run(); } return cast(); }</code><technical_language>I notice elsewhere, if timer is running cancel first. need here</technical_language>

Target:
T unFocus() { cancelUnFocusTimer(); if (unFocusDelay > 0) { unFocusDelayTimer.schedule(unFocusDelay); } else { unFocusDelayTimer.run(); } return cast(); }
Source:
<code>public boolean shootLaser() { if (shark.getAmmo() > 0) { shark.decreaseAmmo(); <START> addFish(fishSpawner.createLaser(this.shark)); <END> return true; } return false; }</code><technical_language>this method named add seaObject</technical_language>

Target:
public boolean shootLaser() { if (shark.getAmmo() > 0) { shark.decreaseAmmo(); addFish(laserSpawner.createLaser(this.shark)); return true; } return false; }
Source:
<code>public Poll withNumberOfOptions(int number){ this.options = new String[number]; <START> for (int i = 0; i < number; i++) <END> this.options[i] = TestStringUtils.randomString(10); return this; }</code><technical_language>put in for if.</technical_language>

Target:
public Poll withNumberOfOptions(int number){ this.options = new String[number]; for (int i = 0; i < number; i++) { this.options[i] = randomAlphanumeric(10); } return this; }
Source:
<code>public void runJobLocked(final Runnable action) { log.info("Trying to run job..."); if (!timeToRunAction()) { return; } if (!createJobLockNode()) { return; } if (!timeToRunAction()) { <START> return; <END> } try { log.info("Execution of job will be performed on this instance"); action.run(); updateJobTimestamp(); } catch (final JsonProcessingException e) { log.error("Json processing error when updating job timestamp in ZK", e); } catch (final Exception e) { log.error("Zookeeper error when performing job", e); } finally { deleteJobLockNode(); } }</code><technical_language>release lock here</technical_language>

Target:
public void runJobLocked(final Runnable action) { log.info("Trying to run job..."); if (!timeToRunAction()) { return; } if (!createJobLockNode()) { return; } try { if (!timeToRunAction()) { return; } log.info("Job will be executed on this instance"); action.run(); updateJobTimestamp(); } catch (final JsonProcessingException e) { log.error("Json processing error when updating job timestamp in ZK", e); } catch (final Exception e) { log.error("Zookeeper error when performing job", e); } finally { deleteJobLockNode(); } }
Source:
<code>public void sendAuditLog(HttpServletRequest request, Object requestBody, int responseCode, Object responseObject, GenerateAuditLog auditLogAnnotation) { try { AuditLogContextBuilder auditLogContextBuilder = AuditLogContextBuilder.create() .withTimestamp(OffsetDateTime.now().toString()).withLogId(UUID.randomUUID()).withRequestId(UUID.randomUUID()) .withApplicationId(auditLogAnnotation.application()).withEventType(auditLogAnnotation.eventType()) .withEventCategory(auditLogAnnotation.eventCategory()).withEventOperation(auditLogAnnotation.eventOperation()) .withUserId(auditUserProvider.getUserId()).withUsername(auditUserProvider.getUsername()) .withEmail(auditUserProvider.getUserEmail()).withAccountId(auditUserProvider.getAccountId()) .withRequest(request, requestBody).withResponse(responseCode, (auditLogAnnotation.includeBodyResponse() && responseObject != null) ? objectMapper.writeValueAsString(responseObject) : null); AuditContextFilter filter = auditLogAnnotation.filter().getDeclaredConstructor().newInstance(); auditLogContextBuilder = filter.filter(auditLogContextBuilder, requestBody, responseObject); <START> auditLogger.sendAuditLog(auditLogContextBuilder.build()); <END> LOGGER.info("audit log generated with metadata {}", auditLogAnnotation); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | IOException | AuditLogException e) { LOGGER.error("audit log with metadata has not been generated", auditLogAnnotation, e); } }</code><technical_language>(don't bothering you) replace this line this.sendAuditLog(auditLogContextBuilder.build())? IMHO more proper. this method is intended do</technical_language>

Target:
public void sendAuditLog(HttpServletRequest request, Object requestBody, int responseCode, Object responseObject, GenerateAuditLog auditLogAnnotation) { try { AuditLogContextBuilder auditLogContextBuilder = AuditLogContextBuilder.create() .withTimestamp(OffsetDateTime.now().toString()) .withLogId(UUID.randomUUID()) .withRequestId(UUID.randomUUID()) .withApplicationId(auditLogAnnotation.application()) .withEventType(auditLogAnnotation.eventType()) .withEventCategory(auditLogAnnotation.eventCategory()) .withEventOperation(auditLogAnnotation.eventOperation()) .withUserId(auditUserProvider.getUserId()) .withUsername(auditUserProvider.getUsername()) .withEmail(auditUserProvider.getUserEmail()) .withAccountId(auditUserProvider.getAccountId()) .withRequest(request, requestBody) .withResponse(responseCode, auditLogAnnotation.includeBodyResponse() ? responseObject : null); AuditContextFilter filter = auditLogAnnotation.filter().getDeclaredConstructor().newInstance(); auditLogContextBuilder = filter.filter(auditLogContextBuilder, requestBody, responseObject); this.sendAuditLog(auditLogContextBuilder.build()); LOGGER.info("audit log generated with metadata {}", auditLogAnnotation); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | AuditLogException e) { LOGGER.error("audit log with metadata has not been generated", auditLogAnnotation, e); } }