auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void exportAnalysis() { FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.SAVE); String selection = fAnalysesTable.getSelection()[0].getText(); dialog.setText(NLS.bind(Messages.ManageXMLAnalysisDialog_SelectFileExport, selection)); dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION, TmfXmlStrings.WILDCARD }); String selectionXml = XmlUtils.createXmlFileString(selection); dialog.setFileName(selectionXml); String path = dialog.open(); if (path != null) { if (!XmlUtils.exportXmlFile(selectionXml, path).isOK()) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToExport, selectionXml)); } } }

Target:
private void exportAnalysis() { FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.SAVE); String selection = fAnalysesTable.getSelection()[0].getText(); dialog.setText(NLS.bind(Messages.ManageXMLAnalysisDialog_SelectFileExport, selection)); dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION, TmfXmlStrings.WILDCARD }); String selectionXml = XmlUtils.createXmlFileString(selection); dialog.setFileName(selectionXml); String path = dialog.open(); if (path != null && !XmlUtils.exportXmlFile(selectionXml, path).isOK()) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToExport, selectionXml)); } }
Source:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (isInflateWebViewLayout) { swipeContainer.setEnabled(false); } else { view.findViewById(R.id.content_error).setVisibility(View.VISIBLE); view.findViewById(R.id.content_error_icon).setVisibility(View.GONE); tvContentError.setText(getString(R.string.error_unknown)); btnContentErrorAction.setVisibility(View.VISIBLE); btnContentErrorAction.setText(R.string.lbl_reload); btnContentErrorAction.setOnClickListener(v -> getFragmentManager().beginTransaction() .detach(AuthenticatedWebViewFragment.this) .attach(AuthenticatedWebViewFragment.this).commitAllowingStateLoss()); } }

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!isSystemUpdatingWebView) { swipeContainer.setEnabled(false); } else { view.findViewById(R.id.content_error).setVisibility(View.VISIBLE); final IconImageView ivContentError = view.findViewById(R.id.content_error_icon); ivContentError.setIcon(FontAwesomeIcons.fa_exclamation_circle); tvContentError.setText(getString(R.string.error_unknown)); btnContentErrorAction.setVisibility(View.VISIBLE); btnContentErrorAction.setText(R.string.lbl_reload); btnContentErrorAction.setOnClickListener( v -> UiUtil.restartFragment(AuthenticatedWebViewFragment.this)); } }
Source:
protected Void visitCreateTableAsSelect(CreateTableAsSelect node, Integer indent) { builder.append("CREATE TABLE "); if (node.isNotExists()) { builder.append("IF NOT EXISTS "); } builder.append(formatName(node.getName())); if (node.getColumnAliases().isPresent()) { builder.append(format("(%s) ", join(",", node.getColumnAliases().get()))); } if (node.getComment().isPresent()) { builder.append("\nCOMMENT " + formatStringLiteral(node.getComment().get())); } appendTableProperties(builder, node.getProperties()); builder.append(" AS "); process(node.getQuery(), indent); if (!node.isWithData()) { builder.append(" WITH NO DATA"); } return null; }

Target:
protected Void visitCreateTableAsSelect(CreateTableAsSelect node, Integer indent) { builder.append("CREATE TABLE "); if (node.isNotExists()) { builder.append("IF NOT EXISTS "); } builder.append(formatName(node.getName())); if (node.getColumnAliases().isPresent()) { String columnList = node.getColumnAliases().get().stream().map(element -> formatName(element.getName())).collect(joining(", ")); builder.append(format("( %s )", columnList)); } if (node.getComment().isPresent()) { builder.append("\nCOMMENT " + formatStringLiteral(node.getComment().get())); } appendTableProperties(builder, node.getProperties()); builder.append(" AS "); process(node.getQuery(), indent); if (!node.isWithData()) { builder.append(" WITH NO DATA"); } return null; }
Source:
private void addEnrollmentsToSession(HttpServletRequest request, StringBuilder sb) { M_log.debug("ENROLLMENTS: " + sb.toString()); HashMap<Integer, String> enrollmentsFound = new HashMap<Integer, String>(); JSONArray enrollmentsArray = new JSONArray(sb.toString()); for(int i = 0; i < enrollmentsArray.length(); i++){ JSONObject childJSONObject = enrollmentsArray.getJSONObject(i); M_log.debug("ENROLLMENT RECORD: " + childJSONObject.get("course_id") + " " + childJSONObject.get("course_section_id") + " " + childJSONObject.get("type")); String newType = childJSONObject.getString("type"); String newRole = childJSONObject.getString("role"); M_log.debug("NEW TYPE: " + newType); M_log.debug("NEW ROLE: " + newRole); boolean isTeacher = false; boolean isDesigner = false; if(newType.equals("DesignerEnrollment") && newRole.equals("DesignerEnrollment")){ isDesigner = true; } if(newType.equals("TeacherEnrollment")){ isTeacher = true; } if(isTeacher || isDesigner){ enrollmentsFound.put(childJSONObject.getInt("course_id"), childJSONObject.getString("type")); M_log.debug("BREAKING"); break; } else{ enrollmentsFound.put(childJSONObject.getInt("course_id"), childJSONObject.getString("TAEnrollment")); } } M_log.debug("DONE"); request.getSession().setAttribute("enrollments", enrollmentsFound); M_log.debug("SESSION ENROLLMENTS: " + request.getSession().getAttribute("enrollments")); }

Target:
private void addEnrollmentsToSession(HttpServletRequest request, StringBuilder sb) { M_log.debug("ENROLLMENTS: " + sb.toString()); HashMap<Integer, String> enrollmentsFound = new HashMap<Integer, String>(); JSONArray enrollmentsArray = new JSONArray(sb.toString()); for(int i = 0; i < enrollmentsArray.length(); i++){ JSONObject childJSONObject = enrollmentsArray.getJSONObject(i); M_log.debug("ENROLLMENT RECORD: " + childJSONObject.get("course_id") + " " + childJSONObject.get("course_section_id") + " " + childJSONObject.get("type")); String newType = childJSONObject.getString("type"); String newRole = childJSONObject.getString("role"); M_log.debug("NEW TYPE: " + newType); M_log.debug("NEW ROLE: " + newRole); boolean canAddTeacher = false; if(newType.equals(DESIGNER_ENROLLMENT) && newRole.equals(DESIGNER_ENROLLMENT)){ canAddTeacher = true; } if(newType.equals(TEACHER_ENROLLMENT)){ canAddTeacher = true; } if(canAddTeacher){ enrollmentsFound.put(childJSONObject.getInt("course_id"), childJSONObject.getString(TEACHER_ENROLLMENT)); break; } else{ enrollmentsFound.put(childJSONObject.getInt("course_id"), childJSONObject.getString(TA_ENROLLMENT)); } } request.getSession().setAttribute("enrollments", enrollmentsFound); M_log.debug("SESSION ENROLLMENTS: " + request.getSession().getAttribute("enrollments")); }
Source:
public void testDetectCleanWorkingDirectory() throws Exception { File dotGitDirectory = AvailableGitTestRepo.GIT_WITH_NO_CHANGES.getDir(); GitDescribeConfig gitDescribeConfig = new GitDescribeConfig(); gitDescribeConfig.setSkip(false); String prefix = "git"; int abbrevLength = 7; String dateFormat = "dd.MM.yyyy '@' HH:mm:ss z"; GitCommitIdMojo mojo = new GitCommitIdMojo(); mojo.setDotGitDirectory(dotGitDirectory); mojo.setPrefix(prefix); mojo.setAbbrevLength(abbrevLength); mojo.setDateFormat(dateFormat); mojo.setVerbose(true); mojo.useNativeGit(false); mojo.setGitDescribe(gitDescribeConfig); mojo.setCommitIdGenerationMode("flat"); mojo.project = mock(MavenProject.class, RETURNS_MOCKS); Properties props = new Properties(); when(mojo.project.getProperties()).thenReturn(props); when(mojo.project.getPackaging()).thenReturn("jar"); mojo.execute(); Properties properties = mojo.getProperties(); assertThat(properties.get("git.dirty")).isEqualTo("false"); }

Target:
public void testDetectCleanWorkingDirectory() throws Exception { File dotGitDirectory = AvailableGitTestRepo.GIT_WITH_NO_CHANGES.getDir(); GitDescribeConfig gitDescribeConfig = new GitDescribeConfig(); gitDescribeConfig.setSkip(false); String prefix = "git"; int abbrevLength = 7; String dateFormat = "dd.MM.yyyy '@' HH:mm:ss z"; boolean verbose = true; boolean useNativeGit = false; String commitIdGenerationMode = "flat"; GitCommitIdMojo mojo = new GitCommitIdMojo(); mojo.setDotGitDirectory(dotGitDirectory); mojo.setPrefix(prefix); mojo.setAbbrevLength(abbrevLength); mojo.setDateFormat(dateFormat); mojo.setVerbose(verbose); mojo.useNativeGit(useNativeGit); mojo.setGitDescribe(gitDescribeConfig); mojo.setCommitIdGenerationMode(commitIdGenerationMode); mojo.project = mock(MavenProject.class, RETURNS_MOCKS); Properties props = new Properties(); when(mojo.project.getProperties()).thenReturn(props); when(mojo.project.getPackaging()).thenReturn("jar"); mojo.execute(); Properties properties = mojo.getProperties(); assertThat(properties.get("git.dirty")).isEqualTo("false"); }
Source:
public void linkifyMessageChangeId() throws Exception { Config config = new Config(); config.setString("commentlink", "bugzilla", "match", "(bug\\s+#?)(\\d+)"); config.setString("commentlink", "bugzilla", "link", "<LINK_1>$2"); config.setString("commentlink", "tracker", "match", "([Bb]ug:\\s+)(\\d+)"); config.setString("commentlink", "tracker", "html", "$1<a href=\"<LINK_0>$2\">$2</a>"); Linkifier l = new Linkifier(TestGitilesUrls.URLS, config); assertEquals(ImmutableList.of( ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z")), l.linkify(REQ, "I0123456789")); assertEquals(ImmutableList.of( ImmutableMap.of("text", "Change-Id: "), ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z")), l.linkify(REQ, "Change-Id: I0123456789")); assertEquals(ImmutableList.of( ImmutableMap.of("text", "Change-Id: "), ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z"), ImmutableMap.of("text", " exists")), l.linkify(REQ, "Change-Id: I0123456789 exists")); }

Target:
public void linkifyMessageChangeId() throws Exception { Config config = new Config(); Linkifier l = new Linkifier(TestGitilesUrls.URLS, config); assertEquals(ImmutableList.of( ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z")), l.linkify(REQ, "I0123456789")); assertEquals(ImmutableList.of( ImmutableMap.of("text", "Change-Id: "), ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z")), l.linkify(REQ, "Change-Id: I0123456789")); assertEquals(ImmutableList.of( ImmutableMap.of("text", "Change-Id: "), ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z"), ImmutableMap.of("text", " exists")), l.linkify(REQ, "Change-Id: I0123456789 exists")); }
Source:
private String convertFromHtml(final String textToConvert) { String regex1 = "<br />|<p>|</p>|<table>|</table >|<a href='(.*)'>(.*)</a>|<h4>|<pre>|</pre>|<ul>|</ul>|</li>|</tr>|<hr />"; String regex2 = "</h4>|<tbody>|</tbody>|<tr>|<th>"; String regex3 = "<li>"; String regex4 = "</th>"; return textToConvert.replaceAll(regex1, "\n").replaceAll(regex2, "").replaceAll(regex3, " - ").replaceAll(regex4, "\t"); }

Target:
private String convertFromHtml(final String textToConvert) { final String regex1 = "<br />|<p>|</p>|<table>|</table >|<a href='(.*)'>(.*)</a>|<h4>|<pre>|</pre>|<ul>|</ul>|</li>|</tr>|<hr />"; final String regex2 = "<li>"; final String regex3 = "</th>"; final String regex4 = "</h4>|<tbody>|</tbody>|<tr>|<th>|<.*?>"; return textToConvert .replaceAll(regex1, "\n") .replaceAll(regex2, " - ") .replaceAll(regex3, "\t") .replaceAll(regex4, ""); }
Source:
public void poll(long timeoutMs, List<NetworkSend> sends) throws IOException { this.sends = sends; if (sends != null) { for (NetworkSend send : sends) { if (state.get() == MockSelectorState.ThrowExceptionOnPoll) { throw new IOException("Mock exception on poll"); } if (state.get() == MockSelectorState.DisconnectOnSend) { disconnected.add(send.getConnectionId()); } else { MockServer server = connIdToServer.get(send.getConnectionId()); BoundedByteBufferReceive receive = server.send(send.getPayload()); receives.add(new NetworkReceive(send.getConnectionId(), receive, time)); } } } if (state.get() == MockSelectorState.SleepOnPoll) { try { Thread.sleep(0); } catch (InterruptedException e) { throw new IOException("Caught interrupted exception"); } } }

Target:
public void poll(long timeoutMs, List<NetworkSend> sends) throws IOException { this.sends = sends; if (sends != null) { for (NetworkSend send : sends) { if (state.get() == MockSelectorState.ThrowExceptionOnSend) { throw new IOException("Mock exception on send"); } if (state.get() == MockSelectorState.DisconnectOnSend) { disconnected.add(send.getConnectionId()); } else { MockServer server = connIdToServer.get(send.getConnectionId()); BoundedByteBufferReceive receive = server.send(send.getPayload()); receives.add(new NetworkReceive(send.getConnectionId(), receive, time)); } } } if (state.get() == MockSelectorState.ThrowExceptionOnAllPoll) { throw new IOException("Mock exception on poll"); } }
Source:
private Set<BasicAuthorizerRole> getRolesForUser( BasicAuthorizerUser user, Map<String, BasicAuthorizerRole> roleMap ) { Set<BasicAuthorizerRole> roles = new HashSet<>(); for (String roleName : user.getRoles()) { BasicAuthorizerRole role = roleMap.get(roleName); if (role == null) { log.error("User [%s] had role [%s], but role was not found.", user.getName(), roleName); } else { roles.add(role); } } return roles; }

Target:
private Set<BasicAuthorizerRole> getRolesForUser( BasicAuthorizerUser user, Map<String, BasicAuthorizerRole> roleMap ) { Set<BasicAuthorizerRole> roles = new HashSet<>(); for (String roleName : user.getRoles()) { BasicAuthorizerRole role = roleMap.get(roleName); if (role == null) { log.error("User [%s] had role [%s], but role object was not found.", user.getName(), roleName); } else { roles.add(role); } } return roles; }
Source:
private boolean fillDestMap() { if (getParameters().getStorageDomainId() != null && !Guid.Empty.equals(getParameters().getStorageDomainId())) { Guid storageId = getParameters().getStorageDomainId(); for (DiskImage image : getImagesToCheckDestinationStorageDomains()) { if (isImageOnDomain(image, storageId)) { diskInfoDestinationMap.put(image.getId(), makeNewImage(storageId, image)); } else { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NOT_FOUND_ON_DESTINATION_DOMAIN); return false; } } return validateProvidedDestinations(); } ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(), diskInfoDestinationMap, destStorages, false); return true; }

Target:
private boolean fillDestMap() { if (getParameters().getStorageDomainId() != null && !Guid.Empty.equals(getParameters().getStorageDomainId())) { Guid storageId = getParameters().getStorageDomainId(); for (DiskImage image : getImagesToCheckDestinationStorageDomains()) { diskInfoDestinationMap.put(image.getId(), makeNewImage(storageId, image)); } return validateProvidedDestinations(); } ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(), diskInfoDestinationMap, destStorages, false); return true; }
Source:
public Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDefinition attributeDefinition) throws InternalErrorException { Attribute attribute = new Attribute(attributeDefinition); SortedSet<String> tcsMailsValue = new TreeSet<>(); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_preferredMail)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_ISMail)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_o365EmailAddressesMU)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_publicAliasMails)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_privateAliasMails)); attribute.setValue(new ArrayList(tcsMailsValue)); return attribute; }

Target:
public Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDefinition attributeDefinition) { Attribute attribute = new Attribute(attributeDefinition); SortedSet<String> tcsMailsValue = new TreeSet<>(); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_preferredMail)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_ISMail)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_o365EmailAddressesMU)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_publicAliasMails)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_privateAliasMails)); attribute.setValue(new ArrayList<>(tcsMailsValue)); return attribute; }
Source:
public void watchLogs(PodLogHandler handler) throws InfrastructureException { if (logWatcher == null) { LOG.debug("start watching logs of workspace [{}]", workspaceId); logWatcher = new LogWatcher(clientFactory, workspaceId, namespace, handler); watchEvents(logWatcher); } else { LOG.debug("Already watching logs of workspace [{}]", workspaceId); } }

Target:
public void watchLogs(PodLogHandler handler) throws InfrastructureException { if (logWatcher == null) { LOG.debug("start watching logs of workspace [{}]", workspaceId); logWatcher = new LogWatcher(clientFactory, workspaceId, namespace, executor); logWatcher.addLogHandler(handler); watchEvents(logWatcher); } else { LOG.debug("Already watching logs of workspace [{}], just adding log handler", workspaceId); logWatcher.addLogHandler(handler); } }
Source:
public void testToStreamRecordV2WhenNewImageIsNull() { com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord = streamRecord_event.clone(); streamRecord.setNewImage(null); Assertions.assertDoesNotThrow(() -> { StreamRecord convertedStreamRecord = DynamodbStreamRecordTransformer.toStreamRecordV2(streamRecord); }); }

Target:
public void testToStreamRecordV2WhenNewImageIsNull() { com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord = streamRecord_event.clone(); streamRecord.setNewImage(null); Assertions.assertDoesNotThrow(() -> { DynamodbStreamRecordTransformer.toStreamRecordV2(streamRecord); }); }
Source:
public void test_findContentletByIdentifierAnyLanguage() throws DotSecurityException, DotDataException { final ContentletAPI contentletAPI = APILocator.getContentletAPI(); final User user = APILocator.systemUser(); final Language language1 = new LanguageDataGen().nextPersisted(); final Language language2 = new LanguageDataGen().nextPersisted(); final ContentType bannerLikeContentType = TestDataUtils.getBannerLikeContentType(); final Contentlet banner1 = TestDataUtils .getBannerLikeContent(true, language1.getId(), bannerLikeContentType.id(), null); Contentlet banner2 = contentletAPI.checkout(banner1.getInode(), APILocator.systemUser(), false); banner2.setLanguageId(language2.getId()); banner2.setInode(""); banner2 = contentletAPI.checkin(banner2, user, false); final Contentlet result = instance.findContentletByIdentifierAnyLanguage(banner1.getIdentifier()); assertNotNull(result); assertEquals(banner2.getIdentifier(), result.getIdentifier()); }

Target:
public void test_findContentletByIdentifierAnyLanguage() throws DotSecurityException, DotDataException { final ContentletAPI contentletAPI = APILocator.getContentletAPI(); final User user = APILocator.systemUser(); final Language language1 = new LanguageDataGen().nextPersisted(); final Language language2 = new LanguageDataGen().nextPersisted(); final ContentType bannerLikeContentType = TestDataUtils.getBannerLikeContentType(); final Contentlet banner1 = TestDataUtils .getBannerLikeContent(true, language1.getId(), bannerLikeContentType.id(), null); Contentlet banner2 = contentletAPI.checkout(banner1.getInode(), APILocator.systemUser(), false); banner2.setLanguageId(language2.getId()); banner2 = contentletAPI.checkin(banner2, user, false); final Contentlet result = instance.findContentletByIdentifierAnyLanguage(banner1.getIdentifier()); assertNotNull(result); assertEquals(banner2.getIdentifier(), result.getIdentifier()); }
Source:
private boolean isNewerThanServer(String objectType, String objectId, long lastModifiedDate) throws JSONException, IOException { boolean isNewer = false; long serverLastModified = UNCHANGED; final SOQLBuilder builder = SOQLBuilder.getInstanceWithFields(Constants.LAST_MODIFIED_DATE); builder.from(objectType); builder.where(Constants.ID + " = '" + objectId + "'"); final String query = builder.build(); RestResponse lastModResponse = null; lastModResponse = sendSyncWithSmartSyncUserAgent(RestRequest.getRequestForQuery(apiVersion, query)); if (lastModResponse != null && lastModResponse.isSuccess()) { final JSONObject responseJSON = lastModResponse.asJSONObject(); if (responseJSON != null) { final JSONArray records = responseJSON.optJSONArray("records"); if (records != null && records.length() > 0) { final JSONObject obj = records.optJSONObject(0); if (obj != null) { final String lastModStr = obj.optString(Constants.LAST_MODIFIED_DATE); if (!TextUtils.isEmpty(lastModStr)) { try { serverLastModified = TIMESTAMP_FORMAT.parse(lastModStr).getTime(); } catch (ParseException e) { Log.e("SmartSyncManager:isNewerThanServer", "Error during date parsing", e); } } } } } } if (serverLastModified < lastModifiedDate) { isNewer = true; } return isNewer; }

Target:
private boolean isNewerThanServer(String objectType, String objectId, long lastModifiedDate) throws JSONException, IOException { boolean isNewer = false; long serverLastModified = UNCHANGED; final SOQLBuilder builder = SOQLBuilder.getInstanceWithFields(Constants.LAST_MODIFIED_DATE); builder.from(objectType); builder.where(Constants.ID + " = '" + objectId + "'"); final String query = builder.build(); RestResponse lastModResponse = null; lastModResponse = sendSyncWithSmartSyncUserAgent(RestRequest.getRequestForQuery(apiVersion, query)); if (lastModResponse != null && lastModResponse.isSuccess()) { final JSONObject responseJSON = lastModResponse.asJSONObject(); if (responseJSON != null) { final JSONArray records = responseJSON.optJSONArray("records"); if (records != null && records.length() > 0) { final JSONObject obj = records.optJSONObject(0); if (obj != null) { final String lastModStr = obj.optString(Constants.LAST_MODIFIED_DATE); if (!TextUtils.isEmpty(lastModStr)) { try { serverLastModified = TIMESTAMP_FORMAT.parse(lastModStr).getTime(); } catch (ParseException e) { Log.e("SmartSyncManager:isNewerThanServer", "Error during date parsing", e); } } } } } } if (serverLastModified <= lastModifiedDate) { isNewer = true; } return isNewer; }
Source:
public void persist(List<QueryResult> crawlResults) throws IOException, GitAPIException { try { gitHandler.updateLocalRepository(); } catch (GitAPIException e) { LOGGER.info("Updating repository from remote failed"); } persistResults(crawlResults); study.setLastSearchDate(LocalDate.now()); persistStudy(); try { gitHandler.updateRemoteRepository("Conducted search " + LocalDate.now()); } catch (GitAPIException e) { LOGGER.info("Updating remote repository failed"); } }

Target:
public void persist(List<QueryResult> crawlResults) throws IOException, GitAPIException { try { gitHandler.updateLocalRepository(); } catch (GitAPIException e) { LOGGER.error("Updating repository from remote failed"); } persistResults(crawlResults); study.setLastSearchDate(LocalDate.now()); persistStudy(); try { gitHandler.updateRemoteRepository("Conducted search " + LocalDate.now()); } catch (GitAPIException e) { LOGGER.error("Updating remote repository failed"); } }
Source:
Mono<Response<RecognizePiiEntitiesResult>> recognizePiiEntitiesWithResponse(String text, String language, Context context) { return recognizeBatchPiiEntitiesWithResponse( Arrays.asList(new TextDocumentInput(Integer.toString(0), text, language)), null, context) .flatMap(response -> { Iterator<RecognizePiiEntitiesResult> responseItem = response.getValue().iterator(); return Mono.just(new SimpleResponse<>(response, responseItem.next())); }); }

Target:
Mono<Response<RecognizePiiEntitiesResult>> recognizePiiEntitiesWithResponse(String text, String language, Context context) { Objects.requireNonNull(text, "'text' cannot be null."); return recognizeBatchPiiEntitiesWithResponse( Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); }
Source:
public Mono shutdown(ExecutorService executorService) { if (executorService == null) { return Mono.empty(); } EventLoopGroup eventLoopGroup = (EventLoopGroup) executorService; return Mono.defer(() -> FutureMono.from((Future) eventLoopGroup.shutdownGracefully())); }

Target:
public Mono<Void> shutdown(ExecutorService executorService) { if (executorService == null) { return Mono.empty(); } EventLoopGroup eventLoopGroup = (EventLoopGroup) executorService; return Mono.defer(() -> FutureMono.from((Future) eventLoopGroup.shutdownGracefully())); }
Source:
public boolean isGroupSeen(GroupKey<?> groupKey) { class GroupSeenQueryResultProcessor implements CaseDbAccessQueryCallback { private boolean seen = false; boolean getGroupSeen() { return seen; } @Override public void process(ResultSet resultSet) { try { if (resultSet != null) { while (resultSet.next()) { int count = resultSet.getInt("count"); seen = count > 0; return; } } } catch (SQLException ex) { LOGGER.log(Level.SEVERE, "failed to get group seen", ex); } } } try { String groupIdQuery = String.format("( SELECT group_id FROM " + GROUPS_TABLENAME + " WHERE attribute = \'%s\' AND value = \'%s\' )", groupKey.getAttribute().attrName.toString(), groupKey.getValueDisplayName() ); String groupSeenQueryStmt = String.format("COUNT((*) as count FROM " + GROUPS_SEEN_TABLENAME + " WHERE seen = 1 AND group_id in ( %s )", groupIdQuery); GroupSeenQueryResultProcessor queryResultProcessor = new GroupSeenQueryResultProcessor(); tskCase.getCaseDbAccessManager().select(groupSeenQueryStmt, queryResultProcessor); return queryResultProcessor.getGroupSeen(); } catch (TskCoreException ex) { String msg = String.format("Failed to get is group seen for group key %s", groupKey.getValueDisplayName()); LOGGER.log(Level.WARNING, msg, ex); } return false; }

Target:
public boolean isGroupSeen(GroupKey<?> groupKey) { class GroupSeenQueryResultProcessor implements CaseDbAccessQueryCallback { private boolean seen = false; boolean getGroupSeen() { return seen; } @Override public void process(ResultSet resultSet) { try { if (resultSet != null) { while (resultSet.next()) { int count = resultSet.getInt("count"); seen = count > 0; return; } } } catch (SQLException ex) { LOGGER.log(Level.SEVERE, "failed to get group seen", ex); } } } try { String groupIdQuery = ""; if (groupKey.getDataSourceObjId() != 0) { groupIdQuery = String.format("( SELECT group_id FROM " + GROUPS_TABLENAME + " WHERE attribute = \'%s\' AND value = \'%s\' AND data_source_obj_id = %d)", groupKey.getAttribute().attrName.toString(), groupKey.getValueDisplayName(), groupKey.getDataSourceObjId() ); } else { groupIdQuery = String.format("( SELECT group_id FROM " + GROUPS_TABLENAME + " WHERE attribute = \'%s\' AND value = \'%s\' )", groupKey.getAttribute().attrName.toString(), groupKey.getValueDisplayName() ); } String groupSeenQueryStmt = String.format("COUNT((*) as count FROM " + GROUPS_SEEN_TABLENAME + " WHERE seen = 1 AND group_id in ( %s )", groupIdQuery); GroupSeenQueryResultProcessor queryResultProcessor = new GroupSeenQueryResultProcessor(); tskCase.getCaseDbAccessManager().select(groupSeenQueryStmt, queryResultProcessor); return queryResultProcessor.getGroupSeen(); } catch (TskCoreException ex) { String msg = String.format("Failed to get is group seen for group key %s", groupKey.getValueDisplayName()); LOGGER.log(Level.WARNING, msg, ex); } return false; }
Source:
public void handleError(HttpCommand command, HttpResponse response) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data) : null; Exception exception = message != null ? new HttpResponseException(command, response, message) : new HttpResponseException(command, response); message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine()); switch (response.getStatusCode()) { case 400: break; case 401: case 403: exception = new AuthorizationException(message, exception); break; case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { exception = new ResourceNotFoundException(message, exception); } break; } command.setException(exception); }

Target:
public void handleError(HttpCommand command, HttpResponse response) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data) : null; Exception exception = message != null ? new HttpResponseException(command, response, message) : new HttpResponseException(command, response); message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine()); switch (response.getStatusCode()) { case 400: break; case 401: case 403: exception = new AuthorizationException(message, exception); break; case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { exception = new ResourceNotFoundException(message, exception); } break; case 409: exception = new IllegalStateException(exception.getMessage(), exception); break; } command.setException(exception); }
Source:
public void distributedStart() throws IOException{ Connection conn =connectionFactory.getConnection(); boolean onHold; try(Admin admin=conn.getAdmin()){ do{ onHold=false; TableName spliceInit = TableName.valueOf(SpliceMasterObserver.INIT_TABLE); try{ TableDescriptor desc = TableDescriptorBuilder .newBuilder(spliceInit) .setColumnFamily( ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes("FOO")).build() ).setPriority(1000).build(); admin.createTable(desc); LOG.error("We could create SPLICE_INIT table, this means the SpliceMasterObserver hasn't loaded properly"); try { admin.disableTable(spliceInit); admin.deleteTable(spliceInit); } catch (IOException e) { LOG.warn("Received exception while cleaning up SPLICE_INIT", e); } throw new DoNotRetryIOException("We could create SPLICE_INIT table, SpliceMasterObser not loaded"); }catch(InitializationCompleted ic) { try { ZkUtils.safeInitializeZooKeeper(); } catch (InterruptedException e) { throw new InterruptedIOException(); } catch (KeeperException e) { throw new IOException(e); } } catch (TableExistsException e) { LOG.error("SPLICE_INIT already exists, this shouldn't happen. Remove it and retry"); try { admin.disableTable(spliceInit); admin.deleteTable(spliceInit); } catch (IOException ioe) { LOG.warn("Received exception while cleaning up SPLICE_INIT", e); } onHold = true; } catch(Exception ex){ if (!causeIsPleaseHold(ex)) throw ex; onHold = true; try { clock.sleep(1, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new InterruptedIOException(); } } }while(onHold); } }

Target:
public void distributedStart() throws IOException{ Connection conn =connectionFactory.getConnection(); boolean onHold; try(Admin admin=conn.getAdmin()){ do{ onHold=false; TableName spliceInit = TableName.valueOf(SpliceMasterObserver.INIT_TABLE); try{ TableDescriptor desc = TableDescriptorBuilder .newBuilder(spliceInit) .setColumnFamily( ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes("FOO")).build() ).build(); admin.createTable(desc); LOG.error("We could create SPLICE_INIT table, this means the SpliceMasterObserver hasn't loaded properly"); try { admin.disableTable(spliceInit); admin.deleteTable(spliceInit); } catch (IOException e) { LOG.warn("Received exception while cleaning up SPLICE_INIT", e); } throw new DoNotRetryIOException("We could create SPLICE_INIT table, SpliceMasterObser not loaded"); }catch(InitializationCompleted ic) { try { ZkUtils.safeInitializeZooKeeper(); } catch (InterruptedException e) { throw new InterruptedIOException(); } catch (KeeperException e) { throw new IOException(e); } } catch (TableExistsException e) { LOG.error("SPLICE_INIT already exists, this shouldn't happen. Remove it and retry"); try { admin.disableTable(spliceInit); admin.deleteTable(spliceInit); } catch (IOException ioe) { LOG.warn("Received exception while cleaning up SPLICE_INIT", e); } onHold = true; } catch(Exception ex){ if (!causeIsPleaseHold(ex)) throw ex; onHold = true; try { clock.sleep(1, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new InterruptedIOException(); } } }while(onHold); } }
Source:
private String ehashDataKey(String key) throws UnsupportedOperationException { String hashtag = connPool.getConfiguration().getHashtag(); if (!validHashtag(hashtag)) { throw new UnsupportedOperationException("hashtags not set"); } return new StringBuilder(hashtag) .insert(1, key) .toString(); }

Target:
private String ehashDataKey(String key) { String hashtag = connPool.getConfiguration().getHashtag(); if (!validHashtag(hashtag)) { throw new IllegalStateException("hashtags not set"); } return new StringBuilder(hashtag) .insert(1, key) .toString(); }
Source:
private static MimeType getMimeType(String url) { if (url.contains("_format=json")) { return MimeType.JSON; } return MimeType.XML; }

Target:
private static MimeType getMimeType(String url) { if (containsIgnoreCaseOf(url, JSON_QUERY_PARAM)) { return MimeType.JSON; } return MimeType.XML; }
Source:
private static String appendQueryParameters(Multimap<String, ?> queryParameters, String path) { if (!queryParameters.isEmpty()) { UrlParamBuilder paramBuilder = UrlParamBuilder.params(); for (Map.Entry<String, ?> paramEntry : queryParameters.entries()) { paramBuilder.add(paramEntry.getKey(), paramEntry.getValue().toString()); } path = path + "?" + paramBuilder.format(); } return path.replace("%2F", "/"); }

Target:
private static String appendQueryParameters(Multimap<String, ?> queryParameters, String path) { if (!queryParameters.isEmpty()) { UrlParamBuilder paramBuilder = UrlParamBuilder.params(); for (Map.Entry<String, ?> paramEntry : queryParameters.entries()) { paramBuilder.add(paramEntry.getKey(), paramEntry.getValue().toString()); } path = path + "?" + paramBuilder.format(); } return path; }
Source:
private void deleteFile(final OplogFile olf) { synchronized (this.lock) { if (olf.currSize != 0) { this.dirHolder.decrementTotalOplogSize(olf.currSize); olf.currSize = 0; } if (olf.f == null) return; if (!olf.f.exists()) return; assert olf.RAFClosed; if (!olf.RAFClosed && olf.raf != null) { try { olf.raf.close(); olf.RAFClosed = true; } catch (IOException ignore) { } } getParent().executeDelayedExpensiveWrite(new Runnable() { @Override public void run() { if (!olf.f.delete() && olf.f.exists()) { logger.warn("Could not delete the file for disk store {}.", Oplog.this.toString(), getFileType(olf), getParent().getName()); } else { logger.info("Deleted for disk store {}.", Oplog.this.toString(), getFileType(olf), getParent().getName()); } } }); } }

Target:
private void deleteFile(final OplogFile olf) { synchronized (this.lock) { if (olf.currSize != 0) { this.dirHolder.decrementTotalOplogSize(olf.currSize); olf.currSize = 0; } if (olf.f == null) return; if (!olf.f.exists()) return; assert olf.RAFClosed; if (olf.raf != null) { try { olf.raf.close(); olf.RAFClosed = true; } catch (IOException ignore) { } } getParent().executeDelayedExpensiveWrite(new Runnable() { @Override public void run() { if (!olf.f.delete() && olf.f.exists()) { logger.warn("Could not delete the file for disk store {}.", Oplog.this.toString(), getFileType(olf), getParent().getName()); } else { logger.info("Deleted for disk store {}.", Oplog.this.toString(), getFileType(olf), getParent().getName()); } } }); } }
Source:
@BeforeAll static void testZ3Lib() { try { Context z3Context = new Context(); Expr x = z3Context.mkIntConst("x"); Expr one = z3Context.mkInt(1); BoolExpr eq = z3Context.mkEq(x, one); Solver solver = z3Context.mkSolver(); solver.add(eq); solver.check(); z3Loads = true; } catch (Error e) { z3Loads = false; } }

Target:
@BeforeAll static void testZ3Lib() { try { Context z3Context = new Context(); Expr x = z3Context.mkIntConst("x"); Expr one = z3Context.mkInt(1); BoolExpr eq = z3Context.mkEq(x, one); Solver solver = z3Context.mkSolver(); solver.add(eq); solver.check(); z3Loads = true; } catch (Error e) { assumeTrue(false); z3Loads = false; } }
Source:
public static <T> T retry(Callable<T> callable, int retries, List<String> nonRetryableKeywords) { int retryCount = 0; while (true) { try { return callable.call(); } catch (Exception e) { retryCount++; if (retryCount > retries || containsAnyOf(e, nonRetryableKeywords)) { throw ExceptionUtil.rethrow(e); } long waitIntervalMs = backoffIntervalForRetry(retryCount); LOGGER.warning( String.format("Couldn't find Hazelcast members using Kubernetes API, [%s] retrying in %s seconds...", retryCount, waitIntervalMs / MS_IN_SECOND)); sleep(waitIntervalMs); } } }

Target:
public static <T> T retry(Callable<T> callable, int retries, List<String> nonRetryableKeywords) { int retryCount = 0; while (true) { try { return callable.call(); } catch (Exception e) { retryCount++; if (retryCount > retries || containsAnyOf(e, nonRetryableKeywords)) { throw ExceptionUtil.rethrow(e); } long waitIntervalMs = backoffIntervalForRetry(retryCount); LOGGER.warning( String.format("Couldn't discover Hazelcast members using Kubernetes API, [%s] retrying in %s seconds...", retryCount, waitIntervalMs / MS_IN_SECOND)); sleep(waitIntervalMs); } } }
Source:
private PackList scanPacksImpl(PackList old) throws IOException { DfsBlockCache cache = DfsBlockCache.getInstance(); Map<DfsPackDescription, DfsPackFile> forReuse = reuseMap(old); List<DfsPackDescription> scanned = listPacks(); Collections.sort(scanned); List<DfsPackFile> list = new ArrayList<DfsPackFile>(scanned.size()); boolean foundNew = false; for (DfsPackDescription dsc : scanned) { DfsPackFile oldPack = forReuse.remove(dsc); if (oldPack != null) { list.add(oldPack); } else { list.add(cache.getOrCreate(dsc, null)); foundNew = true; } } for (DfsPackFile p : forReuse.values()) p.close(); if (list.isEmpty()) return new PackListImpl(NO_PACKS.packs); if (!foundNew && list.size() == old.packs.length) { if (old instanceof PackListImpl) { ((PackListImpl) old).dirty = false; } return old; } return new PackListImpl(list.toArray(new DfsPackFile[list.size()])); }

Target:
private PackList scanPacksImpl(PackList old) throws IOException { DfsBlockCache cache = DfsBlockCache.getInstance(); Map<DfsPackDescription, DfsPackFile> forReuse = reuseMap(old); List<DfsPackDescription> scanned = listPacks(); Collections.sort(scanned); List<DfsPackFile> list = new ArrayList<DfsPackFile>(scanned.size()); boolean foundNew = false; for (DfsPackDescription dsc : scanned) { DfsPackFile oldPack = forReuse.remove(dsc); if (oldPack != null) { list.add(oldPack); } else { list.add(cache.getOrCreate(dsc, null)); foundNew = true; } } for (DfsPackFile p : forReuse.values()) p.close(); if (list.isEmpty()) return new PackListImpl(NO_PACKS.packs); if (!foundNew) { old.clearDirty(); return old; } return new PackListImpl(list.toArray(new DfsPackFile[list.size()])); }
Source:
private Class<? extends Collection> convertParameterTypeToCollectionType() { if (List.class.equals(type)) { return ArrayList.class; } else if (SortedSet.class.equals(type)) { return TreeSet.class; } else if (Set.class.equals(type)) { return HashSet.class; } return null; }

Target:
private Class<? extends Collection> convertParameterTypeToCollectionType() { if (List.class.equals(type) || ArrayList.class.equals(type)) { return ArrayList.class; } else if (SortedSet.class.equals(type) || TreeSet.class.equals(type)) { return TreeSet.class; } else if (Set.class.equals(type) || HashSet.class.equals(type)) { return HashSet.class; } return null; }
Source:
public void init() throws IOException { try (MDCCloseable mdc = Logging.withPrefixCloseable(MessageConsumerManager.LOG_PREFIX)) { registerJmxReporter(); awsConfig.clear(); final Dictionary<String, Object> properties = configAdmin.getConfiguration(AmazonSQSSinkConstants.AWS_CONFIG_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); awsConfig.put(key, properties.get(key)); } } LOG.info("AwsRemoteMessageDispatcherFactory: initializing the AWS SQS producer with: {}", awsConfig); final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(null); sqs = AmazonSQSUtils.createSQSObject(awsConfig); } catch (AmazonSQSException e) { LOG.error("Can't create AWS SQS Producer", e); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } } }

Target:
public void init() throws IOException { try (MDCCloseable mdc = Logging.withPrefixCloseable(MessageConsumerManager.LOG_PREFIX)) { registerJmxReporter(); awsConfig.clear(); final Dictionary<String, Object> properties = configAdmin.getConfiguration(AmazonSQSSinkConstants.AWS_CONFIG_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); awsConfig.put(key, properties.get(key)); } } LOG.info("AwsRemoteMessageDispatcherFactory: initializing the AmazonSQS Object with: {}", awsConfig); try { sqs = awsSqsManager.createSQSObject(awsConfig); } catch (AmazonSQSException e) { LOG.error("Can't create an AmazonSQS Object", e); } } }
Source:
public void blockingSourceAsnycCancel() throws Exception { BehaviorProcessor<Integer> bp = BehaviorProcessor.createDefault(1); Flowable<Integer> o = bp .replay(1) .refCount(); o.subscribe(); final AtomicBoolean interrupted = new AtomicBoolean(); o.switchMap(new Function<Integer, Publisher<? extends Object>>() { @Override public Publisher<? extends Object> apply(Integer v) throws Exception { return Flowable.create(new FlowableOnSubscribe<Object>() { @Override public void subscribe(FlowableEmitter<Object> emitter) throws Exception { while (!emitter.isCancelled()) { Thread.sleep(100); } interrupted.set(true); } }, BackpressureStrategy.MISSING); } }) .takeUntil(Flowable.timer(500, TimeUnit.MILLISECONDS)) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(); assertTrue(interrupted.get()); }

Target:
public void blockingSourceAsnycCancel() throws Exception { BehaviorProcessor<Integer> bp = BehaviorProcessor.createDefault(1); Flowable<Integer> f = bp .replay(1) .refCount(); f.subscribe(); final AtomicBoolean interrupted = new AtomicBoolean(); f.switchMap(new Function<Integer, Publisher<? extends Object>>() { @Override public Publisher<? extends Object> apply(Integer v) throws Exception { return Flowable.create(new FlowableOnSubscribe<Object>() { @Override public void subscribe(FlowableEmitter<Object> emitter) throws Exception { while (!emitter.isCancelled()) { Thread.sleep(100); } interrupted.set(true); } }, BackpressureStrategy.MISSING); } }) .takeUntil(Flowable.timer(500, TimeUnit.MILLISECONDS)) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(); assertTrue(interrupted.get()); }
Source:
synchronized private void shutDownDBExecutor() { if (dbExecutor != null) { dbExecutor.shutdownNow(); try { dbExecutor.awaitTermination(30, TimeUnit.SECONDS); } catch (InterruptedException ex) { logger.log(Level.WARNING, "Image Gallery failed to shutdown DB Task Executor in a timely fashion.", ex); } dbExecutor = null; } }

Target:
synchronized private void shutDownDBExecutor() { dbExecutor.shutdownNow(); try { dbExecutor.awaitTermination(30, TimeUnit.SECONDS); } catch (InterruptedException ex) { logger.log(Level.WARNING, "Image Gallery failed to shutdown DB Task Executor in a timely fashion.", ex); } }
Source:
List<RevCommit> getMergeBases(RevCommit one, RevCommit two) throws IncorrectObjectTypeException, IOException { if (one == null) throw new IncorrectObjectTypeException(one, Constants.TYPE_COMMIT); if (two == null) throw new IncorrectObjectTypeException(two, Constants.TYPE_COMMIT); List<RevCommit> mergeBases = new ArrayList<RevCommit>(); walk.reset(); walk.setRevFilter(RevFilter.MERGE_BASE); walk.markStart(one); walk.markStart(two); int commitIdx = 0; for (RevCommit base : walk) { if (commitIdx < MAX_BASES) { mergeBases.add(base); commitIdx++; } else { throw new IOException(MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, "TOO_MANY_BASES", one.name(), two.name(), Integer.valueOf(commitIdx), base.name())); } } return mergeBases; }

Target:
List<RevCommit> getMergeBases(RevCommit one, RevCommit two) throws IncorrectObjectTypeException, IOException { if (one == null) throw new IncorrectObjectTypeException(one, Constants.TYPE_COMMIT); if (two == null) throw new IncorrectObjectTypeException(two, Constants.TYPE_COMMIT); List<RevCommit> mergeBases = new ArrayList<RevCommit>(); walk.reset(); walk.setRevFilter(RevFilter.MERGE_BASE); walk.markStart(one); walk.markStart(two); int commitIdx = 0; for (RevCommit base : walk) { if (commitIdx < MAX_BASES) { mergeBases.add(base); commitIdx++; } else { throw new IOException(MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, Integer.valueOf(MAX_BASES), one.name(), two.name(), Integer.valueOf(commitIdx), base.name())); } } return mergeBases; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { if (optionsMenuDelegate.onOptionsItemSelected(item)) { return true; } FormController formController = getFormController(); switch (item.getItemId()) { case R.id.menu_languages: createLanguageDialog(); return true; case R.id.menu_save: saveForm(DO_NOT_EXIT, InstancesDaoHelper.isInstanceComplete(false), null); return true; case R.id.menu_goto: state = null; if (formController != null && formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } if (formController != null) { formController.getAuditEventLogger().flush(); formController.getAuditEventLogger().logEvent(AuditEvent.AuditEventType.HIERARCHY, true, System.currentTimeMillis()); } Intent i = new Intent(this, FormHierarchyActivity.class); startActivityForResult(i, RequestCodes.HIERARCHY_ACTIVITY); return true; } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (menuDelegate.onOptionsItemSelected(item)) { return true; } FormController formController = getFormController(); switch (item.getItemId()) { case R.id.menu_languages: createLanguageDialog(); return true; case R.id.menu_save: saveForm(DO_NOT_EXIT, InstancesDaoHelper.isInstanceComplete(false), null); return true; case R.id.menu_goto: state = null; if (formController != null && formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } if (formController != null) { formController.getAuditEventLogger().flush(); formController.getAuditEventLogger().logEvent(AuditEvent.AuditEventType.HIERARCHY, true, System.currentTimeMillis()); } Intent i = new Intent(this, FormHierarchyActivity.class); startActivityForResult(i, RequestCodes.HIERARCHY_ACTIVITY); return true; } return super.onOptionsItemSelected(item); }
Source:
public void testElementOfJsonPathNoResult() { JsonFixture cont = new JsonFixture(); cont.load(JSON); Object result = cont.elementOfJsonPath(0,jsonPathNoResults); assertNull(result); }

Target:
public void testElementOfJsonPathNoResult() { fixture.load(JSON); Object result = fixture.elementOfJsonPath(0, "$.store.book[?(@.category==\"test\")].author"); assertNull(result); result = fixture.elementOfJsonPath(3, "$.store.book[?(@.category==\"fiction\")].author"); assertNull(result); }
Source:
public Transfer sell(Money amount, String paymentMethodId, Boolean commit) throws CoinbaseException, IOException { URL sellsUrl; try { sellsUrl = new URL(_baseApiUrl, "sells"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } Request request = newAccountSpecificRequest(); request.setQty(amount.getAmount().doubleValue()); request.setPaymentMethodId(paymentMethodId); request.setCurrency(amount.getCurrencyUnit().getCurrencyCode()); if(commit != null) request.setCommit(commit); return post(sellsUrl, request, TransferResponse.class).getTransfer(); }

Target:
public Transfer sell(Money amount, String paymentMethodId, Boolean commit) throws CoinbaseException, IOException { URL sellsUrl; try { sellsUrl = new URL(_baseApiUrl, "sells"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } Request request = newAccountSpecificRequest(); request.setQty(amount.getAmount().doubleValue()); request.setPaymentMethodId(paymentMethodId); request.setCurrency(amount.getCurrencyUnit().getCurrencyCode()); request.setCommit(commit); return post(sellsUrl, request, TransferResponse.class).getTransfer(); }