auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void runCoalescedRequest(long startIndex) throws InterruptedException { fTrace = setupTrace(TmfTestTrace.A_TEST_10K.getFullPath()); TmfSignalManager.register(this); TmfTestTriggerSignal signal = new TmfTestTriggerSignal(this, startIndex, false); TmfSignalManager.dispatchSignal(signal); request1.waitForCompletion(); request2.waitForCompletion(); request3.waitForCompletion(); try { assertEquals("Request1: nbEvents", NB_EVENTS, requestedEvents1.size()); assertTrue("Request1: isCompleted", request1.isCompleted()); assertFalse("Request1: isCancelled", request1.isCancelled()); assertEquals("Request2: nbEvents", NB_EVENTS, requestedEvents2.size()); assertTrue("Request2: isCompleted", request2.isCompleted()); assertFalse("Request2: isCancelled", request2.isCancelled()); assertEquals("Request3: nbEvents", NB_EVENTS, requestedEvents3.size()); assertTrue("Request3: isCompleted", request3.isCompleted()); assertFalse("Request3: isCancelled", request3.isCancelled()); for (int i = 0; i < NB_EVENTS; i++) { assertEquals("Distinct events", i + 1 + request1.getIndex(), requestedEvents1.get(i).getTimestamp().getValue()); assertEquals("Distinct events", i + 1 + request2.getIndex(), requestedEvents2.get(i).getTimestamp().getValue()); assertEquals("Distinct events", i + 1 + request3.getIndex(), requestedEvents3.get(i).getTimestamp().getValue()); } } finally { TmfSignalManager.deregister(this); fTrace.dispose(); fTrace = null; } }

Target:
public void runCoalescedRequest(long startIndex) throws InterruptedException { fTrace = setupTrace(TEST_TRACE.getFullPath()); TmfSignalManager.register(this); TmfTestTriggerSignal signal = new TmfTestTriggerSignal(this, startIndex, false); TmfSignalManager.dispatchSignal(signal); request1.waitForCompletion(); request2.waitForCompletion(); request3.waitForCompletion(); try { assertEquals("Request1: nbEvents", NB_EVENTS, requestedEvents1.size()); assertTrue("Request1: isCompleted", request1.isCompleted()); assertFalse("Request1: isCancelled", request1.isCancelled()); assertEquals("Request2: nbEvents", NB_EVENTS, requestedEvents2.size()); assertTrue("Request2: isCompleted", request2.isCompleted()); assertFalse("Request2: isCancelled", request2.isCancelled()); assertEquals("Request3: nbEvents", NB_EVENTS, requestedEvents3.size()); assertTrue("Request3: isCompleted", request3.isCompleted()); assertFalse("Request3: isCancelled", request3.isCancelled()); for (int i = 0; i < NB_EVENTS; i++) { assertEquals("Distinct events", i + 1 + request1.getIndex(), requestedEvents1.get(i).getTimestamp().getValue()); assertEquals("Distinct events", i + 1 + request2.getIndex(), requestedEvents2.get(i).getTimestamp().getValue()); assertEquals("Distinct events", i + 1 + request3.getIndex(), requestedEvents3.get(i).getTimestamp().getValue()); } } finally { TmfSignalManager.deregister(this); fTrace.dispose(); fTrace = null; } }
Source:
public void testCancelIntp() { if (getSparkVersionNumber() > 11) { assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret("a = 1\n", context).code()); new Thread(new infinityPythonJob()).start(); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } pySparkInterpreter.cancel(context); } }

Target:
public void testCancelIntp() throws InterruptedException { if (getSparkVersionNumber() > 11) { assertEquals(InterpreterResult.Code.SUCCESS, pySparkInterpreter.interpret("a = 1\n", context).code()); Thread t = new Thread(new infinityPythonJob()); t.start(); Thread.sleep(5000); pySparkInterpreter.cancel(context); assertTrue(t.isAlive()); t.join(2000); assertFalse(t.isAlive()); } }
Source:
private void setResultIdsAndFinish() { Intent intent = new Intent(); if (mGridAdapter.getSelectedItemCount() > 0) { ArrayList<Long> remoteMediaIds = new ArrayList<>(); for (Integer localId : mGridAdapter.getSelectedItems()) { remoteMediaIds.add(mMediaStore.getMediaWithLocalId(localId).getMediaId()); } intent.putExtra(RESULT_IDS, ListUtils.toLongArray(remoteMediaIds)); } setResult(RESULT_OK, intent); finish(); }

Target:
private void setResultIdsAndFinish() { Intent intent = new Intent(); if (mGridAdapter.getSelectedItemCount() > 0) { ArrayList<Long> remoteMediaIds = new ArrayList<>(); for (Integer localId : mGridAdapter.getSelectedItems()) { MediaModel media = mMediaStore.getMediaWithLocalId(localId); if (media != null) { remoteMediaIds.add(media.getMediaId()); } } intent.putExtra(RESULT_IDS, ListUtils.toLongArray(remoteMediaIds)); } setResult(RESULT_OK, intent); finish(); }
Source:
private int readPacket(byte[] packet, int offset, int psize) throws IOException { int bytesRead=0; if (psize == 0) { return 0; } if (buff.capacity()< psize){ int packetSize = psize + 32; ByteBuffer newBuff = ByteBuffer.allocate(packetSize); newBuff.put((ByteBuffer) buff.flip()); buff = newBuff; } buff.position(offset); while (bytesRead < packet.length && buff.remaining() > 0){ int len = rbChannel.read(buff.get(packet)); bytesRead += len; } return bytesRead; }

Target:
public int readPacket(byte[] packet, int offset, int psize) throws IOException { int length = 0; int len=0; int packetSize = psize + offset + headerSize; if (buff.capacity()< psize){ ByteBuffer newBuff = ByteBuffer.allocate(packetSize); newBuff.put((ByteBuffer) buff.flip()); buff = newBuff; } try { buff.position(offset); len = rbChannel.read(ByteBuffer.wrap(packet,offset,psize)); if (len == -1){ return length; } length += len; return length; } catch (Exception e) { logger.error(e); } return length; }
Source:
private synchronized void updateAvailableNetworks(List<QualifiedNetworks> networksList) { log("updateAvailableNetworks: " + networksList); for (QualifiedNetworks networks : networksList) { if (areNetworksValid(networks)) { mCurrentAvailableNetworks.put(networks.apnType, networks.qualifiedNetworks); if (isHandoverNeeded(networks)) { int targetTransport = ACCESS_NETWORK_TRANSPORT_TYPE_MAP.get( networks.qualifiedNetworks[0]); mHandoverNeededEventRegistrants.notifyResult(new HandoverEntry(networks.apnType, targetTransport)); } else { int transport = TransportType.WWAN; if (!ArrayUtils.isEmpty(networks.qualifiedNetworks) && ACCESS_NETWORK_TRANSPORT_TYPE_MAP.containsKey( networks.qualifiedNetworks[0])) { transport = ACCESS_NETWORK_TRANSPORT_TYPE_MAP .get(networks.qualifiedNetworks[0]); } setCurrentTransport(networks.apnType, transport); } } } }

Target:
private synchronized void updateAvailableNetworks(List<QualifiedNetworks> networksList) { log("updateAvailableNetworks: " + networksList); for (QualifiedNetworks networks : networksList) { if (areNetworksValid(networks)) { mCurrentAvailableNetworks.put(networks.apnType, networks.qualifiedNetworks); if (isHandoverNeeded(networks)) { int targetTransport = ACCESS_NETWORK_TRANSPORT_TYPE_MAP.get( networks.qualifiedNetworks[0]); mHandoverNeededEventRegistrants.notifyResult( new HandoverParams(networks.apnType, targetTransport)); } else { log("Handover not needed for APN type: " + ApnSetting.getApnTypeString(networks.apnType)); int transport = TransportType.WWAN; if (!ArrayUtils.isEmpty(networks.qualifiedNetworks) && ACCESS_NETWORK_TRANSPORT_TYPE_MAP.containsKey( networks.qualifiedNetworks[0])) { transport = ACCESS_NETWORK_TRANSPORT_TYPE_MAP .get(networks.qualifiedNetworks[0]); } setCurrentTransport(networks.apnType, transport); } } } }
Source:
public String toString() { return "ExcludeRange{" + "m_begin='" + m_begin + '\'' + ", m_end='" + m_end + '\'' + ", m_location='" + m_location + '\'' + '}'; }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("begin", m_begin) .add("end", m_end) .add("location", m_location) .toString(); }
Source:
public Money toMoney() { return Money.of(this.currency, this.getAmount()); }

Target:
public Money toMoney() { return Money.of(this.getCurrency(), this.getAmount()); }
Source:
private void toggleViewSize(View v){ TextView title = (TextView)v.findViewById(R.id.title); TextView album = (TextView)v.findViewById(R.id.album); TextView artist = (TextView)v.findViewById(R.id.artist); if(v.getHeight()>getResources().getDimension(R.dimen.song_height)){ title.setMaxLines(1); album.setMaxLines(1); artist.setMaxLines(1); v.findViewById(R.id.user_color).setMinimumHeight((int) getResources().getDimension(R.dimen.song_height)); } else{ title.setMaxLines(10); album.setMaxLines(10); artist.setMaxLines(10); int viewHeight = (int) getResources().getDimension(R.dimen.song_height) + (title.getLineCount()-1)*title.getLineHeight() + (artist.getLineCount()-1)*artist.getLineHeight() + (album.getLineCount()-1)*album.getLineHeight(); v.findViewById(R.id.user_color).setMinimumHeight(viewHeight); } }

Target:
private void toggleViewSize(View v){ TextView title = (TextView)v.findViewById(R.id.title); TextView album = (TextView)v.findViewById(R.id.album); TextView artist = (TextView)v.findViewById(R.id.artist); if(v.getHeight()>getResources().getDimension(R.dimen.song_height)){ title.setMaxLines(SHORT_VIEW); album.setMaxLines(SHORT_VIEW); artist.setMaxLines(SHORT_VIEW); v.findViewById(R.id.user_color).setMinimumHeight((int) getResources().getDimension(R.dimen.song_height)); } else{ title.setMaxLines(EXPANDED_VIEW); album.setMaxLines(EXPANDED_VIEW); artist.setMaxLines(EXPANDED_VIEW); int titleHeight = (title.getLineCount()-1)*title.getLineHeight(); int artistHeight = (artist.getLineCount()-1)*artist.getLineHeight(); int albumHeight = (album.getLineCount()-1)*album.getLineHeight(); int viewHeight = (int) getResources().getDimension(R.dimen.song_height) + titleHeight + artistHeight + albumHeight; v.findViewById(R.id.user_color).setMinimumHeight(viewHeight); } }
Source:
public CompletableFuture<Void> unrankMapVersion(MapBean map) { evictCache(); return fafService.unrankeMapVersion(map); }

Target:
public CompletableFuture<Void> unrankMapVersion(MapBean map) { applicationContext.getBean(this.getClass()).evictCache(); return fafService.unrankeMapVersion(map); }
Source:
public GlusterVolumeTaskReturnForXmlRpc glusterVolumeRebalanceStop(String volumeName) { try { Map<String, Object> xmlRpcReturnValue = vdsServer.glusterVolumeRebalanceStatus(volumeName); GlusterVolumeTaskReturnForXmlRpc wrapper = new GlusterVolumeTaskReturnForXmlRpc(xmlRpcReturnValue); return wrapper; } catch (UndeclaredThrowableException ute) { throw new XmlRpcRunTimeException(ute); } }

Target:
public GlusterVolumeTaskReturnForXmlRpc glusterVolumeRebalanceStop(String volumeName) { try { Map<String, Object> xmlRpcReturnValue = vdsServer.glusterVolumeRebalanceStop(volumeName); GlusterVolumeTaskReturnForXmlRpc wrapper = new GlusterVolumeTaskReturnForXmlRpc(xmlRpcReturnValue); return wrapper; } catch (UndeclaredThrowableException ute) { throw new XmlRpcRunTimeException(ute); } }
Source:
public List<ContainerInfo> find(RuntimeIdentity id) throws InternalInfrastructureException { try { List<ContainerInfo> result = new ArrayList<>(); for (ContainerListEntry runningEntry : docker.listContainers(ListContainersParams.create().withAll(false))) { if (id.equals(Labels.newDeserializer(runningEntry.getLabels()).runtimeId())) { result.add(docker.inspectContainer(runningEntry.getId())); } } return result; } catch (IOException x) { throw new InternalInfrastructureException(x.getMessage(), x); } }

Target:
public List<ContainerListEntry> find(RuntimeIdentity id) throws InternalInfrastructureException { return listNonStoppedContainers(Labels.newSerializer() .runtimeId(id) .labels() .entrySet() .stream() .map(entry -> entry.getKey() + '=' + entry.getValue()) .toArray(String[]::new)); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mRegistrationProgressBar = (ProgressBar) findViewById(R.id.registrationProgressBar); mRegistrationBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mRegistrationProgressBar.setVisibility(ProgressBar.GONE); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); boolean sentToken = sharedPreferences .getBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, false); if (sentToken) { mInformationTextView.setText(getString(R.string.gcm_send_message)); } else { mInformationTextView.setText(getString(R.string.token_error_message)); } } }; mInformationTextView = (TextView) findViewById(R.id.informationTextView); LocalBroadcastManager.getInstance(this).registerReceiver(mRegistrationBroadcastReceiver, new IntentFilter(QuickstartPreferences.REGISTRATION_COMPLETE)); isReceiverRegistered =true; if (checkPlayServices()) { Intent intent = new Intent(this, RegistrationIntentService.class); startService(intent); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mRegistrationProgressBar = (ProgressBar) findViewById(R.id.registrationProgressBar); mRegistrationBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mRegistrationProgressBar.setVisibility(ProgressBar.GONE); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); boolean sentToken = sharedPreferences .getBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, false); if (sentToken) { mInformationTextView.setText(getString(R.string.gcm_send_message)); } else { mInformationTextView.setText(getString(R.string.token_error_message)); } } }; mInformationTextView = (TextView) findViewById(R.id.informationTextView); registerReceiver(); if (checkPlayServices()) { Intent intent = new Intent(this, RegistrationIntentService.class); startService(intent); } }
Source:
public String getContactName(String number) { ContactInfo contact = contactStore.getContact(number); if(contact == null) { return number; } else { return contact.name; } }

Target:
public String getContactName(String number) { ContactInfo contact = contactStore.getContact(number); if (contact == null) { return ""; } else { return contact.name; } }
Source:
private Object getJSONValue(String val) throws DatabaseEngineException { try { PGobject dataObject = new PGobject(); dataObject.setType("jsonb"); dataObject.setValue(val); return dataObject; } catch (SQLException ex) { throw new DatabaseEngineException("Error while mapping variables to database", ex); } }

Target:
private Object getJSONValue(String val) throws DatabaseEngineException { try { PGobject dataObject = new PGobject(); dataObject.setType("jsonb"); dataObject.setValue(val); return dataObject; } catch (SQLException ex) { throw new DatabaseEngineException("Error while mapping variables to database, value = " + val, ex); } }
Source:
private boolean isAttrCopy(StatementTree statement) { return statement.is(Kind.EXPRESSION_STATEMENT) && ((ExpressionStatementTree) statement).expression().is(Kind.ASSIGNMENT) && ((AssignmentExpressionTree) ((ExpressionStatementTree) statement).expression()).variable() instanceof MemberExpressionTree; }

Target:
private static boolean isAttrCopy(StatementTree statement) { if (statement.is(Kind.EXPRESSION_STATEMENT)) { Tree expression = ((ExpressionStatementTree) statement).expression(); if (expression.is(Kind.ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) expression; return assignment.variable().is(Kind.BRACKET_MEMBER_EXPRESSION); } } return false; }
Source:
public void walkTree(final IResourceVisitor visitor) throws IOException { if (!exists()) { throw new FileNotFoundException(file.getAbsolutePath()); } if (!file.isDirectory()) { return; } java.nio.file.Files.walkFileTree(file.toPath(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { visitor.visitResource( getResource(dir.toFile(), attrs), NIOFileResource.this.file.toPath().relativize(dir).toString() ); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { visitor.visitResource( getResource(file.toFile(), attrs), NIOFileResource.this.file.toPath().relativize(file).toString() ); return FileVisitResult.CONTINUE; } }); }

Target:
public void walkTree(final IResourceVisitor visitor) throws IOException { if (!exists()) { throw new FileNotFoundException(file.getAbsolutePath()); } if (!file.isDirectory()) { return; } java.nio.file.Files.walkFileTree(file.toPath(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { String name = NIOFileResource.this.file.toPath().relativize(dir).toString(); boolean cont = true; if (name.length() > 0) { cont = visitor.visitResource( getResource(dir.toFile(), attrs), NIOFileResource.this.file.toPath().relativize(dir).toString().replace("\\", "/") ); } return cont ? FileVisitResult.CONTINUE : FileVisitResult.SKIP_SUBTREE; } @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { visitor.visitResource( getResource(file.toFile(), attrs), NIOFileResource.this.file.toPath().relativize(file).toString().replace("\\", "/") ); return FileVisitResult.CONTINUE; } }); }
Source:
public int hashCode() { return a.hashCode() + 31 * b.hashCode(); }

Target:
public int hashCode() { int result = a != null ? a.hashCode() : 0; result = 31 * result + (b != null ? b.hashCode() : 0); return result; }
Source:
public final Document asXml() { final Document document = DocumentHelper.createDocument(); final FindBugsExcludes.ExcludesXml xml = new FindBugsExcludes.ExcludesXml( document.addElement("FindBugsFilter") ); this.env.excludes("findbugs").stream().forEach(xml::addExclude); return document; }

Target:
public final Document asXml() { try { final Document doc = DocumentBuilderFactory.newInstance() .newDocumentBuilder() .newDocument(); final FindBugsExcludes.Xml xml = new FindBugsExcludes.Xml(doc); final Node root = doc.appendChild( doc.createElement("FindBugsFilter") ); this.env.excludes("findbugs").stream() .map(Pattern.compile(":")::split) .map(xml::createMatchNode) .filter(Node::hasChildNodes) .forEach(root::appendChild); return doc; } catch (final ParserConfigurationException exc) { throw new IllegalStateException(exc); } }
Source:
private File getSaveFileName() { return new File(TasksUiPlugin.getDefault().getDataDirectory(), SAVE_DIR); }

Target:
private File getSaveFileName() { return new File(dataDirectory, SAVE_DIR); }
Source:
public List<CommitValidationMessage> onCommitReceived( CommitReceivedEvent receiveEvent) throws CommitValidationException { try { PersonIdent committer = receiveEvent.commit.getCommitterIdent(); ServiceUserInfo serviceUser = serviceUserResolver.getAsServiceUser(committer); if (serviceUser.owner != null && serviceUserResolver.listActiveOwners(serviceUser).isEmpty()) { throw new CommitValidationException(String.format( "Commit %s of service user %s (%s) is rejected because " + "the accounts of all service user owners are inactive.", receiveEvent.commit.getId().getName(), committer.getName(), committer.getEmailAddress())); } else { AccountState creator = accountCache.get(serviceUser.createdBy._id); if (creator == null || !creator.getAccount().isActive()) { throw new CommitValidationException(String.format( "Commit %s of service user %s (%s) is rejected because " + "the account of the service creator is inactive.", receiveEvent.commit.getId().getName(), committer.getName(), committer.getEmailAddress())); } } } catch (OrmException e) { throw new CommitValidationException( "Internal error while checking for service user commits.", e); } return Collections.emptyList(); }

Target:
public List<CommitValidationMessage> onCommitReceived( CommitReceivedEvent receiveEvent) throws CommitValidationException { try { PersonIdent committer = receiveEvent.commit.getCommitterIdent(); ServiceUserInfo serviceUser = serviceUserResolver.getAsServiceUser(committer); if (serviceUser.owner != null && serviceUserResolver.listActiveOwners(serviceUser).isEmpty()) { throw new CommitValidationException(String.format( "Commit %s of service user %s (%s) is rejected because " + "all service user owner accounts are inactive.", receiveEvent.commit.getId().getName(), committer.getName(), committer.getEmailAddress())); } else { AccountState creator = accountCache.get(serviceUser.createdBy._id); if (creator == null || !creator.getAccount().isActive()) { throw new CommitValidationException(String.format( "Commit %s of service user %s (%s) is rejected because " + "the account of the service creator is inactive.", receiveEvent.commit.getId().getName(), committer.getName(), committer.getEmailAddress())); } } } catch (OrmException e) { throw new CommitValidationException( "Internal error while checking for service user commits.", e); } return Collections.emptyList(); }
Source:
private static String sanitizeWord(String word) { String result = word; String[] splitWord = word.split("-"); if (splitWord.length > 1) { for (int i = splitWord.length - 1; i >= 0; i--) { if (!splitWord[i].trim().equals("") && !splitWord[i].trim().equals(null)) { return splitWord[i]; } } } return result; }

Target:
private static String sanitizeWord(String word) { String result = word; String[] splitWord = word.split("-"); if (splitWord.length > 1) { for (int i = splitWord.length - 1; i >= 0; i--) { if (splitWord[i] != null && !"".equals(splitWord[i].trim())) { return splitWord[i]; } } } return result; }
Source:
PhoneNumberAsyncClient(PhoneNumberAdminClientImpl phoneNumberAdminClient) { this.phoneNumberAdminClient = phoneNumberAdminClient; }

Target:
PhoneNumberAsyncClient(PhoneNumberAdminClientImpl phoneNumberAdminClient) { this.phoneNumberAdministrations = phoneNumberAdminClient.getPhoneNumberAdministrations(); }
Source:
public void testCurveSrs26713() throws IOException { try (InputStream is = open("/curve-eps26713.xml")) { WfsFeatureCollection wfc = (WfsFeatureCollection) getxStream().fromXML(is); assertThat(wfc.getFeatureMembers(), hasSize(1)); assertThat( wfc.getFeatureMembers().get(0).getLocation(), is( "LINESTRING (598566.26906782 4914058.52150682, 598557.69477679 4914085.33977038, 598494.67747205 4914254.76475676, 598513.91541973 4914348.11723536, 598593.95441378 4914440.37147034, 598656.43584271 4914500.87603708, 598659.42742456 4914521.61846645, 598652.10605456 4914532.58195028, 598648.43115534 4914544.16261933, 598635.63083991 4914558.16462797, 598554.58586588 4914636.67913744, 598498.3814486 4914752.4469346, 598489.81000042 4914778.04541272, 598421.49284933 4914873.66244196, 598409.19817361 4914931.57794141, 598404.90249957 4914948.64642947, 598340.17638384 4915068.66645978, 598342.49317686 4915118.07263127, 598346.0824185 4915117.02463364, 598566.26906782 4914058.52150682)")); } }

Target:
public void testCurveSrs26713() throws IOException { try (InputStream is = open("/curve-eps26713.xml")) { Metacard metacard = (Metacard) getxStream().fromXML(is); assertThat( metacard.getLocation(), is( "MULTILINESTRING ((598566.26906782 4914058.52150682, 598557.69477679 4914085.33977038, 598494.67747205 4914254.76475676, 598513.91541973 4914348.11723536, 598593.95441378 4914440.37147034, 598656.43584271 4914500.87603708, 598659.42742456 4914521.61846645, 598652.10605456 4914532.58195028, 598648.43115534 4914544.16261933, 598635.63083991 4914558.16462797, 598554.58586588 4914636.67913744, 598498.3814486 4914752.4469346, 598489.81000042 4914778.04541272, 598421.49284933 4914873.66244196, 598409.19817361 4914931.57794141, 598404.90249957 4914948.64642947, 598340.17638384 4915068.66645978, 598342.49317686 4915118.07263127, 598346.0824185 4915117.02463364, 598566.26906782 4914058.52150682))")); } }
Source:
public void should_be_able_to_read_asset() throws FileNotFoundException { Map<String, Object> options = OptionsBuilder.options().safe(SafeMode.SAFE) .attributes(AttributesBuilder.attributes().dataUri(false)) .compact(true).asMap(); Document document = asciidoctor.load(DOCUMENT, options); File inputFile = classpath.getResource("rendersample.asciidoc"); String content = document.readAsset(inputFile.getAbsolutePath(), new HashMap<Object, Object>()); assertThat(content, is(IOUtils.readFull(new FileReader(inputFile)).replaceAll("\r","\\"))); }

Target:
public void should_be_able_to_read_asset() throws FileNotFoundException { Map<String, Object> options = OptionsBuilder.options().safe(SafeMode.SAFE) .attributes(AttributesBuilder.attributes().dataUri(false)) .compact(true).asMap(); Document document = asciidoctor.load(DOCUMENT, options); File inputFile = classpath.getResource("rendersample.asciidoc"); String content = document.readAsset(inputFile.getAbsolutePath(), new HashMap<Object, Object>()); assertThat(content, is(IOUtils.readFull(new FileReader(inputFile)))); }
Source:
public void getHighestUid_imapConnectionThrowsIOException_shouldThrowMessagingException() throws Exception { ImapFolder folder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); List<ImapResponse> imapResponses = singletonList(createImapResponse("* SEARCH 42")); when(imapConnection.executeSimpleCommand("UID SEARCH *:*")) .thenThrow(IOException.class); folder.open(OPEN_MODE_RW); try { folder.getHighestUid(); } catch (MessagingException e) { assertEquals("IO Error", e.getMessage()); } }

Target:
public void getHighestUid_imapConnectionThrowsIOException_shouldThrowMessagingException() throws Exception { ImapFolder folder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); when(imapConnection.executeSimpleCommand("UID SEARCH *:*")) .thenThrow(IOException.class); folder.open(OPEN_MODE_RW); try { folder.getHighestUid(); fail("Expected MessagingException"); } catch (MessagingException e) { assertEquals("IO Error", e.getMessage()); } }
Source:
public Map<String, SearchSourceBuilder> build() { for (final EventQuery event_query : query.eventQueries()) { SearchSourceBuilder search_source_builder = new SearchSourceBuilder(); if (query.isSummary()) { System.out.println("HERE123"); search_source_builder.aggregation(bucketsAgg(event_query.filter(), query.interval())); search_source_builder.size(0); } else { search_source_builder.from(query.from()); search_source_builder.size(query.to() - query.from()); } if (event_query.filter() != null) { search_source_builder.query(setFilter(event_query.filter())); } search_source_builders.put(event_query.namespace().toLowerCase(), search_source_builder); } return search_source_builders; }

Target:
public Map<String, SearchSourceBuilder> build() { for (final EventQuery event_query : query.eventQueries()) { SearchSourceBuilder search_source_builder = new SearchSourceBuilder(); if (query.isSummary()) { search_source_builder.aggregation(bucketsAgg(event_query.filter(), query.interval())); search_source_builder.size(0); } else { search_source_builder.from(query.from()); search_source_builder.size(query.to() - query.from()); } QueryBuilder builder = timeFilter(query.startTimestamp(), query .endTimestamp()); if (event_query.namespace()!=null) { ((BoolQueryBuilder) builder).must((setFilter(EventLiteralOrFilter.newBuilder ().setField("namespace.lowercase").setFilter(event_query.namespace ().toLowerCase()).build() ))); } if (event_query.filter() != null) { search_source_builder.query(((BoolQueryBuilder) builder).must(setFilter (event_query.filter()))); } search_source_builders.put(event_query.namespace().toLowerCase(), search_source_builder); } return search_source_builders; }
Source:
public void createRulesTest() { RulesDefinition.Repository repository = buildRepository(); assertThat(repository).isNotNull(); assertThat(repository.language()).isEqualTo("py"); assertThat(repository.name()).isEqualTo("SonarAnalyzer"); List<RulesDefinition.Rule> rules = repository.rules(); assertThat(rules).isNotNull(); assertThat(rules).hasSize(66); RulesDefinition.Rule s1578 = repository.rule("S1578"); assertThat(s1578).isNotNull(); assertThat(s1578.activatedByDefault()).isFalse(); RulesDefinition.Rule backstickUsage = repository.rule("BackticksUsage"); assertThat(backstickUsage).isNotNull(); assertThat(backstickUsage.activatedByDefault()).isTrue(); }

Target:
public void createRulesTest() { RulesDefinition.Repository repository = buildRepository(); assertThat(repository).isNotNull(); assertThat(repository.language()).isEqualTo("py"); assertThat(repository.name()).isEqualTo("SonarAnalyzer"); List<RulesDefinition.Rule> rules = repository.rules(); assertThat(rules).isNotNull(); assertThat(rules).hasSize(67); RulesDefinition.Rule s1578 = repository.rule("S1578"); assertThat(s1578).isNotNull(); assertThat(s1578.activatedByDefault()).isFalse(); RulesDefinition.Rule backstickUsage = repository.rule("BackticksUsage"); assertThat(backstickUsage).isNotNull(); assertThat(backstickUsage.activatedByDefault()).isTrue(); }
Source:
protected TmfTimestamp getInitialRangeOffset() { final long DEFAULT_INITIAL_OFFSET_VALUE = (1L * 100 * 1000 * 1000); final int DEFAULT_INITIAL_OFFSET_SCALE = -9; return new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, DEFAULT_INITIAL_OFFSET_SCALE); }

Target:
protected TmfTimestamp getInitialRangeOffset() { final long DEFAULT_INITIAL_OFFSET_VALUE = (1L * 100 * 1000 * 1000); return new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE); }
Source:
private void showLint(LintContext context, JsArray<LintItem> lint) { JsArray<LintItem> finalLint; if (context.excludeCurrentStatement && docDisplay_.getCursorPosition().isEqualTo(context.cursorPosition)) { finalLint = JsArray.createArray().cast(); Position pos = context.cursorPosition; for (int i = 0; i < lint.length(); i++) if (!lint.get(i).asRange().contains(pos)) finalLint.push(lint.get(i)); } else finalLint = lint; if (uiPrefs_.realTimeSpellChecking().getValue() && TypoSpellChecker.isLoaded()) { JsArray<LintItem> spellingLint = target_.getSpellingTarget().getLint(); for (int i = 0; i < spellingLint.length(); i++) { finalLint.push(spellingLint.get(i)); } } docDisplay_.showLint(finalLint); }

Target:
private void showLint(LintContext context, JsArray<LintItem> lint) { if (docDisplay_.isPopupVisible()) return; JsArray<LintItem> finalLint; if (context.excludeCurrentStatement && docDisplay_.getCursorPosition().isEqualTo(context.cursorPosition)) { finalLint = JsArray.createArray().cast(); Position pos = context.cursorPosition; for (int i = 0; i < lint.length(); i++) if (!lint.get(i).asRange().contains(pos)) finalLint.push(lint.get(i)); } else finalLint = lint; if (uiPrefs_.realTimeSpellChecking().getValue() && TypoSpellChecker.isLoaded()) { JsArray<LintItem> spellingLint = target_.getSpellingTarget().getLint(); for (int i = 0; i < spellingLint.length(); i++) { finalLint.push(spellingLint.get(i)); } } docDisplay_.showLint(finalLint); }
Source:
public void setUp() throws Exception { createProject(); baseActivityTestRule.launchActivity(null); }

Target:
public void setUp() throws Exception { createProject(); baseActivityTestRule.launchActivity(); }
Source:
public String getPublicKey() { InstanceIdentityProvider<RSAPublicKey, RSAPrivateKey> provider = InstanceIdentityProvider.get(RSAPrivateKey.class); RSAPublicKey key = provider == null ? null : provider.getPublicKey(); if (key == null) { return null; } byte[] encoded = Base64.encodeBase64(key.getEncoded()); int index = 0; StringBuilder buf = new StringBuilder(encoded.length + 20); while (index < encoded.length) { int len = Math.min(64, encoded.length - index); if (index > 0) { buf.append("\n"); } buf.append(new String(encoded, index, len, Charsets.UTF_8)); index += len; } return String.format("-----BEGIN PUBLIC KEY-----%n%s%n-----END PUBLIC KEY-----%n", buf.toString()); }

Target:
public String getPublicKey() { RSAPublicKey key = InstanceIdentityProvider.RSA.getPublicKey(); if (key == null) { return null; } byte[] encoded = Base64.encodeBase64(key.getEncoded()); int index = 0; StringBuilder buf = new StringBuilder(encoded.length + 20); while (index < encoded.length) { int len = Math.min(64, encoded.length - index); if (index > 0) { buf.append("\n"); } buf.append(new String(encoded, index, len, Charsets.UTF_8)); index += len; } return String.format("-----BEGIN PUBLIC KEY-----%n%s%n-----END PUBLIC KEY-----%n", buf.toString()); }
Source:
private WebDriver createWebDriver() { System.out.print("Initializing Selenium: "); String browser = TestProperties.BROWSER; if (TestProperties.BROWSER_FIREFOX.equals(browser)) { System.out.println("Using Firefox."); String firefoxPath = TestProperties.FIREFOX_PATH; if (!firefoxPath.isEmpty()) { System.out.println("Custom path: " + firefoxPath); System.setProperty("webdriver.firefox.bin", firefoxPath); } FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.panel.shown", false); profile.setPreference("browser.helperApps.neverAsk.openFile", "text/csv,application/vnd.ms-excel"); profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv,application/vnd.ms-excel"); profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.download.dir", System.getProperty("java.io.tmpdir")); profile.setPreference("intl.accept_languages", "en-us, en"); return new FirefoxDriver(profile); } else if (TestProperties.BROWSER_CHROME.equals(browser)) { System.out.println("Using Chrome with driver path: " + TestProperties.CHROMEDRIVER_PATH); System.setProperty("webdriver.chrome.driver", TestProperties.CHROMEDRIVER_PATH); ChromeOptions options = new ChromeOptions(); options.addArguments("--allow-file-access-from-files"); options.addArguments("--lang=en-us"); return new ChromeDriver(options); } System.out.println("Using " + browser + " is not supported!"); return null; }

Target:
private WebDriver createWebDriver() { System.out.print("Initializing Selenium: "); String browser = TestProperties.BROWSER; if (TestProperties.BROWSER_FIREFOX.equals(browser)) { System.out.println("Using Firefox."); String firefoxPath = TestProperties.FIREFOX_PATH; if (!firefoxPath.isEmpty()) { System.out.println("Custom path: " + firefoxPath); System.setProperty("webdriver.firefox.bin", firefoxPath); } FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.panel.shown", false); profile.setPreference("browser.helperApps.neverAsk.openFile", "text/csv,application/vnd.ms-excel"); profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv,application/vnd.ms-excel"); profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.download.dir", System.getProperty("java.io.tmpdir")); return new FirefoxDriver(profile); } else if (TestProperties.BROWSER_CHROME.equals(browser)) { System.out.println("Using Chrome with driver path: " + TestProperties.CHROMEDRIVER_PATH); System.setProperty("webdriver.chrome.driver", TestProperties.CHROMEDRIVER_PATH); ChromeOptions options = new ChromeOptions(); options.addArguments("--allow-file-access-from-files"); return new ChromeDriver(options); } System.out.println("Using " + browser + " is not supported!"); return null; }
Source:
protected void updateObserver() { List<Vector3> ungenerated = new ArrayList<>(); final int viewDistance = network.getSyncDistance(); World w = getWorld(); Transform t = physics.getTransform(); Point p = t.getPosition(); int cx = p.getChunkX(); int cy = p.getChunkY(); int cz = p.getChunkZ(); HashSet<SpoutChunk> observing = new HashSet<>((viewDistance * viewDistance * viewDistance * 3) / 2); Iterator<IntVector3> itr = observer.getLive(); if (itr == OBSERVING) { itr = new OutwardIterator(cx, cy, cz, viewDistance); } observeChunksFailed = false; while (itr.hasNext()) { IntVector3 v = itr.next(); Chunk chunk = w.getChunk(v.getX(), v.getY(), v.getZ(), LoadOption.LOAD_ONLY); if (chunk != null) { chunk.refreshObserver(this); observing.add((SpoutChunk) chunk); } else { ungenerated.add(new Vector3(v)); observeChunksFailed = true; } } observingChunks.removeAll(observing); for (SpoutChunk chunk : observingChunks) { if (chunk.isLoaded()) { chunk.removeObserver(this); } } observingChunks.clear(); observingChunks.addAll(observing); if (!ungenerated.isEmpty()) { w.queueChunksForGeneration(ungenerated); } }

Target:
protected void updateObserver() { List<Vector3> ungenerated = new ArrayList<>(); final int syncDistance = network.getSyncDistance(); World w = getWorld(); Transform t = physics.getTransform(); Point p = t.getPosition(); int cx = p.getChunkX(); int cy = p.getChunkY(); int cz = p.getChunkZ(); HashSet<SpoutChunk> observing = new HashSet<>((syncDistance * syncDistance * syncDistance * 3) / 2); Iterator<IntVector3> itr = observer.getLive(); if (itr == OBSERVING) { itr = new OutwardIterator(cx, cy, cz, syncDistance); } observeChunksFailed = false; while (itr.hasNext()) { IntVector3 v = itr.next(); Chunk chunk = w.getChunk(v.getX(), v.getY(), v.getZ(), LoadOption.LOAD_ONLY); if (chunk != null) { chunk.refreshObserver(this); observing.add((SpoutChunk) chunk); } else { ungenerated.add(new Vector3(v)); observeChunksFailed = true; } } observingChunks.removeAll(observing); for (SpoutChunk chunk : observingChunks) { if (chunk.isLoaded()) { chunk.removeObserver(this); } } observingChunks.clear(); observingChunks.addAll(observing); if (!ungenerated.isEmpty()) { w.queueChunksForGeneration(ungenerated); } }
Source:
public static String computeXoauth(String username, String authToken) throws UnsupportedEncodingException { return new String( Base64.encodeBase64(String.format(XOAUTH_FORMAT, username, authToken).getBytes()), US_ASCII); }

Target:
public static String computeXoauth(String username, String authToken) throws UnsupportedEncodingException { String formattedAuthenticationString = String.format(XOAUTH_FORMAT, username, authToken); byte[] base64encodedAuthenticationString = Base64.encodeBase64(formattedAuthenticationString.getBytes()); return new String(base64encodedAuthenticationString, US_ASCII); }
Source:
SecurityDomain(Builder builder, final LinkedHashMap<String, RealmInfo> realmMap) { this.realmMap = realmMap; this.defaultRealmName = builder.defaultRealmName; this.preRealmRewriter = builder.preRealmRewriter; this.realmMapper = builder.realmMapper; this.roleMapper = builder.roleMapper; this.permissionMapper = builder.permissionMapper; this.postRealmRewriter = builder.postRealmRewriter; this.principalDecoder = builder.principalDecoder; this.securityIdentityTransformer = builder.securityIdentityTransformer; this.trustedSecurityDomain = builder.trustedSecurityDomain; this.scheduledExecutorService = builder.scheduledExecutorService; final Map<String, RoleMapper> originalRoleMappers = builder.categoryRoleMappers; final Map<String, RoleMapper> copiedRoleMappers; if (originalRoleMappers.isEmpty()) { copiedRoleMappers = emptyMap(); } else if (originalRoleMappers.size() == 1) { final Map.Entry<String, RoleMapper> entry = originalRoleMappers.entrySet().iterator().next(); copiedRoleMappers = Collections.singletonMap(entry.getKey(), entry.getValue()); } else { copiedRoleMappers = new LinkedHashMap<>(originalRoleMappers); } this.categoryRoleMappers = copiedRoleMappers; final RealmInfo realmInfo = new RealmInfo(); anonymousIdentity = Assert.assertNotNull(securityIdentityTransformer.apply(new SecurityIdentity(this, AnonymousPrincipal.getInstance(), realmInfo, AuthorizationIdentity.EMPTY, copiedRoleMappers, SecurityIdentity.NO_PEER_IDENTITIES, IdentityCredentials.NONE, IdentityCredentials.NONE))); currentSecurityIdentity = ThreadLocal.withInitial(() -> anonymousIdentity); }

Target:
SecurityDomain(Builder builder, final LinkedHashMap<String, RealmInfo> realmMap) { this.realmMap = realmMap; this.defaultRealmName = builder.defaultRealmName; this.preRealmRewriter = builder.preRealmRewriter; this.realmMapper = builder.realmMapper; this.roleMapper = builder.roleMapper; this.permissionMapper = builder.permissionMapper; this.postRealmRewriter = builder.postRealmRewriter; this.principalDecoder = builder.principalDecoder; this.securityIdentityTransformer = builder.securityIdentityTransformer; this.trustedSecurityDomain = builder.trustedSecurityDomain; final Map<String, RoleMapper> originalRoleMappers = builder.categoryRoleMappers; final Map<String, RoleMapper> copiedRoleMappers; if (originalRoleMappers.isEmpty()) { copiedRoleMappers = emptyMap(); } else if (originalRoleMappers.size() == 1) { final Map.Entry<String, RoleMapper> entry = originalRoleMappers.entrySet().iterator().next(); copiedRoleMappers = Collections.singletonMap(entry.getKey(), entry.getValue()); } else { copiedRoleMappers = new LinkedHashMap<>(originalRoleMappers); } this.categoryRoleMappers = copiedRoleMappers; final RealmInfo realmInfo = new RealmInfo(); anonymousIdentity = Assert.assertNotNull(securityIdentityTransformer.apply(new SecurityIdentity(this, AnonymousPrincipal.getInstance(), realmInfo, AuthorizationIdentity.EMPTY, copiedRoleMappers, SecurityIdentity.NO_PEER_IDENTITIES, IdentityCredentials.NONE, IdentityCredentials.NONE))); currentSecurityIdentity = ThreadLocal.withInitial(() -> anonymousIdentity); }
Source:
public List<String> getHosts() { ImmutableList.Builder<String> builder = ImmutableList.builder(); if (hostsText == null) { return builder.build(); } return builder.addAll(Splitter.on(',') .trimResults() .omitEmptyStrings() .split(hostsText)) .build(); }

Target:
public List<String> getHosts() { return hosts; }
Source:
public void closeForm() { try { if (askDialog.isOpened()) { askDialog.confirmAndWaitClosed(); } if (preferences.isPreferencesFormOpened()) { preferences.clickOnCloseButton(); } preferences.waitPreferencesFormIsClosed(); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } }

Target:
public void closeForm() { if (preferences.isPreferencesFormOpened()) { preferences.clickOnCloseButton(); } if (askDialog.isOpened()) { askDialog.confirmAndWaitClosed(); } preferences.waitPreferencesFormIsClosed(); }
Source:
public static long zip(File directory, File outputZipFile, boolean fsync) throws IOException { if (!isZip(outputZipFile.getName())) { log.warn("No .zip suffix[%s], putting files from [%s] into it anyway.", outputZipFile, directory); } if (fsync) { return FileUtils.writeAtomically(outputZipFile, out -> zip(directory, out)); } else { try (final FileOutputStream out = new FileOutputStream(outputZipFile)) { return zip(directory, out); } } }

Target:
public static long zip(File directory, File outputZipFile, boolean fsync) throws IOException { if (!isZip(outputZipFile.getName())) { log.warn("No .zip suffix[%s], putting files from [%s] into it anyway.", outputZipFile, directory); } if (fsync) { return FileUtils.writeAtomically(outputZipFile, out -> zip(directory, out)); } else { try ( final FileChannel fileChannel = FileChannel.open( outputZipFile.toPath(), StandardOpenOption.WRITE, StandardOpenOption.CREATE ); final OutputStream out = Channels.newOutputStream(fileChannel) ) { return zip(directory, out); } } }
Source:
public List<Attribute> getAttributes(PerunSession sess, UserExtSource ues) throws InternalErrorException { try { return jdbc.query("select " + getAttributeMappingSelectQuery("ues") + " from attr_names " + "left join user_ext_source_attr_values ues on user_id=? and ext_source_id=? " + "where namespace=? or (namespace in (?,?) and (ues.attr_value is not null or ues.attr_value_text is not null))", new AttributeRowMapper(sess, this, ues), ues.getUserId(), ues.getExtSource().getId(), AttributesManager.NS_UES_ATTR_CORE, AttributesManager.NS_UES_ATTR_DEF, AttributesManager.NS_UES_ATTR_OPT); } catch(EmptyResultDataAccessException ex) { log.debug("No attribute for UserExtSource exists."); return new ArrayList<Attribute>(); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public List<Attribute> getAttributes(PerunSession sess, UserExtSource ues) throws InternalErrorException { try { return jdbc.query("select " + getAttributeMappingSelectQuery("ues") + " from attr_names " + "left join user_ext_source_attr_values ues on id=ues.attr_id and user_ext_source_id=? " + "where namespace=? or (namespace in (?,?) and (ues.attr_value is not null or ues.attr_value_text is not null))", new AttributeRowMapper(sess, this, ues), ues.getId(), AttributesManager.NS_UES_ATTR_CORE, AttributesManager.NS_UES_ATTR_DEF, AttributesManager.NS_UES_ATTR_OPT); } catch(EmptyResultDataAccessException ex) { log.debug("No attribute for UserExtSource exists."); return new ArrayList<Attribute>(); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
public boolean hasCertChangedSince(Consumer consumer, Date date) { if (date == null) { return true; } Environment env = consumer.getEnvironment(); Owner owner = consumer.getOwner(); OwnerEnvContentAccess oeca = ownerEnvContentAccessCurator.getContentAccess( owner.getId(), env == null ? null : env.getId()); if (oeca == null || consumer.getContentAccessCert() == null || oeca.getUpdated().getTime() > date.getTime()) { return true; } return false; }

Target:
public boolean hasCertChangedSince(Consumer consumer, Date date) { if (date == null) { return true; } Environment env = consumer.getEnvironment(); Owner owner = consumer.getOwner(); OwnerEnvContentAccess oeca = ownerEnvContentAccessCurator.getContentAccess( owner.getId(), env == null ? null : env.getId()); return oeca == null || consumer.getContentAccessCert() == null || oeca.getUpdated().getTime() > date.getTime(); }
Source:
public void deleteTicket(Guid ticketUUID) { BasicHttpRequest request = new BasicHttpRequest( "DELETE", TICKETS_URI + ticketUUID, HttpVersion.HTTP_1_1); DefaultBHttpClientConnection conn = getConnection(); HttpEntity response = executeRequest(request, conn); finalize(response, conn); }

Target:
public void deleteTicket(Guid ticketUUID) { BasicHttpRequest request = new BasicHttpRequest( "DELETE", TICKETS_URI + ticketUUID, HttpVersion.HTTP_1_1); try (DefaultBHttpClientConnection conn = getConnection()) { consumeResponse(executeRequest(request, conn)); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
Source:
public boolean hasPermission(Permission permission) { Optional<Session> session = getSession(); if (!session.isPresent()) { return false; } if (permission.equals(Permission.ANY_PERMISSION)) { return true; } if (authorizer == null) { LOGGER.warn("Authorizer is not configured and is null. This will result in all permission checks to " + "return false if a permission is specified."); return false; } return authorizer.hasPermission(session.get().getUser(), permission); }

Target:
public boolean hasPermission(Permission permission) { Optional<Session> session = getSession(); if (!session.isPresent()) { return false; } if (permission.equals(Permission.ANY_PERMISSION)) { return true; } if (authorizer == null) { return false; } return authorizer.hasPermission(session.get().getUser(), permission); }
Source:
String createUserAgent() { return String.format("contentful.java/%s", Util.getProperty("version.name")); }

Target:
String createUserAgent() { final Properties properties = System.getProperties(); return String.format("contentful.java/%s(%s %s) %s/%s", Util.getProperty("version.name"), properties.getProperty("java.runtime.name"), properties.getProperty("java.runtime.version"), properties.getProperty("os.name"), properties.getProperty("os.version") ); }
Source:
public void beginRecognizeContentFromUrl() { String formUrl = "{form_url}"; formRecognizerAsyncClient.beginRecognizeContentFromUrl(formUrl).subscribe( recognizePollingOperation -> recognizePollingOperation.getFinalResult().subscribe(contentPageResult -> { contentPageResult.forEach(recognizedForm -> { System.out.printf("Page Angle: %s%n", recognizedForm.getTextAngle()); System.out.printf("Page Dimension unit: %s%n", recognizedForm.getUnit()); System.out.println("Recognized Tables: "); recognizedForm.getTables().forEach(formTable -> formTable.getCells().forEach(recognizedTableCell -> System.out.printf("%s ", recognizedTableCell.getText()))); }); })); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeContentFromUrl#string }

Target:
public void beginRecognizeContentFromUrl() { String formUrl = "{form_url}"; formRecognizerAsyncClient.beginRecognizeContentFromUrl(formUrl).subscribe( recognizePollingOperation -> recognizePollingOperation.getFinalResult().subscribe(contentPageResult -> { contentPageResult.forEach(recognizedForm -> { System.out.printf("Text angle: %s%n", recognizedForm.getTextAngle()); System.out.printf("Page Dimension unit: %s%n", recognizedForm.getUnit()); System.out.println("Recognized Tables: "); recognizedForm.getTables().forEach(formTable -> formTable.getCells().forEach(recognizedTableCell -> System.out.printf("%s ", recognizedTableCell.getText()))); }); })); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeContentFromUrl#string }