auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (!ctx.channel().isActive()) { ReferenceCountUtil.release(msg); return; } if (msg instanceof HttpRequestMessage) { promise.addListener((future) -> { if (!future.isSuccess()) { Throwable cause = ctx.channel().attr(SSL_HANDSHAKE_UNSUCCESS_FROM_ORIGIN_THROWABLE).get(); if (cause != null) { ctx.channel().attr(SSL_HANDSHAKE_UNSUCCESS_FROM_ORIGIN_THROWABLE).set(null); fireWriteError("request headers", cause, ctx); } else { fireWriteError("request headers", future.cause(), ctx); } } }); HttpRequestMessage zuulReq = (HttpRequestMessage) msg; preWriteHook(ctx, zuulReq); super.write(ctx, buildOriginHttpRequest(zuulReq), promise); } else if (msg instanceof HttpContent) { promise.addListener((future) -> { if (!future.isSuccess()) { fireWriteError("request content chunk", future.cause(), ctx); } }); super.write(ctx, msg, promise); } else { ReferenceCountUtil.release(msg); throw new ZuulException("Received invalid message from client", true); } }

Target:
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (!ctx.channel().isActive()) { ReferenceCountUtil.release(msg); return; } if (msg instanceof HttpRequestMessage) { promise.addListener((future) -> { if (!future.isSuccess()) { Throwable cause = ctx.channel().attr(SSL_HANDSHAKE_UNSUCCESS_FROM_ORIGIN_THROWABLE).get(); if (cause != null) { ctx.channel().attr(SSL_HANDSHAKE_UNSUCCESS_FROM_ORIGIN_THROWABLE).set(null); fireWriteError("request headers", cause, ctx); LOG.debug("SSLException is overridden by SSLHandshakeException caught in handler level. Original SSL exception message: ", future.cause()); } else { fireWriteError("request headers", future.cause(), ctx); } } }); HttpRequestMessage zuulReq = (HttpRequestMessage) msg; preWriteHook(ctx, zuulReq); super.write(ctx, buildOriginHttpRequest(zuulReq), promise); } else if (msg instanceof HttpContent) { promise.addListener((future) -> { if (!future.isSuccess()) { fireWriteError("request content chunk", future.cause(), ctx); } }); super.write(ctx, msg, promise); } else { ReferenceCountUtil.release(msg); throw new ZuulException("Received invalid message from client", true); } }
Source:
public String saveOrUpdate(@Valid @ModelAttribute StateHistoryDTO stateHistoryDTO, BindingResult result, RedirectAttributes redirectAttributes) { if (!result.hasErrors()) { stateHistoryDTO.setStateDTO(new StateDTO(1L, "newstate")); ApplicationDTO applicationDTO = ApplicationDTO.builder() .creationDate(new Date()) .candidateId(stateHistoryDTO.getCandidateId()) .positionId(stateHistoryDTO.getPosition().getId()) .channelId(stateHistoryDTO.getChannel().getId()) .deleted(false) .build(); applicationsService.saveApplication(applicationDTO, stateHistoryDTO); return "redirect:/secure/candidate/details/" + stateHistoryDTO.getCandidateId(); } redirectAttributes.addFlashAttribute(COMMON_INVALID_INPUT_MESSAGE_NAME, this.messageKeyResolver.resolveMessageOrDefault(COMMON_INVALID_INPUT_MESSAGE_KEY)); result.getFieldErrors().forEach(error -> redirectAttributes.addFlashAttribute(error.getField() + "ErrorMessage", messageKeyResolver.resolveMessageOrDefault(error.getDefaultMessage()))); return "redirect:/secure/application?candidateId=" + stateHistoryDTO.getCandidateId(); }

Target:
public String saveOrUpdate(@Valid @ModelAttribute StateHistoryDTO stateHistoryDTO, BindingResult result, RedirectAttributes redirectAttributes) { if (!result.hasErrors()) { stateHistoryDTO.setStateDTO(new StateDTO(1L, "newstate")); ApplicationDTO applicationDTO = ApplicationDTO.builder() .creationDate(new Date()) .candidateId(stateHistoryDTO.getCandidateId()) .positionId(stateHistoryDTO.getPosition().getId()) .channelId(stateHistoryDTO.getChannel().getId()) .deleted(false) .build(); applicationsService.saveApplication(applicationDTO, stateHistoryDTO); redirectAttributes.addAttribute("candidateId", stateHistoryDTO.getCandidateId()); return "redirect:/secure/candidate/details/{candidateId}"; } result.getFieldErrors().forEach(error -> redirectAttributes.addFlashAttribute(error.getField() + "ErrorMessage", messageKeyResolver.resolveMessageOrDefault(error.getDefaultMessage()))); redirectAttributes.addAttribute("candidateId", stateHistoryDTO.getCandidateId()); return "redirect:/secure/application"; }
Source:
public void testDynamicImport2() { withModules(ImmutableList.<String>builder() .add("export default 1; export function Bar() { return 'bar'; };") .add("const foo = import('./testcode0');") .build()); assertType(getType("foo")) .toStringIsEqualTo("Promise<{\n" + " Bar: function(): string,\n" + " default: number\n" + "}>"); }

Target:
public void testDynamicImport2() { withModules(ImmutableList.of( "export default 1; export function Bar() { return 'bar'; };", "const foo = import('./testcode0');")); assertType(getType("foo")) .toStringIsEqualTo("Promise<{\n" + " Bar: function(): string,\n" + " default: number\n" + "}>"); }
Source:
@Test public void testArrayGetClone() throws Exception { Run("@a = array(array(array('value'))); @b = @a[]; @b[0][0][0] = 'changedValue'; msg(@a[0][0][0]);", fakePlayer); verify(fakePlayer).sendMessage("value"); }

Target:
@Test public void testArrayGetClone() throws Exception { Run("@a = array(array(array('value'))); @b = @a[]; @b[0][0][0] = 'changedValue'; msg(@a[0][0][0]); msg(@b[0][0][0]);", fakePlayer); verify(fakePlayer).sendMessage("value"); verify(fakePlayer).sendMessage("changedValue"); }
Source:
private DateTimeService buildMockDateTimeService() throws Exception { DateTimeService dateTimeService = Mockito.mock(DateTimeService.class); Mockito.when(dateTimeService.toDateTimeStringForFilename(Mockito.any())).then(this::formatDate); Mockito.when(dateTimeService.getCurrentDate()).thenReturn(new Date()); return dateTimeService; }

Target:
private DateTimeService buildMockDateTimeService() throws Exception { DateTimeService dateTimeService = Mockito.mock(DateTimeService.class); Mockito.when(dateTimeService.toDateTimeStringForFilename(Mockito.any())).then(this::formatDate); Mockito.when(dateTimeService.getCurrentDate()).then(this::buildNewDate); return dateTimeService; }
Source:
public void onComplete(ISegmentStore<ISegment> sysCalls) { if (fTableViewer != null) { fTableViewer.updateModel(getData()); } }

Target:
public void onComplete(ISegmentStore<ISegment> sysCalls) { if (fTableViewer != null){ fTableViewer.updateModel(LatencyViewerUtils.storeAndGet(sysCalls)); } }
Source:
public LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout layout) { super(REQUIRMENT_TYPE); Set<@NonNull String> requiredEventsFields = ImmutableSet.of( layout.contextProcname(), layout.contextVtid()); TmfAnalysisEventFieldRequirement requirement = new TmfAnalysisEventFieldRequirement( layout.eventCygProfileFuncEntry(), requiredEventsFields, ValuePriorityLevel.MANDATORY); fEntryRequirements.add(requirement); addValue(layout.eventCygProfileFuncEntry(), ValuePriorityLevel.MANDATORY); requirement = new TmfAnalysisEventFieldRequirement( layout.eventCygProfileFastFuncEntry(), requiredEventsFields, ValuePriorityLevel.MANDATORY); fEntryRequirements.add(requirement); requirement = new TmfAnalysisEventFieldRequirement( layout.eventCygProfileFuncExit(), requiredEventsFields, ValuePriorityLevel.MANDATORY); fExitRequirements.add(requirement); requirement = new TmfAnalysisEventFieldRequirement( layout.eventCygProfileFastFuncExit(), requiredEventsFields, ValuePriorityLevel.MANDATORY); fExitRequirements.add(requirement); addValue(layout.eventCygProfileFuncExit(), ValuePriorityLevel.MANDATORY); addValue(layout.eventCygProfileFuncExit(), ValuePriorityLevel.MANDATORY); addValues(requiredEventsFields, ValuePriorityLevel.MANDATORY); addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation)); }

Target:
public LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout layout) { super(REQUIREMENT_TYPE); Set<@NonNull String> requiredEventsFields = ImmutableSet.of( layout.contextProcname(), layout.contextVtid()); TmfAnalysisEventFieldRequirement requirement = new TmfAnalysisEventFieldRequirement( layout.eventCygProfileFuncEntry(), requiredEventsFields, ValuePriorityLevel.MANDATORY); fEntryRequirements.add(requirement); addValue(layout.eventCygProfileFuncEntry(), ValuePriorityLevel.MANDATORY); requirement = new TmfAnalysisEventFieldRequirement( layout.eventCygProfileFastFuncEntry(), requiredEventsFields, ValuePriorityLevel.MANDATORY); fEntryRequirements.add(requirement); requirement = new TmfAnalysisEventFieldRequirement( layout.eventCygProfileFuncExit(), requiredEventsFields, ValuePriorityLevel.MANDATORY); fExitRequirements.add(requirement); requirement = new TmfAnalysisEventFieldRequirement( layout.eventCygProfileFastFuncExit(), requiredEventsFields, ValuePriorityLevel.MANDATORY); fExitRequirements.add(requirement); addValue(layout.eventCygProfileFuncExit(), ValuePriorityLevel.MANDATORY); addValues(requiredEventsFields, ValuePriorityLevel.MANDATORY); addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation)); }
Source:
private void correctKSUDateFormatIfNecessary(final Table<String, String, String> table, final List<MeasurementVariable> measurementVariables) { final List<String> dateMeasurementVariables = measurementVariables.stream().filter(measurementVariable -> measurementVariable.getDataTypeId() == TermId.DATE_VARIABLE .getId()).collect(Collectors.toList()).stream().map(measurementVariable -> measurementVariable.getName()).collect(Collectors.toList()); if (dateMeasurementVariables != null) { for (final String obsUnit : table.rowKeySet()) { for (final String colVariable : table.columnKeySet()) { if (dateMeasurementVariables.contains(colVariable)) { String value = table.get(obsUnit, colVariable); final Date parsed = Util.tryParseDateAccurately(value, Util.DATE_AS_NUMBER_FORMAT); if (parsed == null) { final Date ksuParsed = Util.tryParseDateAccurately(value, Util.DATE_AS_NUMBER_FORMAT_KSU); if (ksuParsed != null){ value = Util.formatDateAsStringValue(ksuParsed, Util.DATE_AS_NUMBER_FORMAT); table.put(obsUnit, colVariable, value); } } } } } } }

Target:
private void correctKSUDateFormatIfNecessary(final Table<String, String, String> table, final List<MeasurementVariable> measurementVariables) { final List<String> dateVariables = measurementVariables.stream().filter( measurementVariable -> measurementVariable.getDataTypeId() != null && measurementVariable.getDataTypeId() == TermId.DATE_VARIABLE.getId()) .map(measurementVariable -> measurementVariable.getName()).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(dateVariables)) { for (final String colVariable : table.columnKeySet()) { if (dateVariables.contains(colVariable)) { for (final String obsUnit : table.rowKeySet()) { String value = table.get(obsUnit, colVariable); final Date ksuParsed = Util.tryParseDate(value, Util.DATE_AS_NUMBER_FORMAT_KSU); if (ksuParsed != null) { value = Util.formatDateAsStringValue(ksuParsed, Util.DATE_AS_NUMBER_FORMAT); table.put(obsUnit, colVariable, value); } } } } } }
Source:
ZoneId getZoneId() { throw new UnsupportedTemporalUnitException( "Cannot get the timezone of: %s" + this ); }

Target:
ZoneId getZoneId() { throw new UnsupportedTemporalUnitException( String.format( "Cannot get the timezone of: %s", this ) ); }
Source:
protected BAMIndexContent getQueryResults(final int referenceIndex) { if(lastReferenceIndex!=null && lastReferenceIndex == referenceIndex){ if(lastReference != null) { cacheHits++; return lastReference; } else { throw new RuntimeException("Expected to find a cached reference but we found null. This is a bug."); } } BAMIndexContent queryResults = query(referenceIndex,1,-1); if(queryResults != null) { cacheMisses++; lastReferenceIndex = referenceIndex; lastReference = queryResults; return lastReference; } return null; }

Target:
protected BAMIndexContent getQueryResults(final int referenceIndex) { if(lastReferenceIndex!=null && lastReferenceIndex == referenceIndex){ cacheHits++; return lastReference; } final BAMIndexContent queryResults = query(referenceIndex,1,-1); cacheMisses++; lastReferenceIndex = referenceIndex; lastReference = queryResults; return lastReference; }
Source:
public byte[] userToBytes(GenericRecord user) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(out, null); DatumWriter<GenericRecord> writer = new GenericDatumWriter<>(schema); writer.write(user, encoder); encoder.flush(); out.close(); return out.toByteArray(); }

Target:
public byte[] userToBytes(GenericRecord user) throws IOException { return recordToBytes(user, schema); }
Source:
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain) throws ServletException, IOException { SiteContext siteContext = SiteContext.getCurrent(); HierarchicalConfiguration corsConfig = siteContext.getConfig().configurationAt(CONFIG_KEY); HttpServletResponseWrapper responseWrapper = new HttpServletResponseWrapper(response); responseWrapper.setHeader(CORSFilter.ALLOW_ORIGIN, corsConfig.getString(ALLOW_ORIGIN_KEY)); responseWrapper.setHeader(CORSFilter.ALLOW_CREDENTIALS, corsConfig.getString(ALLOW_CREDENTIALS_KEY)); responseWrapper.setHeader(CORSFilter.ALLOW_METHODS, corsConfig.getString(ALLOW_METHODS_KEY)); responseWrapper.setHeader(CORSFilter.ALLOW_HEADERS, corsConfig.getString(ALLOW_HEADERS_KEY)); responseWrapper.setHeader(CORSFilter.MAX_AGE, corsConfig.getString(MAX_AGE_KEY)); filterChain.doFilter(request, responseWrapper); }

Target:
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain) throws ServletException, IOException { SiteContext siteContext = SiteContext.getCurrent(); HierarchicalConfiguration corsConfig = siteContext.getConfig().configurationAt(CONFIG_KEY); response.setHeader(CORSFilter.ALLOW_ORIGIN, corsConfig.getString(ALLOW_ORIGIN_KEY, ALLOW_ORIGIN_DEFAULT)); response.setHeader(CORSFilter.ALLOW_CREDENTIALS, corsConfig.getString(ALLOW_CREDENTIALS_KEY, ALLOW_CREDENTIALS_DEFAULT)); response.setHeader(CORSFilter.ALLOW_METHODS, corsConfig.getString(ALLOW_METHODS_KEY, ALLOW_METHODS_DEFAULT)); response.setHeader(CORSFilter.ALLOW_HEADERS, corsConfig.getString(ALLOW_HEADERS_KEY, ALLOW_HEADERS_DEFAULT)); response.setHeader(CORSFilter.MAX_AGE, corsConfig.getString(MAX_AGE_KEY, MAX_AGE_DEFAULT)); filterChain.doFilter(request, response); }
Source:
private void assertExistsRewrittenToAggregationAboveJoin(@Language("SQL") String actual, @Language("SQL") String expected, boolean extraAggregation) { Consumer<Plan> singleAggregationValidator = plan -> assertEquals(countSingleAggregationNodes(plan), 1); Consumer<Plan> finalAggregationValidator = plan -> assertEquals(countFinalAggregationNodes(plan), extraAggregation ? 1 : 0); assertions.assertQueryAndPlan(actual, expected, anyTree( aggregation(ImmutableMap.of("COUNT", functionCall("count", ImmutableList.of("NON_NULL"))), node(JoinNode.class, anyTree( node(ValuesNode.class)), anyTree( node(ProjectNode.class, anyTree( node(ValuesNode.class))) .withAlias("NON_NULL", expression("true")))))), singleAggregationValidator.andThen(finalAggregationValidator)); }

Target:
private void assertExistsRewrittenToAggregationAboveJoin(@Language("SQL") String actual, @Language("SQL") String expected, boolean extraAggregation) { Consumer<Plan> singleStreamingAggregationValidator = plan -> assertEquals(countSingleStreamingAggregations(plan), 1); Consumer<Plan> finalAggregationValidator = plan -> assertEquals(countFinalAggregationNodes(plan), extraAggregation ? 1 : 0); assertions.assertQueryAndPlan(actual, expected, anyTree( aggregation( ImmutableMap.of("COUNT", functionCall("count", ImmutableList.of("NON_NULL"))), SINGLE, node(JoinNode.class, anyTree( node(ValuesNode.class)), anyTree( node(ProjectNode.class, anyTree( node(ValuesNode.class))) .withAlias("NON_NULL", expression("true")))))), singleStreamingAggregationValidator.andThen(finalAggregationValidator)); }
Source:
private void parseReportsXML() { RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, "/" + BaseContextPathData.getInstance().getRelativePath() + "services/reports-xml"); try { requestBuilder.sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { scheduleCheckStatus(); setXmlInitialized(); } @Override public void onResponseReceived(Request request, Response response) { try { switch (response.getStatusCode()) { case Response.SC_NOT_FOUND: scheduleCheckStatus(); break; case Response.SC_OK: if (ReportParser.getInstance().parseReport(response.getText())) { resourceMap = ReportParser.getInstance().getResourceMap(); dashboardMap = ReportParser.getInstance().getDashboardMap(); isCommunityEdition = ReportParser.getInstance().isCommunityEdition(); } break; } } catch (DOMParseException e) { } finally { setXmlInitialized(); } } }); } catch (RequestException e) { setXmlInitialized(); } }

Target:
private void parseReportsXML() { try { constructRequestBuilder("/" + BaseContextPathData.getInstance().getRelativePath() + "services/reports-xml").sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { if (!reportBaseUrl.trim().isEmpty()) { scheduleCheckStatus(); } setXmlInitialized(); } @Override public void onResponseReceived(Request request, Response response) { try { switch (response.getStatusCode()) { case Response.SC_NOT_FOUND: if (!reportBaseUrl.trim().isEmpty()) { scheduleCheckStatus(); } break; case Response.SC_OK: if (ReportParser.getInstance().parseReport(response.getText())) { resourceMap = ReportParser.getInstance().getResourceMap(); dashboardMap = ReportParser.getInstance().getDashboardMap(); isCommunityEdition = ReportParser.getInstance().isCommunityEdition(); } break; } } catch (DOMParseException e) { } finally { setXmlInitialized(); } } }); } catch (RequestException e) { setXmlInitialized(); } }
Source:
public File getWorkDir() throws IllegalStateException { if (getConfig().getBoolean("core", "bare", false)) throw new IllegalStateException( "Bare Repository does not have a working directory"); return workDir; }

Target:
public File getWorkDir() throws IllegalStateException { if (getConfig().getBoolean(Constants.CONFIG_CORE_SECTION, Constants.CONFIG_KEY_BARE, false)) throw new IllegalStateException( "Bare Repository does not have a working directory"); return workDir; }
Source:
public CompositeEvent(CompositeEvent compositeEvent) { this.events = compositeEvent.events; this.similarityBetweenEvents = compositeEvent.similarityBetweenEvents; }

Target:
public CompositeEvent(CompositeEvent compositeEvent) { this.events = new ArrayList<>(compositeEvent.events); this.similarityBetweenEvents = compositeEvent.similarityBetweenEvents; }
Source:
public Mono<AccessToken> getToken(String... scopes) { if (clientId() == null) { throw new IllegalArgumentException("Must provide non-null value for client id in " + this.getClass().getSimpleName()); } return identityClient.authenticateWithCurrentlyLoggedInAccount(scopes).onErrorResume(t -> Mono.empty()) .switchIfEmpty(identityClient.authenticateWithBrowserInteraction(clientId(), scopes, port)); }

Target:
public Mono<AccessToken> getToken(String... scopes) { return Mono.defer(() -> { if (cachedToken.get() != null) { return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()).onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } }).switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithBrowserInteraction(scopes, port))) .map(msalToken -> { cachedToken.set(msalToken); return msalToken; }); }
Source:
public synchronized void check() { LOG.debug("Runtimes consistency checks is running"); for (String runningWorkspaceId : workspaceRuntimes.getRunning()) { checkOne(runningWorkspaceId); } }

Target:
public void check() { LOG.debug("Runtimes consistency check is running"); for (String runningWorkspaceId : workspaceRuntimes.getRunning()) { try { checkOne(runningWorkspaceId); } catch (InfrastructureException e) { LOG.error( "Checking consistency of runtime for workspace `{}` is failed. Cause: ", e.getMessage(), e); } } }
Source:
private double evaluateRootTimed(int timeout) throws EvaluationException { Future<Double> result = evalThread.submit(this::evaluateRoot); try { return result.get(timeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (TimeoutException e) { result.cancel(true); throw new ExpressionTimeoutException("Calculations exceeded time limit."); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof ReturnException) { throw (ReturnException) cause; } if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new RuntimeException(cause); } }

Target:
private double evaluateRootTimed(int timeout) throws EvaluationException { Future<Double> result = evalThread.submit(this::evaluateRoot); try { return result.get(timeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (TimeoutException e) { result.cancel(true); throw new ExpressionTimeoutException("Calculations exceeded time limit."); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof EvaluationException) { throw (EvaluationException) cause; } if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new RuntimeException(cause); } }
Source:
public static Update addWriteOptions(Update update, WriteOptions writeOptions) { Assert.notNull(update, "Update must not be null"); addQueryOptions(update, writeOptions); if (!writeOptions.getTtl().isNegative()) { update.using(QueryBuilder.ttl(Math.toIntExact(writeOptions.getTtl().getSeconds()))); } if (!(writeOptions.getTimestamp() < 0)) { update.using(QueryBuilder.timestamp(writeOptions.getTimestamp())); } return update; }

Target:
public static Update addWriteOptions(Update update, WriteOptions writeOptions) { Assert.notNull(update, "Update must not be null"); addQueryOptions(update, writeOptions); if (!writeOptions.getTtl().isNegative()) { update.using(QueryBuilder.ttl(Math.toIntExact(writeOptions.getTtl().getSeconds()))); } if (writeOptions.getTimestamp() != null) { update.using(QueryBuilder.timestamp(writeOptions.getTimestamp())); } return update; }
Source:
public void run() { try { final ODatabaseDocumentEmbedded newDb = new ODatabaseDocumentEmbedded(storage); newDb.activateOnCurrentThread(); newDb.resetInitialization(); newDb.internalOpen("admin", "nopass", null, false); final Collection<ODocument> indexesToRebuild; acquireExclusiveLock(); try { final Collection<ODocument> knownIndexes = document.field(CONFIG_INDEXES); if (knownIndexes == null) { OLogManager.instance().warn(this, "List of indexes is empty"); indexesToRebuild = Collections.emptyList(); } else { indexesToRebuild = new ArrayList<>(); for (ODocument index : knownIndexes) indexesToRebuild.add(index.copy()); } } finally { releaseExclusiveLock(); } if (storage instanceof OAbstractPaginatedStorage) { final OAbstractPaginatedStorage abstractPaginatedStorage = (OAbstractPaginatedStorage) storage; abstractPaginatedStorage.getAtomicOperationsManager().switchOnUnsafeMode(); } try { recreateIndexes(indexesToRebuild, newDb); } finally { if (storage instanceof OAbstractPaginatedStorage) { final OAbstractPaginatedStorage abstractPaginatedStorage = (OAbstractPaginatedStorage) storage; abstractPaginatedStorage.getAtomicOperationsManager().switchOffUnsafeMode(); abstractPaginatedStorage.synch(); } newDb.close(); } } catch (Exception e) { OLogManager.instance().error(this, "Error when attempt to restore indexes after crash was performed", e); } }

Target:
public void run() { try { final ODatabaseDocumentEmbedded newDb = new ODatabaseDocumentEmbedded(storage); newDb.activateOnCurrentThread(); newDb.resetInitialization(); newDb.internalOpen("admin", "nopass", null, false); final Collection<ODocument> indexesToRebuild; acquireExclusiveLock(); try { final Collection<ODocument> knownIndexes = document.field(CONFIG_INDEXES); if (knownIndexes == null) { OLogManager.instance().warn(this, "List of indexes is empty"); indexesToRebuild = Collections.emptyList(); } else { indexesToRebuild = new ArrayList<>(); for (ODocument index : knownIndexes) indexesToRebuild.add(index.copy()); } } finally { releaseExclusiveLock(); } try { recreateIndexes(indexesToRebuild, newDb); } finally { if (storage instanceof OAbstractPaginatedStorage) { final OAbstractPaginatedStorage abstractPaginatedStorage = (OAbstractPaginatedStorage) storage; abstractPaginatedStorage.synch(); } newDb.close(); } } catch (Exception e) { OLogManager.instance().error(this, "Error when attempt to restore indexes after crash was performed", e); } }
Source:
private void initContentNode() { final Node contentRootNode = nodeService.getByPath( ContentConstants.CONTENT_ROOT_PATH ); final User user = ContextAccessor.current().getAuthInfo().getUser(); if ( contentRootNode == null ) { LOG.info( "Content root-node not found, creating" ); PropertyTree data = new PropertyTree(); data.setString( ContentPropertyNames.TYPE, "base:folder" ); data.setString( ContentPropertyNames.DISPLAY_NAME, "Content" ); data.addSet( ContentPropertyNames.DATA ); data.addSet( ContentPropertyNames.FORM ); data.setString( ContentPropertyNames.CREATOR, user.getKey().toString() ); data.setInstant( ContentPropertyNames.CREATED_TIME, Instant.now() ); final Node contentRoot = nodeService.create( CreateNodeParams.create(). data( data ). name( ContentConstants.CONTENT_ROOT_NAME ). parent( NodePath.ROOT ). permissions( this.accessControlList != null ? this.accessControlList : CONTENT_ROOT_DEFAULT_ACL ). childOrder( CONTENT_DEFAULT_CHILD_ORDER ). build() ); LOG.info( "Created content root-node: " + contentRoot.path() ); nodeService.refresh( RefreshMode.ALL ); nodeService.push( NodeIds.from( contentRoot.id() ), ContentConstants.BRANCH_DRAFT ); } }

Target:
private void initContentNode() { final Node contentRootNode = nodeService.getByPath( ContentConstants.CONTENT_ROOT_PATH ); final User user = ContextAccessor.current().getAuthInfo().getUser(); if ( contentRootNode == null ) { LOG.info( "Content root-node not found, creating" ); PropertyTree data = new PropertyTree(); data.setString( ContentPropertyNames.TYPE, "base:folder" ); data.setString( ContentPropertyNames.DISPLAY_NAME, "Content" ); data.addSet( ContentPropertyNames.DATA ); data.addSet( ContentPropertyNames.FORM ); data.setString( ContentPropertyNames.CREATOR, user.getKey().toString() ); data.setInstant( ContentPropertyNames.CREATED_TIME, Instant.now() ); final Node contentRoot = nodeService.create( CreateNodeParams.create(). data( data ). name( ContentConstants.CONTENT_ROOT_NAME ). parent( NodePath.ROOT ). permissions( this.accessControlList ). childOrder( CONTENT_DEFAULT_CHILD_ORDER ). build() ); LOG.info( "Created content root-node: " + contentRoot.path() ); nodeService.refresh( RefreshMode.ALL ); nodeService.push( NodeIds.from( contentRoot.id() ), ContentConstants.BRANCH_DRAFT ); } }
Source:
public String getId() { return "DISTANCE"; }

Target:
public String getId() { return "minecraft:distance"; }
Source:
JPAConfiguration provideConfiguration(PropertiesProvider propertiesProvider) throws FileNotFoundException, ConfigurationException { PropertiesConfiguration dataSource = propertiesProvider.getConfiguration("james-database"); return JPAConfiguration.builder() .driverName(dataSource.getString("database.driverClassName")) .driverURL(dataSource.getString("database.url")) .testOnBorrow(dataSource.getBoolean("datasource.testOnBorrow", false)) .validationQueryTimeoutSec(dataSource.getInt("datasource.validationQueryTimeoutSec", -1)) .validationQuery(dataSource.getString("datasource.validationQuery", null)) .build(); }

Target:
JPAConfiguration provideConfiguration(PropertiesProvider propertiesProvider) throws FileNotFoundException, ConfigurationException { PropertiesConfiguration dataSource = propertiesProvider.getConfiguration("james-database"); return JPAConfiguration.builder() .driverName(dataSource.getString("database.driverClassName")) .driverURL(dataSource.getString("database.url")) .testOnBorrow(dataSource.getBoolean("datasource.testOnBorrow", false)) .validationQueryTimeoutSec(dataSource.getInt("datasource.validationQueryTimeoutSec", JPAConstants.VALIDATION_NO_TIMEOUT)) .validationQuery(dataSource.getString("datasource.validationQuery", null)) .build(); }
Source:
public CachedMongoClientProvider(int duration, TimeUnit unit) { final RemovalListener<MongoClientURI, MongoClient> removalListener = notification -> { final MongoClient client = notification.getValue(); try { LOGGER.debug("Closing '{}' due to '{}'.", client, notification.getCause()); client.close(); } catch (Exception e) { LOGGER.error("Unable to properly close '{}'.", client, e); } }; final CacheLoader<MongoClientURI, MongoClient> factory = new CacheLoader<MongoClientURI, MongoClient>() { public MongoClient load(MongoClientURI uri) throws Exception { try { LOGGER.debug("Adding new mongo client for '{}'.", uri); return new MongoClient(uri); } catch (UnknownHostException e) { throw new InvalidDataAccessResourceUsageException("Unable to retrieve host information.", e); } } }; cache = CacheBuilder.newBuilder() .concurrencyLevel(100) .maximumSize(100) .expireAfterAccess(duration, unit) .removalListener(removalListener) .build(factory); }

Target:
public CachedMongoClientProvider(int duration, TimeUnit unit) { this(duration, unit, 100, 100); }
Source:
public boolean rollUp() { if (row < 1) { return false; } setRow(row - 1); return true; }

Target:
public boolean rollUp() { if (row <= 1) { return false; } setRow(row - 1); return true; }
Source:
public Collection<ConfigDescription> getConfigDescriptions(Locale locale) { return null; }

Target:
public Collection<ConfigDescription> getConfigDescriptions(Locale locale) { return Collections.emptySet(); }
Source:
private void handleWorkItemHandlerException(ProcessWorkItemHandlerException handlerException, WorkItem workItem) { Map<String, Object> parameters = new HashMap<>(); parameters.put("DeploymentId", workItem.getDeploymentId()); parameters.put("ProcessInstanceId", workItem.getProcessInstanceId()); parameters.put("WorkItemId", workItem.getId()); parameters.put("NodeInstanceId", this.getId()); parameters.put("ErrorMessage", handlerException.getMessage()); parameters.put("Error", handlerException); parameters.putAll(workItem.getParameters()); KieRuntime kruntime = getKieRuntimeForSubprocess(); ProcessInstance processInstance = ( ProcessInstance ) kruntime.createProcessInstance(handlerException.getProcessId(), parameters); this.exceptionHandlingProcessInstanceId = processInstance.getId(); ((ProcessInstanceImpl) processInstance).setMetaData("ParentProcessInstanceId", getProcessInstance().getId()); ((ProcessInstanceImpl) processInstance).setMetaData("ParentNodeInstanceId", getUniqueId()); ((ProcessInstanceImpl) processInstance).setParentProcessInstanceId(getProcessInstance().getId()); ((ProcessInstanceImpl) processInstance).setSignalCompletion(true); addExceptionProcessListener(); kruntime.startProcessInstance(processInstance.getId()); }

Target:
private void handleWorkItemHandlerException(ProcessWorkItemHandlerException handlerException, WorkItem workItem) { Map<String, Object> parameters = new HashMap<>(); parameters.put("DeploymentId", workItem.getDeploymentId()); parameters.put("ProcessInstanceId", workItem.getProcessInstanceId()); parameters.put("WorkItemId", workItem.getId()); parameters.put("NodeInstanceId", this.getId()); parameters.put("ErrorMessage", handlerException.getMessage()); parameters.put("Error", handlerException); parameters.putAll(workItem.getParameters()); KieRuntime kruntime = getKieRuntimeForSubprocess(); ProcessInstance processInstance = ( ProcessInstance ) kruntime.createProcessInstance(handlerException.getProcessId(), parameters); this.exceptionHandlingProcessInstanceId = processInstance.getId(); ((ProcessInstanceImpl) processInstance).setMetaData("ParentProcessInstanceId", getProcessInstance().getId()); ((ProcessInstanceImpl) processInstance).setMetaData("ParentNodeInstanceId", getUniqueId()); ((ProcessInstanceImpl) processInstance).setParentProcessInstanceId(getProcessInstance().getId()); ((ProcessInstanceImpl) processInstance).setSignalCompletion(true); kruntime.startProcessInstance(processInstance.getId()); if (processInstance.getState() == ProcessInstance.STATE_COMPLETED || processInstance.getState() == ProcessInstance.STATE_ABORTED) { exceptionHandlingCompleted(processInstance, handlerException); } else { addExceptionProcessListener(); } }
Source:
public Response deleteApiMember( @Parameter(name = "user", required = true) @NotNull @QueryParam("user") String userId) { apiService.findById(api); try { userService.findById(userId); } catch (UserNotFoundException unfe) { return Response.status(Response.Status.BAD_REQUEST).entity(unfe.getMessage()).build(); } membershipService.deleteReferenceMember(MembershipReferenceType.API, api, MembershipMemberType.USER, userId); return Response.noContent().build(); }

Target:
public Response deleteApiMember( @Parameter(name = "user", required = true) @NotNull @QueryParam("user") String userId) { apiService.findById(api); try { userService.findById(userId); } catch (UserNotFoundException unfe) { return Response.status(Response.Status.BAD_REQUEST).entity(unfe.getMessage()).build(); } membershipService.deleteReferenceMember(MembershipReferenceType.API, api, MembershipMemberType.USER, userId); return Response.ok().build(); }
Source:
public int getCurrentCycle() { Calendar now = Calendar.getInstance(); switch (duration) { case DAY: return (int) Math.ceil((now.getTimeInMillis() - startDate.getTimeInMillis()) / (24*60*60*1000.0)); case WEEK: return (int) Math.ceil((now.getTimeInMillis() - startDate.getTimeInMillis()) / (7*24*60*60*1000.0)); case FORTNIGHT: return (int) Math.ceil((now.getTimeInMillis() - startDate.getTimeInMillis()) / (14*24*60*60*1000.0)); case MONTH: return ((now.get(Calendar.YEAR) - startDate.get(Calendar.YEAR)) * 12) + (now.get(Calendar.MONTH) - startDate.get(Calendar.MONTH)) + (now.get(Calendar.DAY_OF_MONTH) < startDate.get(Calendar.DAY_OF_MONTH) ? 0 : 1); case YEAR: int startYear = startDate.get(Calendar.YEAR); int thisYear = now.get(Calendar.YEAR); if ((startYear % 4 == 0) && (startYear % 100 != 0) || (startYear % 400 == 0)) { if (startDate.get(Calendar.DAY_OF_YEAR) > 60 && !((thisYear % 4 == 0) && (thisYear % 100 != 0) || (thisYear % 400 == 0))) return thisYear - startYear + (now.get(Calendar.DAY_OF_YEAR) < startDate.get(Calendar.DAY_OF_YEAR) + 1 ? 0 : 1); } return thisYear - startYear + (now.get(Calendar.DAY_OF_YEAR) < startDate.get(Calendar.DAY_OF_YEAR) ? 0 : 1); case OTHER: return (int) Math.ceil((now.getTimeInMillis() - startDate.getTimeInMillis()) / (otherDuration*24*60*60*1000.0)); } throw new IllegalStateException("Budget must have a duration type specified."); }

Target:
public int getCurrentCycle() { Calendar now = Calendar.getInstance(); long timeDiffInMillis = now.getTimeInMillis() - startDate.getTimeInMillis(); switch (duration) { case DAY: return (int) Math.ceil(timeDiffInMillis / (double) ONE_DAY); case WEEK: return (int) Math.ceil(timeDiffInMillis / (double) 7 * ONE_DAY); case FORTNIGHT: return (int) Math.ceil(timeDiffInMillis / (double) 14 * ONE_DAY); case MONTH: return ((now.get(Calendar.YEAR) - startDate.get(Calendar.YEAR)) * 12) + (now.get(Calendar.MONTH) - startDate.get(Calendar.MONTH)) + (now.get(Calendar.DAY_OF_MONTH) < startDate.get(Calendar.DAY_OF_MONTH) ? 0 : 1); case YEAR: int startYear = startDate.get(Calendar.YEAR); int thisYear = now.get(Calendar.YEAR); if ((startYear % 4 == 0) && (startYear % 100 != 0) || (startYear % 400 == 0)) { if (startDate.get(Calendar.DAY_OF_YEAR) > 60 && !((thisYear % 4 == 0) && (thisYear % 100 != 0) || (thisYear % 400 == 0))) return thisYear - startYear + (now.get(Calendar.DAY_OF_YEAR) < startDate.get(Calendar.DAY_OF_YEAR) + 1 ? 0 : 1); } return thisYear - startYear + (now.get(Calendar.DAY_OF_YEAR) < startDate.get(Calendar.DAY_OF_YEAR) ? 0 : 1); case OTHER: return (int) Math.ceil(timeDiffInMillis / (double) otherDuration * ONE_DAY); } throw new IllegalStateException("Budget must have a duration type specified."); }
Source:
public void newSelection(final TmfPieChartViewer context) { if (context.isDisposed()) { return; } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { synchronized (context.getMutexLayoutChange()) { if (!context.isDisposed()) { context.updateTimeRangeSelectionPieChart(); context.getTimeRangePC().redraw(); context.layout(); } } } }); }

Target:
public void newSelection(final TmfPieChartViewer context) { if (context.isDisposed()) { return; } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { synchronized (context) { if (!context.isDisposed()) { context.updateTimeRangeSelectionPieChart(); context.getTimeRangePC().redraw(); context.layout(); } } } }); }
Source:
protected void initialize(final ProductThumbnailViewModel viewModel, final ProductWithVariant productWithVariant) { fillProduct(viewModel, productWithVariant); fillNew(viewModel, productWithVariant); fillSale(viewModel, productWithVariant); }

Target:
protected final void initialize(final ProductThumbnailViewModel viewModel, final ProductWithVariant productWithVariant) { fillProduct(viewModel, productWithVariant); fillNew(viewModel, productWithVariant); fillSale(viewModel, productWithVariant); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { chain.doFilter(request, response); String headerValue = req.getHeader("Authorization"); if (headerValue != null && headerValue.startsWith("Basic ")) { String[] creds = new String( Base64.decodeBase64(headerValue.substring("Basic".length())), Charset.forName("UTF-8") ).split(":", 2); handleCredentials(request, creds); } } chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { String headerValue = req.getHeader("Authorization"); if (headerValue != null && headerValue.startsWith("Basic ")) { String[] creds = new String( Base64.decodeBase64(headerValue.substring("Basic".length())), Charset.forName("UTF-8") ).split(":", 2); handleCredentials(request, creds); } } chain.doFilter(request, response); }
Source:
public R visit(Constant node, P p) throws E { return visit((Term) node, p); }

Target:
public R visit(Constant node, P p) throws E { return visit((ProductionReference) node, p); }
Source:
private List<ElasticsearchColumn> buildColumns(ElasticsearchTableDescription tableDescription) { List<ElasticsearchColumn> columns = new ArrayList<>(); TransportClient client = clients.get(tableDescription.getClusterName()); verify(client != null, "client is null"); for (String index : getIndices(tableDescription)) { GetMappingsRequest mappingsRequest = new GetMappingsRequest().types(tableDescription.getType()); if (!isNullOrEmpty(index)) { mappingsRequest.indices(index); } ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = client.admin() .indices() .getMappings(mappingsRequest) .actionGet(timeout.toMillis()) .getMappings(); Iterator<String> indexIterator = mappings.keysIt(); while (indexIterator.hasNext()) { MappingMetaData mappingMetaData = mappings.get(indexIterator.next()).get(tableDescription.getType()); JsonNode rootNode = null; try { rootNode = objecMapper.readTree(mappingMetaData.source().uncompressed()); } catch (IOException e) { throw new PrestoException(ELASTICSEARCH_CORRUPTED_MAPPING_METADATA, e); } JsonNode mappingNode = rootNode.get(tableDescription.getType()); JsonNode propertiesNode = mappingNode.get("properties"); List<String> lists = new ArrayList<>(); JsonNode metaNode = mappingNode.get("_meta"); if (metaNode != null) { JsonNode arrayNode = metaNode.get("lists"); if (arrayNode != null && arrayNode.isArray()) { ArrayNode arrays = (ArrayNode) arrayNode; for (int i = 0; i < arrays.size(); i++) { lists.add(arrays.get(i).textValue()); } } } populateColumns(propertiesNode, lists, columns); } } return columns; }

Target:
private List<ElasticsearchColumn> buildColumns(ElasticsearchTableDescription tableDescription) { List<ElasticsearchColumn> columns = new ArrayList<>(); TransportClient client = clients.get(tableDescription.getClusterName()); verify(client != null, "client is null"); for (String index : getIndices(tableDescription)) { GetMappingsRequest mappingsRequest = new GetMappingsRequest().types(tableDescription.getType()); if (!isNullOrEmpty(index)) { mappingsRequest.indices(index); } ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = getMappings(client, mappingsRequest); Iterator<String> indexIterator = mappings.keysIt(); while (indexIterator.hasNext()) { MappingMetaData mappingMetaData = mappings.get(indexIterator.next()).get(tableDescription.getType()); JsonNode rootNode; try { rootNode = objecMapper.readTree(mappingMetaData.source().uncompressed()); } catch (IOException e) { throw new PrestoException(ELASTICSEARCH_CORRUPTED_MAPPING_METADATA, e); } JsonNode mappingNode = rootNode.get(tableDescription.getType()); JsonNode propertiesNode = mappingNode.get("properties"); List<String> lists = new ArrayList<>(); JsonNode metaNode = mappingNode.get("_meta"); if (metaNode != null) { JsonNode arrayNode = metaNode.get("lists"); if (arrayNode != null && arrayNode.isArray()) { ArrayNode arrays = (ArrayNode) arrayNode; for (int i = 0; i < arrays.size(); i++) { lists.add(arrays.get(i).textValue()); } } } populateColumns(propertiesNode, lists, columns); } } return columns; }
Source:
public void testSignalAllConnections() throws OpenTokException { String sessionId = "SESSIONID"; String path = "/v2/project/" + apiKey + "/session/" + sessionId + "/signal"; stubFor(post(urlEqualTo(path)) .willReturn(aResponse() .withStatus(204))); SignalProperties properties = new SignalProperties.Builder().type("test").data("Signal test string").build(); sdk.signal(sessionId, properties); verify(postRequestedFor(urlMatching(path))); verify(postRequestedFor(urlMatching(path)) .withHeader("Content-Type", equalTo("application/json"))); verify(postRequestedFor(urlMatching(path)) .withRequestBody(equalToJson("{ \"type\":\"test\",\"data\":\"Signal test string\" }"))); assertTrue(Helpers.verifyTokenAuth(apiKey, apiSecret, findAll(postRequestedFor(urlMatching(path))))); Helpers.verifyUserAgent(); }

Target:
public void testSignalAllConnections() throws OpenTokException { String sessionId = "SESSIONID"; Boolean exceptionThrown = false; String path = "/v2/project/" + apiKey + "/session/" + sessionId + "/signal"; stubFor(post(urlEqualTo(path)) .willReturn(aResponse() .withStatus(204))); SignalProperties properties = new SignalProperties.Builder().type("test").data("Signal test string").build(); try { sdk.signal(sessionId, properties); verify(postRequestedFor(urlMatching(path))); verify(postRequestedFor(urlMatching(path)) .withHeader("Content-Type", equalTo("application/json"))); verify(postRequestedFor(urlMatching(path)) .withRequestBody(equalToJson("{ \"type\":\"test\",\"data\":\"Signal test string\" }"))); assertTrue(Helpers.verifyTokenAuth(apiKey, apiSecret, findAll(postRequestedFor(urlMatching(path))))); Helpers.verifyUserAgent(); } catch (Exception e) { exceptionThrown = true; } assertFalse(exceptionThrown); }
Source:
public Decoder(String codecName) { MediaCodec codec = null; try { codec = MediaCodec.createByCodecName(codecName); } catch (Exception e) { throw new RuntimeException("couldn't create codec " + codecName, e); } Log.i(TAG, "using codec: " + codec.getName()); mCodec = codec; mDoChecksum = false; mQueuedEos = false; mTimeStamps = new ArrayList<Long>(); mWarnings = new ArrayList<String>(); }

Target:
public Decoder(String codecName) { MediaCodec codec = null; try { codec = MediaCodec.createByCodecName(codecName); } catch (Exception e) { throw new RuntimeException("couldn't create codec " + codecName, e); } Log.i(TAG, "using codec: " + codec.getName()); mCodec = codec; mDoChecksum = false; mQueuedEos = false; mTimeStamps = new ArrayList<Long>(); mWarnings = new ArrayList<String>(); mConfigured = false; }
Source:
public static FieldInfo getIterableField(ClassInfo classInfo, Class<?> parameterType, String relationshipType, Direction relationshipDirection) { final ClassInfo lookupClassInfo = classInfo; final DirectedRelationshipForType directedRelationshipForType = new DirectedRelationshipForType( relationshipType, relationshipDirection, parameterType); final Map<DirectedRelationshipForType, FieldInfo> typeFieldInfoMap = iterableWriterCache .computeIfAbsent(lookupClassInfo, key -> new ConcurrentHashMap<>()); if (typeFieldInfoMap.containsKey(directedRelationshipForType)) { return typeFieldInfoMap.get(directedRelationshipForType); } while (classInfo != null) { FieldInfo fieldInfo = getIterableFieldInfo(classInfo, parameterType, relationshipType, relationshipDirection, STRICT_MODE); if (fieldInfo != null) { cacheIterableFieldWriter(lookupClassInfo, parameterType, relationshipType, relationshipDirection, directedRelationshipForType, fieldInfo, fieldInfo); return fieldInfo; } if (!relationshipDirection.equals(Direction.INCOMING)) { fieldInfo = getIterableFieldInfo(classInfo, parameterType, relationshipType, relationshipDirection, INFERRED_MODE); if (fieldInfo != null) { cacheIterableFieldWriter(lookupClassInfo, parameterType, relationshipType, relationshipDirection, directedRelationshipForType, fieldInfo, fieldInfo); return fieldInfo; } } classInfo = classInfo.directSuperclass(); } return null; }

Target:
public static FieldInfo getIterableField(ClassInfo classInfo, Class<?> parameterType, String relationshipType, Direction relationshipDirection) { final ClassInfo lookupClassInfo = classInfo; final DirectedRelationshipForType directedRelationshipForType = new DirectedRelationshipForType( relationshipType, relationshipDirection, parameterType); final Map<DirectedRelationshipForType, FieldInfo> typeFieldInfoMap = iterableWriterCache .computeIfAbsent(lookupClassInfo, key -> new ConcurrentHashMap<>()); if (typeFieldInfoMap.containsKey(directedRelationshipForType)) { return typeFieldInfoMap.get(directedRelationshipForType); } while (classInfo != null) { FieldInfo fieldInfo = getIterableFieldInfo(classInfo, parameterType, relationshipType, relationshipDirection, STRICT_MODE); if (fieldInfo != null) { cacheIterableFieldWriter(lookupClassInfo, parameterType, relationshipType, relationshipDirection, directedRelationshipForType, fieldInfo, fieldInfo); return fieldInfo; } if (relationshipDirection != Direction.INCOMING) { fieldInfo = getIterableFieldInfo(classInfo, parameterType, relationshipType, relationshipDirection, INFERRED_MODE); if (fieldInfo != null) { cacheIterableFieldWriter(lookupClassInfo, parameterType, relationshipType, relationshipDirection, directedRelationshipForType, fieldInfo, fieldInfo); return fieldInfo; } } classInfo = classInfo.directSuperclass(); } return null; }