auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void addToZip(String path, String srcFile, ZipOutputStream zip) { File folder = new File(srcFile); if (folder.isDirectory()) { addFolderToZip(path, srcFile, zip); } else { byte[] buf = new byte[1024]; int len; try { FileInputStream in = new FileInputStream(srcFile); if (path.trim().equals("")) { zip.putNextEntry(new ZipEntry(folder.getName())); } else { zip.putNextEntry(new ZipEntry(path + "/" + folder.getName())); } while ((len = in.read(buf)) > 0) { zip.write(buf, 0, len); } <START> in.close(); <END> } catch (Exception ex) { getLog().error("Error occurred while creating CAR file. " + ex); } } }</code><technical_language>move closing resources finally block</technical_language>

Target:
private void addToZip(String path, String srcFile, ZipOutputStream zip) throws ArchiveException { File folder = new File(srcFile); if (folder.isDirectory()) { addFolderToZip(path, srcFile, zip); } else { byte[] buf = new byte[1024]; int len; try (FileInputStream in = new FileInputStream(srcFile)) { if (path.trim().equals(Constants.EMPTY_STRING)) { zip.putNextEntry(new ZipEntry(folder.getName())); } else { zip.putNextEntry(new ZipEntry(path + File.separator + folder.getName())); } while ((len = in.read(buf)) > 0) { zip.write(buf, 0, len); } } catch (IOException ex) { throw new ArchiveException(Constants.ARCHIVE_EXCEPTION_MSG, ex); } } }
Source:
<code>private void checkFullMessage(GridDhtPartitionsFullMessage msg) { Map<Integer, Integer> dupPartsData = getFieldValue(msg, "dupPartsData"); assertNotNull(dupPartsData); checkFullMessage(AFF1_CACHE1, AFF1_CACHE2, dupPartsData, msg); checkFullMessage(AFF4_FILTER_CACHE1, AFF4_FILTER_CACHE2, dupPartsData, msg); assertFalse(dupPartsData.containsKey(CU.cacheId(AFF3_CACHE1))); Map<Integer, CachePartitionFullCountersMap> partCntrs = getFieldValue(getFieldValue(msg, "partCntrs2"), "map"); if (partCntrs != null) { for (CachePartitionFullCountersMap cntrs : partCntrs.values()) { long[] initialUpdCntrs = getFieldValue(cntrs, "initialUpdCntrs"); long[] updCntrs = getFieldValue(cntrs, "updCntrs"); int partCnt = getFieldValue(cntrs, "partsCnt"); if(initialUpdCntrs == null && updCntrs == null) { return; } for (int i = 0; i < partCnt; i++) { <START> if(initialUpdCntrs!=null) { <END> assertEquals(0, initialUpdCntrs[i]); } if(updCntrs != null) { assertEquals(0, updCntrs[i]); } } } } }</code><technical_language>if < space > (initialUpdCntrs < space > != < space > null</technical_language>

Target:
private void checkFullMessage(GridDhtPartitionsFullMessage msg) { Map<Integer, Integer> dupPartsData = getFieldValue(msg, "dupPartsData"); assertNotNull(dupPartsData); checkFullMessage(AFF1_CACHE1, AFF1_CACHE2, dupPartsData, msg); checkFullMessage(AFF4_FILTER_CACHE1, AFF4_FILTER_CACHE2, dupPartsData, msg); assertFalse(dupPartsData.containsKey(CU.cacheId(AFF3_CACHE1))); Map<Integer, CachePartitionFullCountersMap> partCntrs = getFieldValue(getFieldValue(msg, "partCntrs2"), "map"); if (partCntrs != null) { for (CachePartitionFullCountersMap cntrs : partCntrs.values()) { long[] initialUpdCntrs = getFieldValue(cntrs, "initialUpdCntrs"); long[] updCntrs = getFieldValue(cntrs, "updCntrs"); int partCnt = getFieldValue(cntrs, "partsCnt"); if (initialUpdCntrs == null && updCntrs == null) return; for (int i = 0; i < partCnt; i++) { if (initialUpdCntrs != null) assertEquals(0, initialUpdCntrs[i]); if (updCntrs != null) assertEquals(0, updCntrs[i]); } } } }
Source:
<code>public static EventCluster merge(EventCluster cluster1, EventCluster cluster2) { if (cluster1.getEventType() != cluster2.getEventType()) { throw new IllegalArgumentException("event clusters are not compatible: they have different types"); } if (!cluster1.getDescription().equals(cluster2.getDescription())) { throw new IllegalArgumentException("event clusters are not compatible: they have different descriptions"); } Interval spanningInterval = IntervalUtils.span(cluster1.span, cluster2.span); Set<Long> idsUnion = Sets.union(cluster2.getEventIDs(), cluster2.getEventIDs()); Set<Long> hashHitsUnion = Sets.union(cluster2.getEventIDsWithHashHits(), cluster2.getEventIDsWithHashHits()); <START> Set<Long> taggedUnion = Sets.union(cluster2.getEventIDsWithTags(), cluster2.getEventIDsWithTags()); <END> return new EventCluster(spanningInterval, cluster1.getEventType(), idsUnion, hashHitsUnion, taggedUnion, cluster1.getDescription(), cluster1.lod); }</code><technical_language>This right. computing union of a set itself. I suspect change of "cluster1" "cluster2" for argument union calls is incorrect</technical_language>

Target:
public static EventCluster merge(EventCluster cluster1, EventCluster cluster2) { if (cluster1.getEventType() != cluster2.getEventType()) { throw new IllegalArgumentException("event clusters are not compatible: they have different types"); } if (!cluster1.getDescription().equals(cluster2.getDescription())) { throw new IllegalArgumentException("event clusters are not compatible: they have different descriptions"); } Interval spanningInterval = IntervalUtils.span(cluster1.span, cluster2.span); Set<Long> idsUnion = Sets.union(cluster1.getEventIDs(), cluster2.getEventIDs()); Set<Long> hashHitsUnion = Sets.union(cluster1.getEventIDsWithHashHits(), cluster2.getEventIDsWithHashHits()); Set<Long> taggedUnion = Sets.union(cluster1.getEventIDsWithTags(), cluster2.getEventIDsWithTags()); return new EventCluster(spanningInterval, cluster1.getEventType(), idsUnion, hashHitsUnion, taggedUnion, cluster1.getDescription(), cluster1.lod); }
Source:
<code>public void instrumentationSmokeTest() throws IOException { getTimestampService(CLIENT_1).getFreshTimestamp(); getLockService(CLIENT_1).currentTimeMillis(); JsonNode metrics = getMetricsOutput(); <START> System.out.println(new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(metrics)); <END> assertContainsTimer(metrics, "com.palantir.atlasdb.timelock.AsyncTimelockService.test.getFreshTimestamp"); assertContainsTimer(metrics, "com.palantir.lock.RemoteLockService.test.currentTimeMillis"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.learn"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.propose"); assertContainsTimer(metrics, "com.palantir.leader.PingableLeader.ping"); assertContainsTimer(metrics, "com.palantir.leader.LeaderElectionService.blockOnBecomingLeader"); assertContainsTimer(metrics, "com.palantir.timestamp.TimestampBoundStore.test.getUpperLimit"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.test.getGreatestLearnedValue"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.test.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.test.propose"); }</code><technical_language>Accidental leftover :)</technical_language>

Target:
public void instrumentationSmokeTest() throws IOException { getTimestampService(CLIENT_1).getFreshTimestamp(); getLockService(CLIENT_1).currentTimeMillis(); JsonNode metrics = getMetricsOutput(); assertContainsTimer(metrics, "com.palantir.atlasdb.timelock.AsyncTimelockService.test.getFreshTimestamp"); assertContainsTimer(metrics, "com.palantir.lock.RemoteLockService.test.currentTimeMillis"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.learn"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.propose"); assertContainsTimer(metrics, "com.palantir.leader.PingableLeader.ping"); assertContainsTimer(metrics, "com.palantir.leader.LeaderElectionService.blockOnBecomingLeader"); assertContainsTimer(metrics, "com.palantir.timestamp.TimestampBoundStore.test.getUpperLimit"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.test.getGreatestLearnedValue"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.test.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.test.propose"); }
Source:
<code>public InputStream stream() throws IOException { <START> return new UncheckedInput(new InputOf(this.bytes.value())).stream(); <END> }</code><technical_language>@fabriciofx also, return body() of decorated object</technical_language>

Target:
public InputStream stream() throws IOException { return this.response.body(); }
Source:
<code>protected AbstractSessionPresenter(final SessionManager sessionManager, final SessionPresenter.View view, final Optional<? extends ToolbarFactory<S>> toolbarFactory, final Optional<PaletteWidgetFactory<DefinitionSetPalette, ?>> paletteFactory, final NotificationsObserver notificationsObserver) { this.sessionManager = sessionManager; <START> this.toolbarFactory = toolbarFactory.orElse(null); <END> this.paletteFactory = paletteFactory.orElse(null); this.notificationsObserver = notificationsObserver; this.view = view; this.hasToolbar = true; this.hasPalette = true; }</code><technical_language>thought preserving of Optional in class's implementation nicer Optional constructor reverting null _inside_ class</technical_language>

Target:
protected AbstractSessionPresenter(final SessionManager sessionManager, final SessionPresenter.View view, final Optional<? extends ToolbarFactory<S>> toolbarFactory, final Optional<PaletteWidgetFactory<DefinitionSetPalette, ?>> paletteFactory, final NotificationsObserver notificationsObserver) { this.sessionManager = sessionManager; this.toolbarFactory = (Optional<ToolbarFactory<S>>) toolbarFactory; this.paletteFactory = paletteFactory; this.notificationsObserver = notificationsObserver; this.view = view; this.hasToolbar = true; this.hasPalette = true; }
Source:
<code>private void initiallySelectTags(Object[] tagNodes, CheckboxTableViewer tagsTable) { List<TagNode> checkedTags = new ArrayList<TagNode>(); for (Object node : tagNodes) { if (node instanceof TagNode) { TagNode tagNode = (TagNode) node; Ref ref = tagNode.getObject(); if (tagRefNamesToSelect.contains(ref.getName())) checkedTags.add(tagNode); } } TagNode[] checkedTagsArray = checkedTags .toArray(new TagNode[checkedTags.size()]); tagsTable.setCheckedElements(checkedTagsArray); tagsTable.setSelection(StructuredSelection.EMPTY); <START> if (checkedTagsArray.length > 0) { <END> tagsTable.reveal(checkedTagsArray[0]); } setSelectedTags(checkedTagsArray); }</code><technical_language>style nit: braces</technical_language>

Target:
private void initiallySelectTags(Object[] tagNodes, CheckboxTableViewer tagsTable) { List<TagNode> checkedTags = new ArrayList<TagNode>(); for (Object node : tagNodes) { if (node instanceof TagNode) { TagNode tagNode = (TagNode) node; Ref ref = tagNode.getObject(); if (tagRefNamesToSelect.contains(ref.getName())) checkedTags.add(tagNode); } } TagNode[] checkedTagsArray = checkedTags .toArray(new TagNode[checkedTags.size()]); tagsTable.setCheckedElements(checkedTagsArray); tagsTable.setSelection(StructuredSelection.EMPTY); if (checkedTagsArray.length > 0) tagsTable.reveal(checkedTagsArray[0]); setSelectedTags(checkedTagsArray); }
Source:
<code>private int lookup( KijiTableReader reader, KijiDataRequest request, EntityId entityId, Map<FamilyLayout, List<String>> mapTypeFamilies, Map<FamilyLayout, List<ColumnLayout>> groupTypeColumns) { getPrintStream().println( "Looking up entity: " + ToolUtils.formatEntityId(entityId) + " from kiji table: " + mURI); try { final KijiRowData row = reader.get(entityId, request); ToolUtils.printRow(row, mapTypeFamilies, groupTypeColumns, getPrintStream()); } catch (IOException ioe) { LOG.error(ioe.getMessage()); return 1; } <START> return 0; <END> }</code><technical_language>SUCCESS FAILURE for return codes</technical_language>

Target:
private int lookup( KijiTableReader reader, KijiDataRequest request, EntityId entityId, Map<FamilyLayout, List<String>> mapTypeFamilies, Map<FamilyLayout, List<ColumnLayout>> groupTypeColumns) { getPrintStream().println( "Looking up entity: " + ToolUtils.formatEntityId(entityId) + " from kiji table: " + mURI); try { final KijiRowData row = reader.get(entityId, request); ToolUtils.printRow(row, mapTypeFamilies, groupTypeColumns, getPrintStream()); } catch (IOException ioe) { LOG.error(ioe.getMessage()); return FAILURE; } return SUCCESS; }
Source:
<code><START> public void rename(String newName) { <END> newNameInput.clear(); newNameInput.sendKeys(newName); submitRename.click(); PageObjectLogging.log("ArticleRenamed", "Article renamed", true); }</code><technical_language>this method return ArticlePageObject object</technical_language>

Target:
public ArticlePageObject rename(String newName) { newNameInput.clear(); newNameInput.sendKeys(newName); submitRename.click(); PageObjectLogging.log("ArticleRenamed", "Article renamed", true); return new ArticlePageObject(driver); }
Source:
<code><START> protected IServerSession lookupScoutServerSessionOnHttpSession(HttpServletRequest req, HttpServletResponse res, Subject subject, UserAgent userAgent) throws ProcessingException, ServletException { <END> synchronized (SERVICES.getService(ICacheStoreService.class)) { IServerSession serverSession = (IServerSession) SERVICES.getService(ICacheStoreService.class).getClientAttributeAndTouch(req, res, IServerSession.class.getName()); if (serverSession == null) { serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent); serverSession.setSessionId(SERVICES.getService(IClientIdentificationService.class).getClientId(req, res)); SERVICES.getService(ICacheStoreService.class).setClientAttribute(req, res, IServerSession.class.getName(), serverSession); } return serverSession; } }</code><technical_language>remove unnecessary exceptions: servletexception</technical_language>

Target:
protected IServerSession lookupScoutServerSessionOnHttpSession(HttpServletRequest req, HttpServletResponse res, Subject subject, UserAgent userAgent) throws ProcessingException, ServletException { synchronized (m_cacheServiceLock) { IServerSession serverSession = (IServerSession) SERVICES.getService(ICacheStoreService.class).getClientAttributeAndTouch(req, res, IServerSession.class.getName()); if (serverSession == null) { serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent); serverSession.setSessionId(SERVICES.getService(IClientIdentificationService.class).getClientId(req, res)); SERVICES.getService(ICacheStoreService.class).setClientAttribute(req, res, IServerSession.class.getName(), serverSession); } return serverSession; } }
Source:
<code>private void adjustDisksImageConfiguration(Collection<DiskImage> diskImages) { for (DiskImage diskImage : diskImages) { if (destStorages.get(diskInfoDestinationMap.get(diskImage.getId()).getStorageIds().get(0)).getStorageStaticData().getStorageType().isBlockDomain() && <START> diskImage.getVolumeFormat().equals(VolumeFormat.RAW)) { <END> diskImage.setvolumeFormat(VolumeFormat.COW); } } }</code><technical_language>raw block disks - if preallocated</technical_language>

Target:
private void adjustDisksImageConfiguration(Collection<DiskImage> diskImages) { for (DiskImage diskImage : diskImages) { if (destStorages.get(diskInfoDestinationMap.get(diskImage.getId()).getStorageIds().get(0)).getStorageStaticData().getStorageType().isBlockDomain() && diskImage.getVolumeType().equals(VolumeType.Sparse) && diskImage.getVolumeFormat().equals(VolumeFormat.RAW)) { diskImage.setvolumeFormat(VolumeFormat.COW); } } }
Source:
<code>private boolean handleUndo() { return getParameters().getManagedBlockStorageDisks() .stream() .allMatch(disk -> { TransactionSupport.executeInNewTransaction(() -> { managedBlockStorageDiskUtil.updateOldImageAsActive(Snapshot.SnapshotType.PREVIEW, true, disk); return null; }); <START> return removeDisk(disk); <END> }); }</code><technical_language>in case of a failure remove a disk, allMatch process other disks</technical_language>

Target:
private boolean handleUndo() { List<Guid> failedToRemoveDisks = new ArrayList<>(); getParameters().getManagedBlockStorageDisks() .stream() .forEach(disk -> { TransactionSupport.executeInNewTransaction(() -> { managedBlockStorageDiskUtil.updateOldImageAsActive(Snapshot.SnapshotType.PREVIEW, true, disk); return null; }); if (!removeDisk(disk)) { failedToRemoveDisks.add(disk.getImageId()); } }); if (!failedToRemoveDisks.isEmpty()) { addCustomValue("DiskGuids", StringUtils.join(failedToRemoveDisks, ", ")); auditLogDirector.log(this, AuditLogType.UNDO_SNAPSHOT_FAILURE_PARTIAL); return false; } return true; }
Source:
<code>private Update updateExistingFirewallForNewTargets(GcpContext context, AuthenticatedContext auth, Group group) throws java.io.IOException { Firewall firewall = context.getCompute().firewalls().get(context.getProjectId(), group.getSecurity().getCloudSecurityId()).execute(); String groupTypeTag = GcpStackUtil.getGroupTypeTag(group.getType()); if (firewall.getTargetTags() == null) { firewall.setTargetTags(List.of(groupTypeTag)); } else if (firewall.getTargetTags().stream().filter(e -> e.equals(groupTypeTag)).collect(Collectors.toSet()).isEmpty()) { firewall.getTargetTags().add(groupTypeTag); <START> } <END> return context.getCompute().firewalls().update(context.getProjectId(), firewall.getName(), firewall); }</code><technical_language>move lambda expression a separated method</technical_language>

Target:
private Update updateExistingFirewallForNewTargets(GcpContext context, AuthenticatedContext auth, Group group) throws java.io.IOException { Firewall firewall = context.getCompute().firewalls().get(context.getProjectId(), group.getSecurity().getCloudSecurityId()).execute(); String groupTypeTag = GcpStackUtil.getGroupTypeTag(group.getType()); if (firewall.getTargetTags() == null) { firewall.setTargetTags(List.of(groupTypeTag)); } else if (firewallTagsDoesNotContainsTargetAlready(firewall, groupTypeTag)) { firewall.getTargetTags().add(groupTypeTag); } return context.getCompute().firewalls().update(context.getProjectId(), firewall.getName(), firewall); }
Source:
<code>public UserProfileParameters() { <START> profile.setId(Guid.newGuid()); <END> }</code><technical_language>update work if id is a new id setting a new id is job of add command</technical_language>

Target:
public UserProfileParameters() { }
Source:
<code>public void listenToDebugMessages( ListenerCommand command ) throws IOException { <START> switch (command) { <END> case START: if ( this.debugConsumerTag != null ) { this.logger.finer( "The DM is already listening to its debug queue." ); return; } if ( this.channel != null && this.channel.isOpen() ) { QueueingConsumer debugConsumer = new QueueingConsumer( this.channel ); debugConsumerTag = this.channel.basicConsume( DEBUG_QUEUE_NAME, false, DEBUG_QUEUE_NAME, false, false, null, debugConsumer ); this.logger.fine( "The DM starts listening to its debug queue" ); new ListeningThread( "Roboconf - Debug queue listener", this.logger, debugConsumer, this.messageQueue, "The DM (debug)" ).start(); } else { this.logger.warning( "Cannot start listening to debug queue: channel closed" ); } break; case STOP: if ( this.debugConsumerTag == null ) { this.logger.finer( "The DM is not listening to its debug queue." ); return; } if ( this.channel != null && this.channel.isOpen() ) { this.channel.basicCancel( this.debugConsumerTag ); this.debugConsumerTag = null; this.logger.fine( "The DM stops listening to its debug queue" ); } else { this.logger.warning( "Cannot stop listening to debug queue: channel closed" ); } break; } }</code><technical_language>3 days of hollidays, I do remember messaging works. Do listening thread application? I a tomorrow</technical_language>

Target:
public void listenToDebugMessages( ListenerCommand command ) throws IOException { switch (command) { case START: if ( this.debugConsumerTag != null ) { this.logger.finer( "The DM is already listening to its debug queue." ); return; } if ( this.channel != null && this.channel.isOpen() ) { this.channel.queueDeclare( DEBUG_QUEUE_NAME, true, false, true, null ); QueueingConsumer debugConsumer = new QueueingConsumer( this.channel ); debugConsumerTag = this.channel.basicConsume( DEBUG_QUEUE_NAME, true, DEBUG_QUEUE_NAME, false, false, null, debugConsumer ); this.logger.fine( "The DM starts listening to its debug queue" ); new ListeningThread( "Roboconf - Debug queue listener", this.logger, debugConsumer, this.messageQueue, "The DM (debug)" ).start(); } else { this.logger.warning( "Cannot start listening to debug queue: channel closed" ); } break; case STOP: if ( this.debugConsumerTag == null ) { this.logger.finer( "The DM is not listening to its debug queue." ); return; } if ( this.channel != null && this.channel.isOpen() ) { this.channel.basicCancel( this.debugConsumerTag ); this.debugConsumerTag = null; this.logger.fine( "The DM stops listening to its debug queue" ); } else { this.logger.warning( "Cannot stop listening to debug queue: channel closed" ); } break; } }
Source:
<code>private ResourceGroupInfo getSummaryInfo() { synchronized (root) { return new ResourceGroupInfo( id, getState(), schedulingPolicy, schedulingWeight, DataSize.succinctBytes(softMemoryLimitBytes), softConcurrencyLimit, hardConcurrencyLimit, maxQueuedQueries, DataSize.succinctBytes(cachedMemoryUsageBytes), getQueuedQueries(), getRunningQueries(), eligibleSubGroups.size(), null, <START> null); } <END> }</code><technical_language>Please remove this change</technical_language>

Target:
private ResourceGroupInfo getSummaryInfo() { synchronized (root) { return new ResourceGroupInfo( id, getState(), schedulingPolicy, schedulingWeight, DataSize.succinctBytes(softMemoryLimitBytes), softConcurrencyLimit, hardConcurrencyLimit, maxQueuedQueries, DataSize.succinctBytes(cachedMemoryUsageBytes), getAllQueuedQueriesCount(), getAllRunningQueriesCount(), eligibleSubGroups.size(), null, null, version); } }
Source:
<code>public void testConstructor() throws Exception { HttpServletRequest req = mock(HttpServletRequest.class); final String path = "/foo/bar/baz/bang"; when(req.getRequestURI()).thenReturn(path); when(req.getMethod()).thenReturn(HttpMethods.POST); FilterChain c = mock(FilterChain.class); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Thread.sleep(100); return null; } }).when(c).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class)); MetricsFilter constructed = new MetricsFilter( "foobar_baz_filter_duration_seconds", "Help for my filter", 0, null ); HttpServletResponse res = mock(HttpServletResponse.class); constructed.doFilter(req, res, c); final Double sum = CollectorRegistry.defaultRegistry.getSampleValue("foobar_baz_filter_duration_seconds_sum", new String[]{"path", "method"}, new String[]{path, HttpMethods.POST}); assertNotNull(sum); <START> assertEquals(0.1, sum, 0.01); <END> }</code><technical_language>remove unrelated change</technical_language>

Target:
public void testConstructor() throws Exception { HttpServletRequest req = mock(HttpServletRequest.class); final String path = "/foo/bar/baz/bang"; when(req.getRequestURI()).thenReturn(path); when(req.getMethod()).thenReturn(HttpMethods.POST); FilterChain c = mock(FilterChain.class); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Thread.sleep(100); return null; } }).when(c).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class)); MetricsFilter constructed = new MetricsFilter( "foobar_baz_filter_duration_seconds", "Help for my filter", 0, null ); HttpServletResponse res = mock(HttpServletResponse.class); constructed.doFilter(req, res, c); final Double sum = CollectorRegistry.defaultRegistry.getSampleValue("foobar_baz_filter_duration_seconds_sum", new String[]{"path", "method"}, new String[]{path, HttpMethods.POST}); assertNotNull(sum); assertEquals(0.1, sum, 0.001); }
Source:
<code>public void notifyAccountExistsForPhone() throws Exception { study.setEmailSignInEnabled(true); AccountId accountId = AccountId.forPhone(TEST_STUDY_IDENTIFIER, TestConstants.PHONE); when(service.getNextToken()).thenReturn(SPTOKEN, TOKEN); when(mockAccount.getPhone()).thenReturn(TestConstants.PHONE); when(mockAccount.getPhoneVerified()).thenReturn(Boolean.TRUE); when(mockAccountDao.getAccount(accountId)).thenReturn(mockAccount); service.notifyAccountExists(study, accountId); verify(mockCacheProvider).setObject(SPTOKEN+":phone:api", BridgeObjectMapper.get().writeValueAsString(TestConstants.PHONE), AccountWorkflowService.EXPIRE_IN_SECONDS); verify(mockNotificationsService).sendSMSMessage(smsMessageProviderCaptor.capture()); String message = smsMessageProviderCaptor.getValue().getSmsRequest().getMessage(); assertTrue(message.contains("Account for ShortName already exists. Reset password: ")); assertTrue(message.contains("/rp?study=api&sptoken="+SPTOKEN)); <START> assertTrue(message.contains(" or ABC-DEF")); END> }</code><technical_language>Notify account exists for phone sends a phone sign-in link. test for here</technical_language>

Target:
public void notifyAccountExistsForPhone() throws Exception { AccountId accountId = AccountId.forPhone(TEST_STUDY_IDENTIFIER, TestConstants.PHONE); when(service.getNextToken()).thenReturn(SPTOKEN, TOKEN); when(mockAccount.getPhone()).thenReturn(TestConstants.PHONE); when(mockAccount.getPhoneVerified()).thenReturn(Boolean.TRUE); when(mockAccountDao.getAccount(accountId)).thenReturn(mockAccount); service.notifyAccountExists(study, accountId); verify(mockCacheProvider).setObject(SPTOKEN+":phone:api", BridgeObjectMapper.get().writeValueAsString(TestConstants.PHONE), AccountWorkflowService.VERIFY_OR_RESET_EXPIRE_IN_SECONDS); verify(mockNotificationsService).sendSMSMessage(smsMessageProviderCaptor.capture()); String message = smsMessageProviderCaptor.getValue().getSmsRequest().getMessage(); assertTrue(message.contains("Account for ShortName already exists. Reset password: ")); assertTrue(message.contains("/rp?study=api&sptoken="+SPTOKEN)); assertTrue(message.contains(" or "+TOKEN.substring(0,3) + "-" + TOKEN.substring(3,6))); }
Source:
<code>public static void showSignInForResult(Activity activity) { <START> if (shouldShowMagicLinksLogin(activity);) { <END> Intent intent = new Intent(activity, MagicLinkSignInActivity.class); activity.startActivityForResult(intent, RequestCodes.ADD_ACCOUNT); } else { Intent intent = new Intent(activity, SignInActivity.class); activity.startActivityForResult(intent, RequestCodes.ADD_ACCOUNT); } }</code><technical_language>extra ; breaks build</technical_language>

Target:
public static void showSignInForResult(Activity activity) { if (shouldShowMagicLinksLogin(activity)) { Intent intent = new Intent(activity, MagicLinkSignInActivity.class); activity.startActivityForResult(intent, RequestCodes.ADD_ACCOUNT); } else { Intent intent = new Intent(activity, SignInActivity.class); activity.startActivityForResult(intent, RequestCodes.ADD_ACCOUNT); } }
Source:
<code>public ClasspathScanDescriptorProvider addAnalyzerClass(Class<? extends Analyzer<?>> clazz) { AnalyzerDescriptor<?> descriptor = _analyzerBeanDescriptors.get(clazz.getName()); if (descriptor == null) { try { descriptor = Descriptors.ofAnalyzer(clazz); _analyzerBeanDescriptors.put(clazz.getName(), descriptor); <START> } catch (Throwable e) { <END> logger.error("Unexpected error occurred while creating descriptor for: " + clazz, e); } } return this; }</code><technical_language>Catching throwable is careful with... Difference Exception is errors recover (OOM, StackOverflow etc). is needed</technical_language>

Target:
public ClasspathScanDescriptorProvider addAnalyzerClass(Class<? extends Analyzer<?>> clazz) { AnalyzerDescriptor<?> descriptor = _analyzerBeanDescriptors.get(clazz.getName()); if (descriptor == null) { try { descriptor = Descriptors.ofAnalyzer(clazz); _analyzerBeanDescriptors.put(clazz.getName(), descriptor); } catch (Exception | NoClassDefFoundError e) { logger.error("Unexpected error occurred while creating descriptor for: " + clazz, e); } } return this; }
Source:
<code>public void process() { PerformanceMonitor.startActivity("rendering/ambientOcclusion"); <START> Texture ssaoNoiseTexture = updateNoiseTexture(); <END> GL13.glActiveTexture(GL13.GL_TEXTURE2); glBindTexture(GL11.GL_TEXTURE_2D, ssaoNoiseTexture.getId()); ssaoMaterial.setInt("texNoise", 2, true); ssaoMaterial.setFloat4("ssaoSettings", ssaoStrength, ssaoRad, 0.0f, 0.0f, true); ssaoMaterial.setMatrix4("invProjMatrix", activeCamera.getInverseProjectionMatrix(), true); ssaoMaterial.setMatrix4("projMatrix", activeCamera.getProjectionMatrix(), true); ssaoMaterial.setFloat2("texelSize", 1.0f / outputFboWidth, 1.0f / outputFboHeight, true); ssaoMaterial.setFloat2("noiseTexelSize", NOISE_TEXEL_SIZE, NOISE_TEXEL_SIZE, true); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }</code><technical_language>is clear code this stay in process(). updateNoseTexture() do is generate a texture if needed, I do sign refreshing of texture created. suggest refactoring this method returns id state change SetInputTexture(), instead of next lines</technical_language>

Target:
public void process() { PerformanceMonitor.startActivity("rendering/ambientOcclusion"); ssaoMaterial.setFloat4("ssaoSettings", ssaoStrength, ssaoRad, 0.0f, 0.0f, true); ssaoMaterial.setMatrix4("invProjMatrix", activeCamera.getInverseProjectionMatrix(), true); ssaoMaterial.setMatrix4("projMatrix", activeCamera.getProjectionMatrix(), true); ssaoMaterial.setFloat2("texelSize", 1.0f / outputFboWidth, 1.0f / outputFboHeight, true); ssaoMaterial.setFloat2("noiseTexelSize", NOISE_TEXEL_SIZE, NOISE_TEXEL_SIZE, true); ssaoMaterial.setFloat3("ssaoSamples", ssaoSamples); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
<code>private BKHttpServiceProvider(BookieServer bookieServer, AutoRecoveryMain autoRecovery, ServerConfiguration serverConf) throws IOException, KeeperException, InterruptedException, BKException { this.bookieServer = bookieServer; this.autoRecovery = autoRecovery; this.serverConf = serverConf; <START> this.layoutManager = new ZkLayoutManager( <END> ZooKeeperClient.newBuilder() .connectString(serverConf.getZkServers()) .sessionTimeoutMs(serverConf.getZkTimeout()) .build(), serverConf.getZkLedgersRootPath(), ZkUtils.getACLs(serverConf)); this.zk = ZooKeeperClient.newBuilder() .connectString(serverConf.getZkServers()) .sessionTimeoutMs(serverConf.getZkTimeout()) .build(); ClientConfiguration clientConfiguration = new ClientConfiguration(serverConf); clientConfiguration.setZkServers(serverConf.getZkServers()); this.bka = new BookKeeperAdmin(clientConfiguration); this.executor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setNameFormat("BKHttpServiceThread").setDaemon(true).build()); }</code><technical_language>get layout manager bookieServer</technical_language>

Target:
private BKHttpServiceProvider(BookieServer bookieServer, AutoRecoveryMain autoRecovery, ServerConfiguration serverConf) throws IOException, KeeperException, InterruptedException, BKException { this.bookieServer = bookieServer; this.autoRecovery = autoRecovery; this.serverConf = serverConf; this.layoutManager = bookieServer.getBookie().getRegistrationManager().getLayoutManager(); this.zk = ZooKeeperClient.newBuilder() .connectString(serverConf.getZkServers()) .sessionTimeoutMs(serverConf.getZkTimeout()) .build(); ClientConfiguration clientConfiguration = new ClientConfiguration(serverConf); clientConfiguration.setZkServers(serverConf.getZkServers()); this.bka = new BookKeeperAdmin(clientConfiguration); this.executor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setNameFormat("BKHttpServiceThread").setDaemon(true).build()); }
Source:
<code>public static Encoding getDatabaseEncoding(String databaseEncoding) { if ("UTF8".equals(databaseEncoding)) { return UTF8_ENCODING; } String[] candidates = encodings.get(databaseEncoding); if (candidates != null) { for (String candidate : candidates) { if (LOGGER.isLoggable(Level.FINEST)) { <START> LOGGER.log(Level.FINEST, "Search encoding candidate {0}", candidate); <END> } if (Charset.isSupported(candidate)) { return new Encoding(candidate); } } } if (Charset.isSupported(databaseEncoding)) { return new Encoding(databaseEncoding); } if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "{0} encoding not found, returning default encoding", databaseEncoding); } return DEFAULT_ENCODING; }</code><technical_language>This is log(Level level, String msg, Object param1), require guards</technical_language>

Target:
public static Encoding getDatabaseEncoding(String databaseEncoding) { if ("UTF8".equals(databaseEncoding)) { return UTF8_ENCODING; } String[] candidates = encodings.get(databaseEncoding); if (candidates != null) { for (String candidate : candidates) { LOGGER.log(Level.FINEST, "Search encoding candidate {0}", candidate); if (Charset.isSupported(candidate)) { return new Encoding(candidate); } } } if (Charset.isSupported(databaseEncoding)) { return new Encoding(databaseEncoding); } LOGGER.log(Level.FINEST, "{0} encoding not found, returning default encoding", databaseEncoding); return DEFAULT_ENCODING; }
Source:
<code>private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation, RemoteOperationResult result) { dismissLoadingDialog(); OCFile syncedFile = operation.getLocalFile(); if (!result.isSuccess()) { if (result.getCode() == ResultCode.SYNC_CONFLICT) { Intent i = new Intent(this, ConflictsResolveActivity.class); i.putExtra(ConflictsResolveActivity.EXTRA_FILE, syncedFile); i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount()); startActivity(i); } } else { if (operation.transferWasRequested()) { <START> <END> } else { Toast msg = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()), Toast.LENGTH_LONG); msg.show(); } } }</code><technical_language>target of this blank block? I negate condition in if apply code in elsedirectly</technical_language>

Target:
private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation, RemoteOperationResult result) { dismissLoadingDialog(); OCFile syncedFile = operation.getLocalFile(); if (!result.isSuccess()) { if (result.getCode() == ResultCode.SYNC_CONFLICT) { Intent i = new Intent(this, ConflictsResolveActivity.class); i.putExtra(ConflictsResolveActivity.EXTRA_FILE, syncedFile); i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount()); startActivity(i); } } else { if (!operation.transferWasRequested()) { Toast msg = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()), Toast.LENGTH_LONG); msg.show(); } } }
Source:
<code><START> public void write(final File idxFile) throws IOException { <END> final LittleEndianOutputStream idxStream = new LittleEndianOutputStream(new BufferedOutputStream(new FileOutputStream(idxFile))); try { write(idxStream); } finally { idxStream.close(); } }</code><technical_language>@magicDGS Sorry, I notice this before, this cleaner a try-with-resources instead of a try/finally, change it</technical_language>

Target:
public void write(final File idxFile) throws IOException { try(final LittleEndianOutputStream idxStream = new LittleEndianOutputStream(new BufferedOutputStream(new FileOutputStream(idxFile)))) { write(idxStream); } }
Source:
<code>private Map<String, Object> serializeJetpackProtectAndSsoParams() { Map<String, Object> params = new HashMap<>(); if (mJpSettings.monitorActive != mRemoteJpSettings.monitorActive) { params.put("monitor", mJpSettings.monitorActive); } if (mJpSettings.jetpackProtectEnabled != mRemoteJpSettings.jetpackProtectEnabled) { params.put("protect", mJpSettings.jetpackProtectEnabled); } if (!mJpSettings.whitelistMatches(mRemoteJpSettings.jetpackProtectWhitelist)) { <START> String whitelistArray = mJpSettings.jetpackProtectWhitelist.toString().replace("[", "").replace("]", ""); <END> params.put("jetpack_protect_global_whitelist", whitelistArray); } if (mJpSettings.ssoActive != mRemoteJpSettings.ssoActive) { params.put("sso", mJpSettings.ssoActive); } if (mJpSettings.ssoMatchEmail != mRemoteJpSettings.ssoMatchEmail) { params.put("jetpack_sso_match_by_email", mJpSettings.ssoMatchEmail); } if (mJpSettings.ssoRequireTwoFactor != mRemoteJpSettings.ssoRequireTwoFactor) { params.put("jetpack_sso_require_two_step", mJpSettings.ssoRequireTwoFactor); } return params; }</code><technical_language>Is a reason this: TextUtils.join(", ", mJpSettings.jetpackProtectWhitelist);</technical_language>

Target:
private Map<String, Object> serializeJetpackProtectAndSsoParams() { Map<String, Object> params = new HashMap<>(); if (mJpSettings.monitorActive != mRemoteJpSettings.monitorActive) { params.put("monitor", mJpSettings.monitorActive); } if (mJpSettings.jetpackProtectEnabled != mRemoteJpSettings.jetpackProtectEnabled) { params.put("protect", mJpSettings.jetpackProtectEnabled); } if (!mJpSettings.whitelistMatches(mRemoteJpSettings.jetpackProtectWhitelist)) { String whitelistArray = TextUtils.join(",", mJpSettings.jetpackProtectWhitelist); params.put("jetpack_protect_global_whitelist", whitelistArray); } if (mJpSettings.ssoActive != mRemoteJpSettings.ssoActive) { params.put("sso", mJpSettings.ssoActive); } if (mJpSettings.ssoMatchEmail != mRemoteJpSettings.ssoMatchEmail) { params.put("jetpack_sso_match_by_email", mJpSettings.ssoMatchEmail); } if (mJpSettings.ssoRequireTwoFactor != mRemoteJpSettings.ssoRequireTwoFactor) { params.put("jetpack_sso_require_two_step", mJpSettings.ssoRequireTwoFactor); } return params; }
Source:
<code>void fillChunks() { try { PutChunk chunkToFill; if (!isChunkFillComplete()) { do { if (channelReadBuffer == null) { channelReadBuffer = chunkFillerChannel.getNextChunk(0); } if (channelReadBuffer != null) { maybeStopTrackingWaitForChannelDataTime(); chunkToFill = getChunkToFill(); if (chunkToFill == null) { maybeStartTrackingWaitForChunkTime(); break; } else { maybeStopTrackingWaitForChunkTime(); bytesFilledSoFar += chunkToFill.fillFrom(channelReadBuffer); if (chunkToFill.isReady()) { routerCallback.onPollReady(); updateChunkFillerWaitTimeMetrics(); } if (!channelReadBuffer.hasRemaining()) { chunkFillerChannel.resolveOldestChunk(null); channelReadBuffer = null; } } } else { if (getFreeChunk() != null) { maybeStartTrackingWaitForChannelDataTime(); } break; } <START> } while (!isChunkFillComplete()); <END> } if (isChunkFillComplete()) { PutChunk lastChunk = getBuildingChunk(); if (lastChunk != null) { lastChunk.onFillComplete(true); } } } catch (Exception e) { RouterException routerException = e instanceof RouterException ? (RouterException) e : new RouterException("PutOperation fillChunks encountered unexpected error", e, RouterErrorCode.UnexpectedInternalError); routerMetrics.chunkFillerUnexpectedErrorCount.inc(); routerCallback.onPollReady(); setOperationExceptionAndComplete(routerException); } }</code><technical_language>if dropped converted a while</technical_language>

Target:
void fillChunks() { try { PutChunk chunkToFill; while (!isChunkFillingDone()) { if (channelReadBuffer == null) { channelReadBuffer = chunkFillerChannel.getNextChunk(0); } if (channelReadBuffer != null) { maybeStopTrackingWaitForChannelDataTime(); chunkToFill = getChunkToFill(); if (chunkToFill == null) { maybeStartTrackingWaitForChunkTime(); break; } else { maybeStopTrackingWaitForChunkTime(); bytesFilledSoFar += chunkToFill.fillFrom(channelReadBuffer); if (chunkToFill.isReady()) { routerCallback.onPollReady(); updateChunkFillerWaitTimeMetrics(); } if (!channelReadBuffer.hasRemaining()) { chunkFillerChannel.resolveOldestChunk(null); channelReadBuffer = null; } } } else { if (getFreeChunk() != null) { maybeStartTrackingWaitForChannelDataTime(); } break; } } if (chunkFillingCompletedSuccessfully) { PutChunk lastChunk = getBuildingChunk(); if (lastChunk != null) { lastChunk.onFillComplete(true); } } } catch (Exception e) { RouterException routerException = e instanceof RouterException ? (RouterException) e : new RouterException("PutOperation fillChunks encountered unexpected error", e, RouterErrorCode.UnexpectedInternalError); routerMetrics.chunkFillerUnexpectedErrorCount.inc(); routerCallback.onPollReady(); setOperationExceptionAndComplete(routerException); } }
Source:
<code>public void updatePhysics(GlowBlock block) { BlockPhysicsEvent event = EventFactory.getInstance() .callEvent(new BlockPhysicsEvent(block, block.getTypeId())); if (event.isCancelled()) { return; } <START> } <END></code><technical_language>This subclasses' updatePhysics cancelable. do that, create another empty method, call end of updatePhysics, subclasses override method instead of overriding updatePhysics</technical_language>

Target:
public final void updatePhysics(GlowBlock block) { BlockPhysicsEvent event = EventFactory.getInstance() .callEvent(new BlockPhysicsEvent(block, block.getTypeId())); if (!event.isCancelled()) { updatePhysicsAfterEvent(block); } }
Source:
<code>public String getDeviceId() { <START> Log.d(LOG_TAG, "getDeviceId(): return 0"); <END> return "0"; }</code><technical_language>This return device identity ESN MEID. this identify device for purposes</technical_language>

Target:
public String getDeviceId() { return getMeid(); }
Source:
<code><START> protected boolean itemInListExistsLowerCase(List<String> lines, String item) { <END> for (String line : lines) { String lowLine = line.toLowerCase(); if (lowLine.contains(item)) { return true; } } return false; }</code><technical_language>package private visibility? Protected visibility recommend subclassing of DeploymentsOperations. intention? Why</technical_language>

Target:
public boolean itemInListExistsLowerCase(List<String> lines, String item) { for (String line : lines) { String lowLine = line.toLowerCase(); if (lowLine.contains(item)) { return true; } } return false; }
Source:
<code><START> public static LibraryDilution to(DilutionDto from) { <END> LibraryDilution to = new LibraryDilution(); to.setName(from.getName()); to.setIdentificationBarcode(from.getIdentificationBarcode()); to.setConcentration(from.getConcentration()); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); try { to.setCreationDate(df.parse(from.getCreationDate())); } catch (ParseException e) { } return to; }</code><technical_language>reason include id, dilutionUserName, library (ID)</technical_language>

Target:
public static LibraryDilution to(DilutionDto from) { LibraryDilution to = new LibraryDilution(); to.setId(from.getId()); to.setName(from.getName()); to.setIdentificationBarcode(from.getIdentificationBarcode()); to.setConcentration(from.getConcentration()); to.setLibrary(to(from.getLibrary())); if (!isStringEmptyOrNull(from.getDilutionUserName())) { to.setDilutionCreator(from.getDilutionUserName()); } DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); try { to.setCreationDate(df.parse(from.getCreationDate())); } catch (ParseException e) { } return to; }
Source:
<code>private Object[] parseCsv(String value) { assert StringUtils.isNotEmpty(value); String[] values = value.split(keyDelimiter); Object[] arr = new Object[fields.size()]; assert values.length == arr.length; try { for (int i = 0; i < arr.length; i++) { arr[i] = values[i] == null ? "" : values[i]; } } catch (Exception e) { <START> throw new RuntimeException(e); <END> } return arr; }</code><technical_language>is purpose catch it? remove try-catch</technical_language>

Target:
private Object[] parseCsv(String value) { assert StringUtils.isNotEmpty(value); String[] values = value.split(keyDelimiter); Object[] arr = new Object[fields.size()]; assert values.length == arr.length; for (int i = 0; i < arr.length; i++) { arr[i] = values[i] == null ? "" : values[i]; } return arr; }
Source:
<code>public Block apply(Block block) { if (elementCoercer == null) { return block; } BlockBuilder blockBuilder = toType.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount()); ColumnarArray arrayBlock = ColumnarArray.toColumnarArray(block); Block elementsBlock = elementCoercer.apply(arrayBlock.getElementsBlock()); for (int i = 0; i < arrayBlock.getPositionCount(); i++) { if (arrayBlock.isNull(i)) { blockBuilder.appendNull(); continue; } <START> int offset = arrayBlock.getOffset(i); <END> int elementSize = arrayBlock.getLength(i); BlockBuilder singleArrayBuilder = blockBuilder.beginBlockEntry(); for (int j = 0; j < elementSize; j++) { if (elementsBlock.isNull(offset + j)) { singleArrayBuilder.appendNull(); } else { elementsBlock.writePositionTo(offset + j, singleArrayBuilder); singleArrayBuilder.closeEntry(); } } blockBuilder.closeEntry(); } return blockBuilder.build(); }</code><technical_language>In 3, do BlockBuilder. Instead, new new ArrayBlock, mapType.createBlockFromKeyValue, new RowBlock. This is done in XxxStreamReader in presto-orc. This is easier implement well. Performance is critical HivePageSource ORC, Parquet, DWRF this path. In a typical Presto set up, more 80% of time is spent in TableScanOperator ScanFilterProjectOperator</technical_language>

Target:
public Block apply(Block block) { if (elementCoercer == null) { return block; } ColumnarArray arrayBlock = toColumnarArray(block); Block elementsBlock = elementCoercer.apply(arrayBlock.getElementsBlock()); boolean[] valueIsNull = new boolean[arrayBlock.getPositionCount()]; int[] offsets = new int[arrayBlock.getPositionCount() + 1]; for (int i = 0; i < arrayBlock.getPositionCount(); i++) { valueIsNull[i] = arrayBlock.isNull(i); offsets[i + 1] = offsets[i] + arrayBlock.getLength(i); } return new ArrayBlock(arrayBlock.getPositionCount(), valueIsNull, offsets, elementsBlock); }
Source:
<code>private File getTestBundleRoot() { URL url = getClass().getResource(BUNDLE_ROOT); URI uri = null; try { uri = url.toURI(); } catch (URISyntaxException e) { <START> e.printStackTrace(); return null; <END> } return new File(uri); }</code><technical_language>throw new RuntimeException(e);</technical_language>

Target:
private File getTestBundleRoot() throws Exception { return new File(getClass().getResource(BUNDLE_ROOT).toURI()); }
Source:
<code>public InputStream getContents() throws CoreException { if (exists) { try { File file = path.toFile(); timestamp = file.lastModified(); if (Files.isSymbolicLink(file.toPath())) { <START> String symLink = FileUtils.readSymLink(file); <END> return new ByteArrayInputStream(symLink.getBytes()); } return new FileInputStream(file); } catch (IOException e) { Activator.error(e.getMessage(), e); } } return null; }</code><technical_language>Do care UnsupportedOperationException here, isSymbolicLink() == true, operation is supported? question below</technical_language>

Target:
public InputStream getContents() throws CoreException { if (exists) { try { File file = path.toFile(); timestamp = file.lastModified(); if (Files.isSymbolicLink(file.toPath())) { String symLink = FileUtils.readSymLink(file); return new ByteArrayInputStream(Constants.encode(symLink)); } return new FileInputStream(file); } catch (IOException | UnsupportedOperationException e) { Activator.error(e.getMessage(), e); } } return null; }