auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void start(RoutingTable routingTable) { try { NettyJaxrsServer netty = new NettyJaxrsServer(); ResteasyDeployment deployment = new ResteasyDeployment(); netty.setDeployment(deployment); nettyServer = Optional.of(netty); netty.setHostname(configuration.getIp().getHostName()); netty.setPort(configuration.getPort()); netty.setRootResourcePath(""); netty.setSecurityDomain(null); netty.start(); addDeployments(netty, routingTable); this.ip = Optional.of(configuration.getIp()); this.port = Optional.of(configuration.getPort()); logger.restRouterStarted(ip + ":" + port); } catch (Exception e) { throw logger.restRouterStartFailed(e); } }

Target:
public void start(RoutingTable routingTable) { try { NettyJaxrsServer netty = new NettyJaxrsServer(); ResteasyDeployment deployment = new ResteasyDeployment(); netty.setDeployment(deployment); nettyServer = Optional.of(netty); netty.setHostname(configuration.getIp().getHostName()); netty.setPort(configuration.getPort()); netty.setRootResourcePath(""); netty.setSecurityDomain(null); netty.start(); addDeployments(netty, routingTable); this.ip = Optional.of(configuration.getIp()); this.port = Optional.of(configuration.getPort()); logger.restRouterStarted(ip, port); } catch (Exception e) { throw logger.restRouterStartFailed(e); } }
Source:
private static int getNumberOfBlankLines(List<Token> tokens) { List<Token> tkns = tokens; if (tkns == null || tkns.size() <= 1) { return 0; } int firstNewlineOrCommentIndex = -1; for (int i = 0; i < tkns.size(); i++) { Token token = tkns.get(i); if (ListenerUtil.isComment(token) || ListenerUtil.isNewline(token)) { firstNewlineOrCommentIndex = i; break; } } tkns = tkns.subList(firstNewlineOrCommentIndex + 1, tokens.size()); return (int) tkns.stream().filter(ListenerUtil::isNewline).count(); }

Target:
private static int getNumberOfBlankLines(List<Token> tokens) { if (tokens == null || tokens.size() <= 1) { return 0; } int firstNewlineOrCommentIndex = -1; for (int i = 0; i < tokens.size(); i++) { Token token = tokens.get(i); if (ListenerUtil.isComment(token) || ListenerUtil.isNewline(token)) { firstNewlineOrCommentIndex = i; break; } } tokens = tokens.subList(firstNewlineOrCommentIndex + 1, tokens.size()); return (int) tokens.stream().filter(ListenerUtil::isNewline).count(); }
Source:
private void openNewSurvey(Activity activity) { ProgramDB programDB = ProgramDB.findById(PreferencesEReferral.getUserProgramId()); SurveyDB surveyDB = new SurveyDB(null, programDB, Session.getUserDB()); UserAccount userAccount = new UserAccount(Session.getUserDB().getName(), Session.getUserDB().getUid(), PreferencesState.getCredentialsFromPreferences().isDemoCredentials()); surveyDB.save(); Session.setMalariaSurveyDB(surveyDB); prepareLocationListener(activity, surveyDB); Program program = new Program(programDB.getUid(), programDB.getUid()); Survey survey = new Survey(surveyDB.getId_survey(), program, userAccount , Constants.SURVEY_IN_PROGRESS); saveValuesFromIntent(activity, survey); if(!DashboardActivity.dashboardActivity.isPreLoadSurveyOpenning()) { mDashboardActivity.initSurvey(); } }

Target:
private void openNewSurvey(Activity activity) { ProgramDB programDB = ProgramDB.findById(PreferencesEReferral.getUserProgramId()); SurveyDB survey = new SurveyDB(null, programDB, Session.getUserDB()); survey.save(); Session.setMalariaSurveyDB(survey); prepareLocationListener(activity, survey); mDashboardActivity.initSurvey(); }
Source:
public DeleteColumnManagementAnchorWidget() { super(); setText(GuidedDecisionTableConstants.INSTANCE.Delete()); setTitle(GuidedDecisionTableConstants.INSTANCE.DeleteThisColumn()); addClickHandler((clickEvent) -> { deletePopUpPresenter.getToggleCommentPresenter().getViewElement().setAttribute("hidden", "true"); deletePopUpPresenter.show((comment) -> afterDeleteConfirmedCommand.execute()); }); }

Target:
public DeleteColumnManagementAnchorWidget() { }
Source:
private LinkedHashMap<String, LinkedHashMap<String, String>> getAdditionalInformationAsMapOfMap(NodeSource ns) { String allNewAdditionalInformationAsString = ""; LinkedHashMap<String, LinkedHashMap<String, String>> additionalInformationMap = new LinkedHashMap<>(); for (Map.Entry<String, String> categoryAndKeyAndValue : ns.getAdditionalInformation().entrySet()) { String[] categoryAndKeyArr = categoryAndKeyAndValue.getKey().split("\\|"); String category = categoryAndKeyArr[0]; String key = categoryAndKeyArr[1]; String value = categoryAndKeyAndValue.getValue(); if (!additionalInformationMap.containsKey(category)) { additionalInformationMap.put(category, new LinkedHashMap<>()); } additionalInformationMap.get(category).put(key, value); allNewAdditionalInformationAsString += category + key + value; } if (!this.allAdditionalInformationAsString.equals(allNewAdditionalInformationAsString)) { this.allAdditionalInformationAsString = allNewAdditionalInformationAsString; return additionalInformationMap; } return null; }

Target:
private LinkedHashMap<String, LinkedHashMap<String, String>> getAdditionalInformationAsMapOfMap(NodeSource ns) { String allNewAdditionalInformationAsString = ""; LinkedHashMap<String, LinkedHashMap<String, String>> additionalInformationMap = new LinkedHashMap<>(); for (Map.Entry<String, String> categoryAndKeyAndValue : ns.getAdditionalInformation().entrySet()) { String[] categoryAndKeyArr = categoryAndKeyAndValue.getKey().split("\\|"); if (categoryAndKeyArr.length != 2) continue; String category = categoryAndKeyArr[0]; String key = categoryAndKeyArr[1]; String value = categoryAndKeyAndValue.getValue(); if (!additionalInformationMap.containsKey(category)) { additionalInformationMap.put(category, new LinkedHashMap<>()); } additionalInformationMap.get(category).put(key, value); allNewAdditionalInformationAsString += category + key + value; } if (!this.allAdditionalInformationAsString.equals(allNewAdditionalInformationAsString)) { this.allAdditionalInformationAsString = allNewAdditionalInformationAsString; return additionalInformationMap; } return null; }
Source:
private static void editTree(TreeOperation op, Repository repo, RevWalk rw, RevCommit base, DirCacheEditor dce, ObjectInserter ins, String path, byte[] content) throws IOException, InvalidChangeOperationException { switch (op) { case DELETE_ENTRY: dce.add(new DeletePath(path)); break; case CHANGE_ENTRY: case RESTORE_ENTRY: dce.add(getPathEdit(op, repo, rw, base, path, ins, content)); } dce.finish(); }

Target:
private static void editTree(TreeOperation op, Repository repo, RevWalk rw, RevCommit base, DirCacheEditor dce, ObjectInserter ins, String path, byte[] content) throws IOException, InvalidChangeOperationException { switch (op) { case DELETE_ENTRY: dce.add(new DeletePath(path)); break; case CHANGE_ENTRY: case RESTORE_ENTRY: dce.add(getPathEdit(op, repo, rw, base, path, ins, content)); break; } dce.finish(); }
Source:
private static void compensate() { List<KeyValue> commandSnapshots = DbFacade.getInstance().getBusinessEntitySnapshotDao().getAllCommands(); for (KeyValue commandSnapshot : commandSnapshots) { CommandBase<?> cmd = CommandsFactory.createCommand(commandSnapshot.getValue().toString(), (Guid) commandSnapshot.getKey()); if (cmd != null) { try { cmd.compensate(); } catch (RuntimeException e) { log.error( "Failed to run compensation on startup for Command '{}', Command Id '{}': {}", commandSnapshot.getValue(), commandSnapshot.getKey(), ExceptionUtils.getMessage(e)); log.debug("Exception", e); } log.info("Running compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } else { log.error("Failed to run compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } } }

Target:
private static void compensate() { List<KeyValue> commandSnapshots = DbFacade.getInstance().getBusinessEntitySnapshotDao().getAllCommands(); for (KeyValue commandSnapshot : commandSnapshots) { CommandBase<?> cmd = CommandsFactory.createCommand(commandSnapshot.getValue().toString(), (Guid) commandSnapshot.getKey()); if (cmd != null) { try { cmd.compensate(); } catch (RuntimeException e) { log.error( "Failed to run compensation on startup for Command '{}', Command Id '{}': {}", commandSnapshot.getValue(), commandSnapshot.getKey(), e.getMessage()); log.error("Exception", e); } log.info("Running compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } else { log.error("Failed to run compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } } }
Source:
public Point3D(double x, double y) { this(x, y, 0); }

Target:
public Point3D(double x, double y) { this.x = x; this.y = y; this.z = 0; }
Source:
void testPublicationOrderIsMaintained_AggregateAdded() { String aggregateId = UUID.randomUUID().toString(); GenericDomainEventMessage<StubAggregateCreatedEvent> event = new GenericDomainEventMessage<>("StubAggregate", aggregateId, 0, new StubAggregateCreatedEvent(aggregateId)); when(eventStore.readEvents(aggregateId)).thenReturn(DomainEventStream.of(event)); doAnswer(invocation -> { System.out.println("Published event: " + invocation.getArguments()[0].toString()); return Void.class; }).when(eventStore).publish(isA(EventMessage.class)); commandBus.dispatch(asCommandMessage(new UpdateStubAggregateWithExtraEventCommand(aggregateId))); InOrder inOrder = inOrder(eventStore, eventStore, eventStore); inOrder.verify(eventStore).publish(isA(DomainEventMessage.class)); inOrder.verify(eventStore).publish(argThat(new NotADomainEventMatcher())); inOrder.verify(eventStore).publish(isA(DomainEventMessage.class)); }

Target:
void testPublicationOrderIsMaintained_AggregateAdded() { String aggregateId = UUID.randomUUID().toString(); GenericDomainEventMessage<StubAggregateCreatedEvent> event = new GenericDomainEventMessage<>("test", aggregateId, 0, new StubAggregateCreatedEvent(aggregateId)); when(eventStore.readEvents(aggregateId)).thenReturn(DomainEventStream.of(event)); doAnswer(invocation -> { System.out.println("Published event: " + invocation.getArguments()[0].toString()); return Void.class; }).when(eventStore).publish(isA(EventMessage.class)); commandBus.dispatch(asCommandMessage(new UpdateStubAggregateWithExtraEventCommand(aggregateId))); InOrder inOrder = inOrder(eventStore, eventStore, eventStore); inOrder.verify(eventStore).publish(isA(DomainEventMessage.class)); inOrder.verify(eventStore).publish(argThat(new NotADomainEventMatcher())); inOrder.verify(eventStore).publish(isA(DomainEventMessage.class)); }
Source:
public static int getPartitions(byte[] table, List<Partition> partitions, boolean refresh) throws StandardException { Partition root = null; try { root = SIDriver.driver().getTableFactory().getTable(table); partitions.addAll(root.subPartitions(refresh)); return partitions.size(); } catch (Exception ioe) { throw StandardException.plainWrapException(ioe); } finally { try { if (root != null) root.close(); } catch (IOException e) { } } }

Target:
public static int getPartitions(byte[] table, List<Partition> partitions, boolean refresh) throws StandardException { try (Partition root = SIDriver.driver().getTableFactory().getTable(table)) { partitions.addAll(root.subPartitions(refresh)); return partitions.size(); } catch (Exception ioe) { throw StandardException.plainWrapException(ioe); } }
Source:
public ArchiveContentEncodingDetector(String extension) { Assert.isNotNull(extension, "Extension can not be null"); this.extension = extension; }

Target:
public ArchiveContentEncodingDetector(String extension) { Assert.isLegal(extension != null && !extension.isEmpty(), "extension can't be empty"); this.extension = extension; }
Source:
public PlanWithProperties visitIndexJoin(IndexJoinNode node, PreferredProperties preferredProperties) { List<VariableReferenceExpression> joinColumns = node.getCriteria().stream() .map(IndexJoinNode.EquiJoinClause::getProbe) .collect(toImmutableList()); List<LocalProperty<VariableReferenceExpression>> desiredLocalProperties = preferredProperties.getLocalProperties().isEmpty() ? grouped(joinColumns) : ImmutableList.of(); PlanWithProperties probeSource = node.getProbeSource().accept(this, PreferredProperties.partitionedWithLocal(ImmutableSet.copyOf(joinColumns), desiredLocalProperties) .mergeWithParent(preferredProperties, session)); ActualProperties probeProperties = probeSource.getProperties(); PlanWithProperties indexSource = node.getIndexSource().accept(this, PreferredProperties.any()); if (shouldRepartitionForIndexJoin(joinColumns, preferredProperties, probeProperties)) { probeSource = withDerivedProperties( partitionedExchange(idAllocator.getNextId(), REMOTE_STREAMING, probeSource.getNode(), createPartitioning(joinColumns), node.getProbeHashVariable()), probeProperties); } PlanNode result = ChildReplacer.replaceChildren(node, ImmutableList.of(probeSource.getNode(), node.getIndexSource())); return new PlanWithProperties(result, deriveProperties(result, ImmutableList.of(probeSource.getProperties(), indexSource.getProperties()))); }

Target:
public PlanWithProperties visitIndexJoin(IndexJoinNode node, PreferredProperties preferredProperties) { List<VariableReferenceExpression> joinColumns = node.getCriteria().stream() .map(IndexJoinNode.EquiJoinClause::getProbe) .collect(toImmutableList()); List<LocalProperty<VariableReferenceExpression>> desiredLocalProperties = preferredProperties.getLocalProperties().isEmpty() ? grouped(joinColumns) : ImmutableList.of(); PlanWithProperties probeSource = node.getProbeSource().accept(this, PreferredProperties.partitionedWithLocal(ImmutableSet.copyOf(joinColumns), desiredLocalProperties) .mergeWithParent(preferredProperties, true)); ActualProperties probeProperties = probeSource.getProperties(); PlanWithProperties indexSource = node.getIndexSource().accept(this, PreferredProperties.any()); if (shouldRepartitionForIndexJoin(joinColumns, preferredProperties, probeProperties)) { probeSource = withDerivedProperties( partitionedExchange(idAllocator.getNextId(), REMOTE_STREAMING, probeSource.getNode(), createPartitioning(joinColumns), node.getProbeHashVariable()), probeProperties); } PlanNode result = ChildReplacer.replaceChildren(node, ImmutableList.of(probeSource.getNode(), node.getIndexSource())); return new PlanWithProperties(result, deriveProperties(result, ImmutableList.of(probeSource.getProperties(), indexSource.getProperties()))); }
Source:
public Response undoFeedbackUpdate(@Auth final AccessToken token, @PathParam("id") final Long id) { final int updated = feedbackDAO.undoFeedbackUpdate(id); if (updated == 0) { throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(new JsonError(404, "Feedback not found!")).build()); } return Response.noContent().build(); }

Target:
public Response undoFeedbackUpdate(@Auth final AccessToken token, @PathParam("id") final Long id) { final int updated = feedbackDAO.undoFeedbackUpdate(id); if (updated == 0) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).entity(new JsonError(Response.Status.NOT_FOUND.getStatusCode(), "Feedback not found!")).build()); } return Response.noContent().build(); }
Source:
public boolean conditionMet() { final Set<String> allTopics = new HashSet<>(getAllTopics()); return !allTopics.removeAll(deletedTopics); }

Target:
public boolean conditionMet() { final Set<String> allTopics = getAllTopicsInCluster(); return !allTopics.removeAll(deletedTopics); }
Source:
public static void verifyContains(LiveSearchResults<String> results, List<Pair<String, String>> values) { assertEquals(results.size(), values.size()); values.forEach(value -> assertTrue("Expected value <" + value.getK1() + ", " + value.getK2() + "> is not present in results but was expected", results.stream() .filter(entry -> value.getK1().equals(entry.getKey()) && value.getK2().equals(entry.getValue())) .findFirst() .isPresent())); }

Target:
public static void verifyContains(LiveSearchResults<String> results, List<Pair<String, String>> values) { assertEquals(results.size(), values.size()); values.forEach(value -> assertTrue("Expected value <" + value.getK1() + ", " + value.getK2() + "> is not present in results but was expected", results.stream() .anyMatch(entry -> value.getK1().equals(entry.getKey()) && value.getK2().equals(entry.getValue())))); }
Source:
public void testExplicitNullness() throws Exception { assertBugReported(ColumnWithoutElement.class, detector, bugReporter); }

Target:
public void testExplicitNullness() throws Exception { assertNoBugsReported(ColumnWithNullable.class, detector, bugReporter); }
Source:
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { Class<?> recievedMsgClass = msg.getClass(); if (HttpRequest.class.isAssignableFrom(recievedMsgClass)) { @SuppressWarnings("rawtypes") HttpRequest rxRequest = (HttpRequest) msg; if (rxRequest.getHeaders().hasContent()) { MultipleFutureListener allWritesListener = new MultipleFutureListener(promise); allWritesListener.listen(ctx.write(rxRequest.getNettyRequest())); ContentSource<?> contentSource = null; if (rxRequest.getContentFactory() != null) { contentSource = rxRequest.getContentFactory().newContentSource(); } else { contentSource = rxRequest.getContentSource(); } if (contentSource instanceof RawContentSource) { @SuppressWarnings("rawtypes") RawContentSource<?> rawContentSource = (RawContentSource) contentSource; while (rawContentSource.hasNext()) { @SuppressWarnings("rawtypes") ContentTransformer transformer = rawContentSource.getTransformer(); @SuppressWarnings("unchecked") ByteBuf byteBuf = transformer.transform(rawContentSource.next(), ctx.alloc()); allWritesListener.listen(ctx.write(byteBuf)); } } else { while (contentSource.hasNext()) { allWritesListener.listen(ctx.write(contentSource.next())); } } } else { ctx.write(rxRequest.getNettyRequest(), promise); } } else { ctx.write(msg, promise); } }

Target:
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { Class<?> recievedMsgClass = msg.getClass(); if (HttpRequest.class.isAssignableFrom(recievedMsgClass)) { HttpRequest<?> rxRequest = (HttpRequest<?>) msg; if (rxRequest.getHeaders().hasContent()) { if (!rxRequest.getHeaders().isContentLengthSet()) { rxRequest.getHeaders().add(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED); } MultipleFutureListener allWritesListener = new MultipleFutureListener(promise); allWritesListener.listen(ctx.write(rxRequest.getNettyRequest())); ContentSource<?> contentSource; if (rxRequest.hasRawContentSource()) { contentSource = rxRequest.getRawContentSource(); @SuppressWarnings("rawtypes") RawContentSource<?> rawContentSource = (RawContentSource) contentSource; while (rawContentSource.hasNext()) { @SuppressWarnings("rawtypes") ContentTransformer transformer = rawContentSource.getTransformer(); @SuppressWarnings("unchecked") ByteBuf byteBuf = transformer.transform(rawContentSource.next(), ctx.alloc()); allWritesListener.listen(ctx.write(byteBuf)); } } else { contentSource = rxRequest.getContentSource(); while (contentSource.hasNext()) { allWritesListener.listen(ctx.write(contentSource.next())); } } } else { if (!rxRequest.getHeaders().isContentLengthSet() && rxRequest.getMethod() != HttpMethod.GET) { rxRequest.getHeaders().set(HttpHeaders.Names.CONTENT_LENGTH, 0); } ctx.write(rxRequest.getNettyRequest(), promise); } } else { ctx.write(msg, promise); } }
Source:
public void setPwdName(String pwdName) { if (pwdName == null) { return; } preferences.edit().putString(PreferenceKeys.PWD_NAME, pwdName).apply(); }

Target:
public void setPwdName(String pwdName) { preferences.edit().putString(PreferenceKeys.PWD_NAME, pwdName).apply(); }
Source:
private List<String> extractSecurityGroups(final ConfigGroup groupConfig) { ConfigItem<List<String>> securityGroups = backwardCompatibleUtil.compat(groupConfig).getConfigItem("security:groups"); return securityGroups.getValue(); }

Target:
private List<String> extractSecurityGroups(final ConfigGroup groupConfig) { ConfigItem<List<String>> securityGroups = backwardCompatibleUtil.compat(groupConfig).getConfigItem(SECURITY_GROUPS); return securityGroups.getValue(); }
Source:
private boolean buildAndSendRequestToLeader(String urlSuffix, HttpConstants.RestVerbs requestMethod, int expectedResponseCode) throws IllegalArgumentException { String leaderHostName = _leaderElection.getCurrentLeaderInfo().getId(); String url = leaderHostName + urlSuffix; HttpUriRequest request; switch (requestMethod) { case PUT: request = new HttpPut(url); break; case DELETE: request = new HttpDelete(url); break; default: LOG.error("Unsupported requestMethod: " + requestMethod.name()); return false; } return sendRequestToLeader(request, expectedResponseCode, leaderHostName); }

Target:
private boolean buildAndSendRequestToLeader(String urlSuffix, HttpConstants.RestVerbs requestMethod, int expectedResponseCode) throws IllegalArgumentException { String leaderHostName = _leaderElection.getCurrentLeaderInfo().getId(); String url = leaderHostName + urlSuffix; HttpUriRequest request; switch (requestMethod) { case PUT: request = new HttpPut(url); break; case DELETE: request = new HttpDelete(url); break; default: throw new IllegalArgumentException("Unsupported requestMethod: " + requestMethod.name()); } return sendRequestToLeader(request, expectedResponseCode, leaderHostName); }
Source:
public CorrelationIdGenerator getCorrelationIdGenerator() { return correlationIdGenerator; }

Target:
CorrelationIdGenerator getCorrelationIdGenerator() { return correlationIdGenerator; }
Source:
public void testAccuracy() { WordForm __wordForm = new WordForm(); Parser labeledParser = new POSBracketToToken(labeledTestFile); int numSeen = 0; int numEqual = 0; Token labeledWord = (Token) labeledParser.next(); for (; labeledWord != null; labeledWord = (Token) labeledParser.next()) { String labeledTag = labeledWord.label; String testTag = tagger.discreteValue(labeledWord); if (labeledTag.equals(testTag)) { numEqual++; } numSeen++; } logger.info("Total accuracy over " + numSeen + " items: " + String.format("%.2f", 100.0 * (double) numEqual / (double) numSeen) + "%"); }

Target:
public void testAccuracy() { WordForm __wordForm = new WordForm(); Parser labeledParser = new POSBracketToToken(labeledTestFile); int numSeen = 0; int numEqual = 0; Token labeledWord = (Token) labeledParser.next(); for (; labeledWord != null; labeledWord = (Token) labeledParser.next()) { String labeledTag = labeledWord.label; String testTag = tagger.discreteValue(labeledWord); if (labeledTag.equals(testTag)) { numEqual++; } numSeen++; } System.out.println("Total accuracy over " + numSeen + " items: " + String.format("%.2f", 100.0 * (double) numEqual / (double) numSeen) + "%"); }
Source:
private void sendNopMessage(HelixDataAccessor accessor, String instanceName) { try { Message nopMsg = new Message(MessageType.NO_OP, UUID.randomUUID().toString()); nopMsg.setSrcName(instanceName); nopMsg.setTgtName(instanceName); accessor .setProperty(accessor.keyBuilder().message(nopMsg.getTgtName(), nopMsg.getId()), nopMsg); LOG.info("Send NO_OP message to " + nopMsg.getTgtName() + ", msgId: " + nopMsg.getId()); } catch (Exception e) { LOG.error(e.toString()); } }

Target:
private void sendNopMessage(HelixDataAccessor accessor, String instanceName) { try { Message nopMsg = new Message(MessageType.NO_OP, UUID.randomUUID().toString()); nopMsg.setSrcName(instanceName); nopMsg.setTgtName(instanceName); accessor .setProperty(accessor.keyBuilder().message(nopMsg.getTgtName(), nopMsg.getId()), nopMsg); LOG.info("Send NO_OP message to {}}, msgId: {}.", nopMsg.getTgtName(), nopMsg.getId()); } catch (Exception e) { LOG.error("Failed to send NO_OP message to {}.", instanceName, e); } }
Source:
public static ParsedParameters named(List<String> names) { if (names.contains(ParsedSql.POSITIONAL_PARAM)) { throw new IllegalArgumentException("Named parameters " + "list must not contain positional parameter " + ParsedSql.POSITIONAL_PARAM); } return new ParsedParameters(false, names); }

Target:
public static ParsedParameters named(List<String> names) { if (names.contains(ParsedSql.POSITIONAL_PARAM)) { throw new IllegalArgumentException("Named parameters " + "list must not contain positional parameter " + "\"" + ParsedSql.POSITIONAL_PARAM + "\""); } return new ParsedParameters(false, names); }
Source:
public Blob getBlob() { Rendition rendition = Framework.getLocalService(RenditionService.class).getDefaultRendition(doc, "download", null); return rendition != null ? rendition.getBlob() : null; }

Target:
public Blob getBlob() { Rendition rendition = Framework.getService(RenditionService.class).getDefaultRendition(doc, "download", null); return rendition != null ? rendition.getBlob() : null; }
Source:
public MethodOutcome createFHIRPerson(@ResourceParam Person person) { person = personResource.createFHIRPerson(person); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdDt(FHIRConstants.PERSON, person.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); coding.setDisplay("Person is successfully created"); outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }

Target:
public MethodOutcome createFHIRPerson(@ResourceParam Person person) { person = personResource.createFHIRPerson(person); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdType(FHIRConstants.PERSON, person.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); coding.setDisplay("Person is successfully created with id " + person.getId()); outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }
Source:
public void testLegacyACLBehavior() { String customName = "foo"; ACP acp = getInheritedReadWriteACP(); ACE customACE = ACE.builder("bar", READ_WRITE).creator("admin").build(); acp.addACE(customName, customACE); ACL[] acLs = acp.getACLs(); assertEquals(3, acLs.length); assertEquals(customName, acLs[1].getName()); assertEquals(ACL.LOCAL_ACL, acLs[0].getName()); }

Target:
public void testLegacyACLBehavior() { doTestACLBehavior(true); }
Source:
public void process(Node externs, Node root) { for (Node child : root.children()) { if (child.isScript()) { this.types = new LinkedHashMap<>(); this.typesToRename = new HashMap<>(); NodeTraversal.traverseEs6(compiler, child, new TypeConverter()); NodeTraversal.traverseEs6(compiler, child, new TypeMemberConverter()); NodeTraversal.traverseEs6(compiler, child, new FieldOnThisConverter()); NodeTraversal.traverseEs6(compiler, child, new InheritanceConverter()); if (!typesToRename.isEmpty()) { NodeTraversal.traverseEs6(compiler, child, new typeAliasConverter()); } } } }

Target:
public void process(Node externs, Node root) { for (Node child : root.children()) { if (child.isScript()) { this.types = new LinkedHashMap<>(); this.typesToRename = new LinkedHashMap<>(); NodeTraversal.traverseEs6(compiler, child, new TypeConverter()); NodeTraversal.traverseEs6(compiler, child, new TypeMemberConverter()); NodeTraversal.traverseEs6(compiler, child, new FieldOnThisConverter()); NodeTraversal.traverseEs6(compiler, child, new InheritanceConverter()); if (!typesToRename.isEmpty()) { NodeTraversal.traverseEs6(compiler, child, new TypeAliasConverter()); } } } }
Source:
public Sequence<T> run(final Query<T> query) { return new BaseSequence<T, Iterator<T>>( new BaseSequence.IteratorMaker<T, Iterator<T>>() { @Override public Iterator<T> make() { List<Future<List<T>>> futures = Lists.newArrayList( Iterables.transform( queryables, new Function<QueryRunner<T>, Future<List<T>>>() { @Override public Future<List<T>> apply(final QueryRunner<T> input) { return exec.submit( new PrioritizedCallable<List<T>>() { @Override public int getPriority() { return Queries.Priority.valueOf( query.getContextValue( "priority", Queries.Priority.NORMAL.name() ) ).ordinal(); } @Override public List<T> call() throws Exception { try { return Sequences.toList(input.run(query), Lists.<T>newArrayList()); } catch (Exception e) { log.error(e, "Exception with one of the sequences!"); throw Throwables.propagate(e); } } } ); } } ) ); return new MergeIterable<T>( ordering.nullsFirst(), Iterables.transform( futures, new Function<Future<List<T>>, Iterable<T>>() { @Override public Iterable<T> apply(Future<List<T>> input) { try { return input.get(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } } ) ).iterator(); } @Override public void cleanup(Iterator<T> tIterator) { } } ); }

Target:
public Sequence<T> run(final Query<T> query) { final int priority = Integer.parseInt(query.getContextValue("priority", "0")); return new BaseSequence<T, Iterator<T>>( new BaseSequence.IteratorMaker<T, Iterator<T>>() { @Override public Iterator<T> make() { List<Future<List<T>>> futures = Lists.newArrayList( Iterables.transform( queryables, new Function<QueryRunner<T>, Future<List<T>>>() { @Override public Future<List<T>> apply(final QueryRunner<T> input) { return exec.submit( new PrioritizedCallable<List<T>>(priority) { @Override public List<T> call() throws Exception { try { return Sequences.toList(input.run(query), Lists.<T>newArrayList()); } catch (Exception e) { log.error(e, "Exception with one of the sequences!"); throw Throwables.propagate(e); } } } ); } } ) ); return new MergeIterable<T>( ordering.nullsFirst(), Iterables.transform( futures, new Function<Future<List<T>>, Iterable<T>>() { @Override public Iterable<T> apply(Future<List<T>> input) { try { return input.get(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } } ) ).iterator(); } @Override public void cleanup(Iterator<T> tIterator) { } } ); }
Source:
private String formatJavaDoc(String str) { if (str != null) { int paramPos = str.indexOf(PARAM); if (paramPos != -1) { str = str.substring(0, paramPos); } int returnPos = str.indexOf(RETURN); if (returnPos != -1) { str = str.substring(0, returnPos); } str = str.trim(); } return str; }

Target:
private static String formatJavaDoc(String str) { if (str != null) { int paramPos = str.indexOf(PARAM); if (paramPos != -1) { str = str.substring(0, paramPos); } int returnPos = str.indexOf(RETURN); if (returnPos != -1) { str = str.substring(0, returnPos); } str = str.trim(); } return str; }
Source:
public synchronized void readAsync(final int numBytes, final AsyncCompletionHandler<ByteBuf> handler) { ensureOpen(new AsyncCompletionHandler<Void>() { @Override public void completed(final Void t) { if (!hasBytesAvailable(numBytes)) { pendingReader = new PendingReader(numBytes, handler); } else { CompositeByteBuf composite = allocator.compositeBuffer(pendingInboundBuffers.size()); int bytesNeeded = numBytes; for (Iterator<io.netty.buffer.ByteBuf> iter = pendingInboundBuffers.iterator(); iter.hasNext();) { io.netty.buffer.ByteBuf next = iter.next(); int bytesNeededFromCurrentBuffer = Math.min(next.readableBytes(), bytesNeeded); if (bytesNeededFromCurrentBuffer == next.readableBytes()) { composite.addComponent(next); iter.remove(); } else { next.retain(); composite.addComponent(next.readSlice(bytesNeededFromCurrentBuffer)); } composite.writerIndex(composite.writerIndex() + bytesNeededFromCurrentBuffer); bytesNeeded -= bytesNeededFromCurrentBuffer; if (bytesNeeded == 0) { break; } } NettyByteBuf buffer = new NettyByteBuf(composite); handler.completed(buffer.flip()); } } @Override public void failed(final Throwable t) { handler.failed(t); } }); }

Target:
public synchronized void readAsync(final int numBytes, final AsyncCompletionHandler<ByteBuf> handler) { if (pendingException != null) { handler.failed(pendingException); } else if (!hasBytesAvailable(numBytes)) { pendingReader = new PendingReader(numBytes, handler); } else { CompositeByteBuf composite = allocator.compositeBuffer(pendingInboundBuffers.size()); int bytesNeeded = numBytes; for (Iterator<io.netty.buffer.ByteBuf> iter = pendingInboundBuffers.iterator(); iter.hasNext();) { io.netty.buffer.ByteBuf next = iter.next(); int bytesNeededFromCurrentBuffer = Math.min(next.readableBytes(), bytesNeeded); if (bytesNeededFromCurrentBuffer == next.readableBytes()) { composite.addComponent(next); iter.remove(); } else { next.retain(); composite.addComponent(next.readSlice(bytesNeededFromCurrentBuffer)); } composite.writerIndex(composite.writerIndex() + bytesNeededFromCurrentBuffer); bytesNeeded -= bytesNeededFromCurrentBuffer; if (bytesNeeded == 0) { break; } } NettyByteBuf buffer = new NettyByteBuf(composite); handler.completed(buffer.flip()); } }
Source:
public Response toResponse(TransactionStatusException exception) { return Response.status(Response.Status.CONFLICT).build(); }

Target:
public Response toResponse(TransactionStatusException exception) { return Response.status(HttpResponseCodes.SC_CONFLICT).build(); }
Source:
void toDateString() { assertThat( DateTimeFormatterUtil.toDateString( LocalDateTime.ofInstant(JAN_FIRST_INSTANT, ZoneOffset.UTC)), is("Wed. Jan. 01 14:30:00 UTC 2020")); }

Target:
void toDateString() { assertThat( DateTimeFormatterUtil.toDateString( LocalDateTime.ofInstant(JAN_FIRST_INSTANT, ZoneOffset.UTC)), is("Wed Jan 01 14:30:00 UTC 2020")); }
Source:
private Criteria getCriteriaPersonModifier(Criteria criteria, List<PERSON_TYPE> personTypes) { if (personTypes.contains(PERSON_TYPE.PATIENT)) { DetachedCriteria crit = DetachedCriteria.forClass(Patient.class, "patient").setProjection( Property.forName("patientId")); criteria.add(Subqueries.propertyIn("person.personId", crit)); } if (personTypes.contains(PERSON_TYPE.USER)) { DetachedCriteria crit = DetachedCriteria.forClass(User.class, "user").setProjection(Property.forName("userId")); criteria.add(Subqueries.propertyIn("person.personId", crit)); } if (personTypes.contains(PERSON_TYPE.PERSON)) { } return criteria; }

Target:
private Criteria getCriteriaPersonModifier(Criteria criteria, List<PERSON_TYPE> personTypes) { if (personTypes.contains(PERSON_TYPE.PATIENT)) { DetachedCriteria crit = DetachedCriteria.forClass(Patient.class, "patient").setProjection( Property.forName("patientId")); criteria.add(Subqueries.propertyIn("person.personId", crit)); } if (personTypes.contains(PERSON_TYPE.USER)) { DetachedCriteria crit = DetachedCriteria.forClass(User.class, "user").setProjection(Property.forName("userId")); criteria.add(Subqueries.propertyIn("person.personId", crit)); } return criteria; }
Source:
protected void setRefLogIdent(final PatchSetApproval submitAudit) { if (submitAudit != null) { branchUpdate.setRefLogIdent(mArguments.identifiedUserFactory.create( submitAudit.getAccountId()).newRefLogIdent()); } }

Target:
protected final void setRefLogIdent(final PatchSetApproval submitAudit) { if (submitAudit != null) { branchUpdate.setRefLogIdent(mArguments.identifiedUserFactory.create( submitAudit.getAccountId()).newRefLogIdent()); } }
Source:
static BattleGroup createGeneral( final Collection<UnitType> unitTypes, final GameProperties properties) { final List<FiringSquadron> firingSquadronsWithoutFirstStrikeUnits = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> { return createFiringSquadron( firingSquadron, Predicate.not(unitIsFirstStrike(properties)), noDestroyerPresent()) .name(UNITS) .build(); }) .collect(Collectors.toList()); final List<FiringSquadron> firingSquadronsWithFirstStrikeUnits = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> { return createFiringSquadron( firingSquadron, firingUnitFilterData -> true, Predicate.not(noDestroyerPresent())) .name(UNITS) .build(); }) .collect(Collectors.toList()); final List<FiringSquadron> offenseSquadrons = Stream.of(firingSquadronsWithFirstStrikeUnits, firingSquadronsWithoutFirstStrikeUnits) .flatMap(Collection::stream) .collect(Collectors.toList()); final List<FiringSquadron> defenseSquadrons; if (Properties.getDefendingSubsSneakAttack(properties)) { defenseSquadrons = offenseSquadrons; } else { defenseSquadrons = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> { return createFiringSquadron( firingSquadron, firingUnitFilterData -> true, units -> true) .name(UNITS) .build(); }) .collect(Collectors.toList()); } return BattleGroup.builder() .offenseSquadrons(offenseSquadrons) .defenseSquadrons(defenseSquadrons) .fireType(BattleState.FireType.NORMAL) .build(); }

Target:
static BattleGroup createGeneral( final Collection<UnitType> unitTypes, final GameProperties properties) { final List<FiringSquadron> firingSquadronsWithoutFirstStrikeUnits = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> firingSquadron.toBuilder() .firingUnitsAnd(Predicate.not(unitIsFirstStrike(properties))) .enemyUnitRequirements(noDestroyerPresent()) .name(UNITS) .build()) .collect(Collectors.toList()); final List<FiringSquadron> firingSquadronsWithFirstStrikeUnits = FiringSquadron.createWithTargetInformation(unitTypes).stream() .map( firingSquadron -> firingSquadron.toBuilder() .enemyUnitRequirements(Predicate.not(noDestroyerPresent())) .name(UNITS) .build()) .collect(Collectors.toList()); final List<FiringSquadron> offenseSquadrons = Stream.of(firingSquadronsWithFirstStrikeUnits, firingSquadronsWithoutFirstStrikeUnits) .flatMap(Collection::stream) .collect(Collectors.toList()); final List<FiringSquadron> defenseSquadrons = Properties.getDefendingSubsSneakAttack(properties) ? offenseSquadrons : FiringSquadron.createWithTargetInformation(unitTypes).stream() .map(firingSquadron -> firingSquadron.toBuilder().name(UNITS).build()) .collect(Collectors.toList()); return BattleGroup.builder() .offenseSquadrons(offenseSquadrons) .defenseSquadrons(defenseSquadrons) .fireType(BattleState.FireType.NORMAL) .build(); }
Source:
public void testReadAheadCounters() throws IOException { describe("Test to check correct values for readAhead counters in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path readAheadCountersPath = path(getMethodName()); abfss.getAbfsConfiguration().setReadBufferSize(CUSTOM_BLOCK_BUFFER_SIZE); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, readAheadCountersPath); out.write(defBuffer); out.close(); in = abfss.openFileForRead(readAheadCountersPath, fs.getFsStatistics()); for (int i = 0; i < 5; i++) { in.seek(ONE_KB * i); in.read(defBuffer, ONE_KB * i, ONE_KB); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); while (stats.getRemoteBytesRead() < CUSTOM_READ_AHEAD_BUFFER_SIZE || stats.getReadAheadBytesRead() < CUSTOM_BLOCK_BUFFER_SIZE) { Thread.sleep(THREAD_SLEEP_10_SECONDS); } assertTrue(String.format("actual value of %d is not greater than or " + "equal to the expected value %d for readAheadReadBytes counter", stats.getReadAheadBytesRead(), CUSTOM_BLOCK_BUFFER_SIZE), stats.getReadAheadBytesRead() >= CUSTOM_BLOCK_BUFFER_SIZE); assertTrue(String.format("actual value of %d is not greater than or " + "equal to the expected value %d for remoteBytesRead counter", stats.getRemoteBytesRead(), CUSTOM_READ_AHEAD_BUFFER_SIZE), stats.getRemoteBytesRead() >= CUSTOM_READ_AHEAD_BUFFER_SIZE); } catch (InterruptedException e) { e.printStackTrace(); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }

Target:
public void testReadAheadCounters() throws IOException, InterruptedException { describe("Test to check correct values for readAhead counters in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path readAheadCountersPath = path(getMethodName()); abfss.getAbfsConfiguration().setReadBufferSize(CUSTOM_BLOCK_BUFFER_SIZE); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, readAheadCountersPath); out.write(defBuffer); out.close(); in = abfss.openFileForRead(readAheadCountersPath, fs.getFsStatistics()); for (int i = 0; i < 5; i++) { in.seek(ONE_KB * i); in.read(defBuffer, ONE_KB * i, ONE_KB); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); while (stats.getRemoteBytesRead() < CUSTOM_READ_AHEAD_BUFFER_SIZE || stats.getReadAheadBytesRead() < CUSTOM_BLOCK_BUFFER_SIZE) { Thread.sleep(THREAD_SLEEP_10_SECONDS); } Assertions.assertThat(stats.getReadAheadBytesRead()).describedAs( "Mismatch in readAheadBytesRead counter value") .isGreaterThanOrEqualTo(CUSTOM_BLOCK_BUFFER_SIZE); Assertions.assertThat(stats.getRemoteBytesRead()).describedAs( "Mismatch in remoteBytesRead counter value") .isGreaterThanOrEqualTo(CUSTOM_READ_AHEAD_BUFFER_SIZE); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }
Source:
private Configuration toggleConfiguration(Configuration config) throws IOException { String newFpid; Dictionary<String, Object> properties; if (config.getFactoryPid().contains(DISABLED_CONFIGURATION_SUFFIX)) { newFpid = config.getFactoryPid().replace(DISABLED_CONFIGURATION_SUFFIX, ""); properties = copyConfigProperties(config.getProperties(), newFpid); } else { newFpid = config.getFactoryPid().concat(DISABLED_CONFIGURATION_SUFFIX); properties = copyConfigProperties(config.getProperties(), config.getFactoryPid()); } config.delete(); Configuration newConfig = configurationAdmin.createFactoryConfiguration(newFpid, null); newConfig.update(properties); return newConfig; }

Target:
private Configuration toggleConfiguration(Configuration config) throws IOException { String newFpid; final Dictionary<String, Object> properties; String configFactoryPid = config.getFactoryPid(); if (configFactoryPid.contains(DISABLED_CONFIGURATION_SUFFIX)) { newFpid = configFactoryPid.replace(DISABLED_CONFIGURATION_SUFFIX, ""); properties = copyConfigProperties(config.getProperties(), newFpid); } else { newFpid = configFactoryPid.concat(DISABLED_CONFIGURATION_SUFFIX); properties = copyConfigProperties(config.getProperties(), configFactoryPid); } config.delete(); Configuration newConfig = configurationAdmin.createFactoryConfiguration(newFpid, null); newConfig.update(properties); return newConfig; }
Source:
private void registerUser(String email, String password, String role) throws UserAlreadyExistsException { User user = userRepository.findByUsername(email); if(user != null) { throw new UserAlreadyExistsException(); } try { PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); user = new User(email, passwordEncoder.encode(password),role); user.setEmail(email); KeystorePasswordHolder keystorePassword = new KeystorePasswordHolder(); keystorePassword.setPassword( KeystorePasswordUtils.generatePassword(KeystorePasswordUtils.KEYSTORE_PASSWORD_BYTES), password); KeystoreHolder keystoreHolder = new KeystoreHolder(); try { KeyStore keystore = keystoreHolder.getKeystore(keystorePassword.getPassword(password)); } catch (Exception e) { logger.warn("could not create keystore for user " + email); } user.setKeystorePasswordHolder(keystorePassword); user.setKeystoreHolder(keystoreHolder); userRepository.save(user); } catch (DataIntegrityViolationException e) { throw new UserAlreadyExistsException(); } }

Target:
private void registerUser(String email, String password, String role) throws UserAlreadyExistsException { User user = userRepository.findByUsername(email); if(user != null) { throw new UserAlreadyExistsException(); } try { PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); user = new User(email, passwordEncoder.encode(password),role); user.setEmail(email); KeystorePasswordHolder keystorePassword = new KeystorePasswordHolder(); keystorePassword.setPassword( KeystorePasswordUtils.generatePassword(KeystorePasswordUtils.KEYSTORE_PASSWORD_BYTES), password); KeystoreHolder keystoreHolder = new KeystoreHolder(); try { keystoreHolder.getKeystore(keystorePassword.getPassword(password)); } catch (Exception e) { throw new IllegalStateException("could not create keystore for user " + email); } user.setKeystorePasswordHolder(keystorePassword); user.setKeystoreHolder(keystoreHolder); userRepository.save(user); } catch (DataIntegrityViolationException e) { throw new UserAlreadyExistsException(); } }
Source:
public Object getValue(String fieldPath, Object object) throws Exception { try { if (object != null && fieldPath != null) { Object currentObject = object; String[] tokens = StringUtils.split(fieldPath, FIELD_PATH_SEPARATOR); for (String token : tokens) { if (token.charAt(0) == DECODER_PREFIX) { String fieldName = token.substring(1); FieldDecoder decoder = decoders.get(fieldName); if (decoder == null) { throw new Exception("no decoder registered for " + token); } Object fieldValue = getFieldValue(fieldName, currentObject); if (decoder.canHandle(fieldValue)) { currentObject = decoder.decode(fieldValue); } else { throw new Exception(fieldValue!=null? decoder.getClass().getName() + " decoder is not capable of handling object: " + fieldValue.toString() + ", which is " + fieldValue.getClass().getName() + " class instance" :decoder.getClass().getName() + " decoder is not capable of handling null object"); } } else if (token.indexOf('[')>0) { String fieldName = token.substring(0, token.indexOf('[')); currentObject = getFieldValue(fieldName, currentObject); if (currentObject!=null) { if (currentObject.getClass().isArray()) { currentObject = Array.get(currentObject, getArrayPositionFromToken(token)); } else if (List.class.isAssignableFrom(currentObject.getClass())) { currentObject = ((List<?>)currentObject).get(getArrayPositionFromToken(token)); } else { throw new Exception("unable to extract array or list element " + "based on field path: " + fieldPath + ", " + "object is neither an array nor list:" + currentObject.getClass().getName()); } } else { throw new Exception("unable to extract array or list element " + "based on field path: " + fieldPath + ", " + "object is null!"); } } else { currentObject = getFieldValue(token, currentObject); } } return currentObject; } else { return null; } } catch (Exception e) { throw new Exception("unable to resolve field path '" + fieldPath + "' on object " + object, e); } }

Target:
public Object getValue(String fieldPath, Object object) throws FieldAccessorException { if (object != null && fieldPath != null) { try { Object currentObject = object; String[] tokens = StringUtils.split(fieldPath, FIELD_PATH_SEPARATOR); for (final String token : tokens) { String parsedToken = token; boolean useDecoder = false; Integer arrayOrListPosition = null; if (parsedToken.charAt(0) == DECODER_PREFIX) { useDecoder = true; parsedToken = parsedToken.substring(1); } if (parsedToken.indexOf('[') > 0) { arrayOrListPosition = getArrayPositionFromToken(parsedToken); parsedToken = parsedToken.substring(0, parsedToken.indexOf('[')); } currentObject = PropertyUtils.getProperty(currentObject, parsedToken); if (useDecoder) { currentObject = decode(parsedToken, currentObject); } if (arrayOrListPosition!=null) { currentObject = handleArrayOrList(arrayOrListPosition, currentObject); } } return currentObject; } catch (Exception e) { throw new FieldAccessorException("unable to resolve field path '" + fieldPath + "' on object " + object, e); } } else { throw new FieldAccessorException("Neither fieldPath nor object can be null! " + "Got fieldPath: " + fieldPath + ", object: " + object); } }