auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public MemoryEstimate visitJoin(JoinNode node, EstimationContext context) { verify(context.sourcesCosts.size() == 2, "Unexpected number of sources for %s: %s", node, context.sourcesCosts.size()); double localMaxMemory = context.localMaxMemory; double probeMaxMemoryWhenOutputting = context.sourcesCosts.get(0).getMaxMemoryWhenOutputting(); double buildMaxMemoryWhenOutputting = context.sourcesCosts.get(1).getMaxMemoryWhenOutputting(); return new MemoryEstimate( localMaxMemory + buildMaxMemoryWhenOutputting, localMaxMemory + probeMaxMemoryWhenOutputting); }

Target:
public MemoryEstimate visitJoin(JoinNode node, EstimationContext context) { return memoryEstimateForLookupJoin(node, context); }
Source:
private Boolean getMigrateEncrypted() { Version version = getVm().getCompatibilityVersion(); if (version == null) { return null; } if (!FeatureSupported.isMigrateEncryptedSupported(version)) { return null; } if (getVm().getMigrateEncrypted() != null) { return getVm().getMigrateEncrypted(); } return getCluster().getMigrateEncrypted(); }

Target:
private Boolean getMigrateEncrypted() { Version version = getVm().getCompatibilityVersion(); if (version == null) { return null; } if (!FeatureSupported.isMigrateEncryptedSupported(version)) { return null; } if (getVm().getMigrateEncrypted() != null) { return getVm().getMigrateEncrypted(); } return Config.getValue(ConfigValues.DefaultMigrationEncryption); }
Source:
public void clearVm(VmStatic vm) { Set<Guid> modifiedHosts; synchronized (this) { if (!resourcesByVm.containsKey(vm.getId())) { return; } log.debug("Clearing pending resources for VM {}", vm.getId()); modifiedHosts = new HashSet<>(); resourcesByVm.compute(vm.getId(), (vmId, resources) -> { for (PendingResource resource : resources) { if(resourcesByHost.containsKey(resource.getHost())){ modifiedHosts.add(resource.getHost()); } removeFromSetMap(resourcesByHost, resource.getHost(), resource); pendingResources.remove(resource); } resources.clear(); return resources; }); } for (Guid hostId: modifiedHosts) { notifyHostManagers(hostId); } }

Target:
public void clearVm(VmStatic vm) { Set<Guid> modifiedHosts; synchronized (this) { if (!resourcesByVm.containsKey(vm.getId())) { return; } log.debug("Clearing pending resources for VM {}", vm.getId()); modifiedHosts = new HashSet<>(); resourcesByVm.compute(vm.getId(), (vmId, resources) -> { resources.stream() .peek(pendingResources::remove) .filter(r -> removeFromSetMap(resourcesByHost, r.getHost(), r)) .forEach(r -> modifiedHosts.add(r.getHost())); resources.clear(); return resources; }); } for (Guid hostId: modifiedHosts) { notifyHostManagers(hostId); } }
Source:
private static Envelope getEnvelope(BasicSliceInput input, GeometryType type, int length) { switch (type) { case POINT: return getPointEnvelope(input); case MULTI_POINT: case LINE_STRING: case MULTI_LINE_STRING: case POLYGON: case MULTI_POLYGON: return getSimpleGeometryEnvelope(input, length); case GEOMETRY_COLLECTION: return getGeometryCollectionOverallEnvelope(input); default: throw new UnsupportedOperationException("Unexpected type: " + type); } }

Target:
private static Envelope getEnvelope(BasicSliceInput input, GeometryType type, int length) { switch (type) { case POINT: return getPointEnvelope(input); case MULTI_POINT: case LINE_STRING: case MULTI_LINE_STRING: case POLYGON: case MULTI_POLYGON: return getSimpleGeometryEnvelope(input, length); case GEOMETRY_COLLECTION: return getGeometryCollectionOverallEnvelope(input); default: throw new IllegalArgumentException("Unexpected type: " + type); } }
Source:
public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { index = 0; displayCurrent(); $(contents).on(TRANSITION_END, new Function() { @Override public void f() { GQuery.console.log("TRANSITION_END"); activeAnimation = false; $("[data-remove]", contents).remove(); } }); } else { $(contents).off(TRANSITION_END); } }

Target:
public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { index = 0; displayCurrent(); $(contents).on(TRANSITION_END, new Function() { @Override public void f() { activeAnimation = false; $("[data-remove]", contents).remove(); } }); } else { $(contents).off(TRANSITION_END); } }
Source:
public void testBasic() throws Exception { try (CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1))) { client.start(); try (PersistentTtlNode node = new PersistentTtlNode(client, "/test", 10, new byte[0])) { node.start(); node.waitForInitialCreate(timing.session(), TimeUnit.MILLISECONDS); for ( int i = 0; i < 10; ++i ) { Thread.sleep(10); Assert.assertNotNull(client.checkExists().forPath("/test")); } } timing.sleepABit(); Assert.assertNull(client.checkExists().forPath("/test")); } }

Target:
public void testBasic() throws Exception { try (CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1))) { client.start(); try (PersistentTtlNode node = new PersistentTtlNode(client, "/test", 100, new byte[0])) { node.start(); Assert.assertTrue(node.waitForInitialCreate(timing.session(), TimeUnit.MILLISECONDS)); for ( int i = 0; i < 10; ++i ) { Thread.sleep(110); Assert.assertNotNull(client.checkExists().forPath("/test")); } } Assert.assertNotNull(client.checkExists().forPath("/test")); timing.sleepABit(); Assert.assertNull(client.checkExists().forPath("/test")); } }
Source:
public void update() { Stock updatedStock = (Stock) subject.getUpdate(); if (updatedStock == null || m.getStockForSymbol(updatedStock.getSymbol()) == null) { return; } if (history.containsKey(updatedStock.getSymbol())) { List<Double> priceList = history.get(updatedStock.getSymbol()); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } else { List<Double> priceList = new ArrayList<Double>(); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } }

Target:
public void update() { Stock updatedStock = (Stock) subject.getUpdate(); if (updatedStock == null || market.getStockForSymbol(updatedStock.getSymbol()) == null) { return; } addToHistory(marketHistory.containsKey(updatedStock.getSymbol())); }
Source:
public void sync() throws IOException { flush(); }

Target:
public void sync() throws IOException { flush(); Hadoop.FSDataOutputStream.hsync.invoke(outgoing); }
Source:
protected void writeInternal(ObjectDataOutput out) throws IOException { super.writeInternal(out); out.writeObject(mapEntries); out.writeBoolean(triggerMapLoader); }

Target:
protected void writeInternal(ObjectDataOutput out) throws IOException { super.writeInternal(out); out.writeObject(mapEntries); if (out.getVersion().isGreaterOrEqual(Versions.V4_1)) { out.writeBoolean(triggerMapLoader); } }
Source:
private boolean isDiagramOutlinePage(IWorkbenchPart part) { if (part instanceof ContentOutline) { IPage page = ((ContentOutline) part).getCurrentPage(); return page instanceof DiagramOutlinePage; } return false; }

Target:
private boolean isDiagramOutlinePage(IWorkbenchPart part) { if (part instanceof ContentOutline) { IPage page = ((ContentOutline) part).getCurrentPage(); if (page instanceof DiagramOutlinePage) { GraphicalViewer graphicalViewer = getGraphicalViewer(); if (graphicalViewer != null) { Control control = ((DiagramOutlinePage) page).getEditor(); return control == graphicalViewer.getControl(); } } } return false; }
Source:
public List<View> getRootViews() { WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); if (windowManager == null) { throw new RuntimeException("unfortunately, you cannot view the view tree of the dialog etc. windowManager == null !"); } Object wm = getOuter(windowManager); return getWindowViews(wm); }

Target:
public List<View> getRootViews() { WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); Object wm = getOuter(windowManager); return getWindowViews(wm); }
Source:
public Subject extractSubject(String token) throws ServletException { Jws<Claims> jwt = jwtParser.parseClaimsJws(token); Claims claims = jwt.getBody(); LOG.debug("JWT = {}", jwt); try { String username = claims.get( keycloakSettings.get().get(KeycloakConstants.USERNAME_CLAIM_SETTING), String.class); if (username == null) { username = claims.getIssuer() + ":" + claims.getSubject(); } if (!isNullOrEmpty(backSlashReplaceWith) && username.contains("\\")) { username = username.replace("\\", backSlashReplaceWith); } String id = claims.getSubject(); String email = retrieveEmail(token, claims, id) .orElseThrow( () -> new JwtException( "Unable to authenticate user because email address is not set in keycloak profile")); User user = userManager.getOrCreateUser(id, email, username); return new AuthorizedSubject( new SubjectImpl(user.getName(), user.getId(), token, false), permissionChecker); } catch (ServerException | ConflictException e) { throw new ServletException( "Unable to identify user " + claims.getSubject() + " in Che database", e); } }

Target:
public Subject extractSubject(String token) throws ServletException { Jws<Claims> jwt = jwtParser.parseClaimsJws(token); Claims claims = jwt.getBody(); LOG.debug("JWT = {}", jwt); try { String username = claims.get( keycloakSettings.get().get(KeycloakConstants.USERNAME_CLAIM_SETTING), String.class); if (username == null) { username = claims.getIssuer() + ":" + claims.getSubject(); } if (!userNameReplacementPatterns.isEmpty()) { for (Map.Entry<String, String> entry : userNameReplacementPatterns.entrySet()) { username = username.replaceAll(entry.getKey(), entry.getValue()); } } String id = claims.getSubject(); String email = retrieveEmail(token, claims, id) .orElseThrow( () -> new JwtException( "Unable to authenticate user because email address is not set in keycloak profile")); User user = userManager.getOrCreateUser(id, email, username); return new AuthorizedSubject( new SubjectImpl(user.getName(), user.getId(), token, false), permissionChecker); } catch (ServerException | ConflictException e) { throw new ServletException( "Unable to identify user " + claims.getSubject() + " in Che database", e); } }
Source:
public ArrayAdapter<JSONObject> createAdapter() { ArrayAdapter<JSONObject> itemAdapter = new ArrayAdapter<JSONObject>(container.$context(), 0, currentItems) { @Override public View getView(int position, View convertView, ViewGroup parent) { View view = createView(); TextView text1 = view.findViewById(2); TextView text2 = view.findViewById(3); JSONObject row = filterCurrentItems.get(position); String val1 = row.has("Text1") ? row.getString("Text1") : ""; String val2 = row.has("Text2") ? row.getString("Text2") : ""; text1.setText(val1); text2.setText(val2); text1.setTextColor(textColor); text2.setTextColor(detailTextColor); text1.setTextSize(textSize); text2.setTextSize(detailTextSize); return view; } @Override public Filter getFilter() { Filter filter = new Filter() { @Override protected FilterResults performFiltering(CharSequence charSequence) { String filterQuery = charSequence.toString().toLowerCase(); FilterResults results = new FilterResults(); if(filterQuery == null || filterQuery.length() == 0) { ArrayList<JSONObject> arrayList = new ArrayList<>(currentItems); results.count = arrayList.size(); results.values = arrayList; } else { ArrayList<JSONObject> arrayList = new ArrayList<>(currentItems); ArrayList<JSONObject> filteredList = new ArrayList<>(); for(int i = 0; i < arrayList.size(); ++i) { JSONObject object = arrayList.get(i); if ((object.has("Text1") && object.getString("Text1").toLowerCase() .contains(charSequence.toString())) || (object.has("Text2")) && object.getString("Text2") .toLowerCase().contains(charSequence.toString())) { filteredList.add(object); } } results.count = filteredList.size(); results.values = filteredList; } return results; } @Override protected void publishResults(CharSequence charSequence, FilterResults filterResults) { filterCurrentItems = (ArrayList<JSONObject>) filterResults.values; clear(); for(int i = 0; i < filterCurrentItems.size(); ++i) { add(filterCurrentItems.get(i)); } } }; return filter; } }; return itemAdapter; }

Target:
public ArrayAdapter<YailDictionary> createAdapter() { itemAdapter = new ArrayAdapter<YailDictionary>(container.$context(), 0, currentItems) { @Override public View getView(int position, View convertView, ViewGroup parent) { View view = createView(); TextView text1 = view.findViewById(2); TextView text2 = view.findViewById(3); YailDictionary row = filterCurrentItems.get(position); String val1 = ElementsUtil.toStringEmptyIfNull(row.get("Text1")); String val2 = ElementsUtil.toStringEmptyIfNull(row.get("Text2")); text1.setText(val1); text2.setText(val2); text1.setTextColor(textColor); text2.setTextColor(detailTextColor); text1.setTextSize(textSize); text2.setTextSize(detailTextSize); return view; } @Override public Filter getFilter() { return filter; } }; return itemAdapter; }
Source:
public void parseModuleDeclaration() { JavaParser.getStaticConfiguration().setLanguageLevel(JAVA_9); JavaParser.parseModuleDeclaration("module X {}"); }

Target:
public void parseModuleDeclaration() { JavaParser.parseModuleDeclaration("module X {}"); }
Source:
public List<EntryDTO> getNotificationsBySourceAndCustomAttribute(String source, String attributeName, String attributeValue) { Validate.notBlank(source, "Argument 'source' cannot be blank"); Validate.notBlank(source, "Argument 'attributeName' cannot be blank"); logger.debug("Invoking getNotificationsBySourceAndCustomAttribute with " + "source='{}', attributeName='{}', attributeValue='{}'", source, attributeName, attributeValue); final List<JpaEntry> entries = notificationDao.getNotificationsBySourceAndCustomAttribute(source, attributeName, attributeValue); logger.debug("Found the following entries: {}", entries.size(), entries); return notificationMapper.toEntryList(entries); }

Target:
public List<EntryDTO> getNotificationsBySourceAndCustomAttribute(String source, String attributeName, String attributeValue) { Validate.notBlank(source, "Argument 'source' cannot be blank"); Validate.notBlank(attributeName, "Argument 'attributeName' cannot be blank"); logger.debug("Invoking getNotificationsBySourceAndCustomAttribute with " + "source='{}', attributeName='{}', attributeValue='{}'", source, attributeName, attributeValue); final List<JpaEntry> entries = notificationDao.getNotificationsBySourceAndCustomAttribute(source, attributeName, attributeValue); logger.debug("Found the following entries: {}", entries.size(), entries); return notificationMapper.toEntryList(entries); }
Source:
public void getReserveStatisticsShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final ReserveService reserveService = adapter.create(ReserveService.class); reserveService.getStatistics(new RetrofitPromise<List<ReserveStatistics>>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/reserve/statistics", MOCK_URL)); }

Target:
public void getReserveStatisticsShouldReturnTheRequest() throws Exception { final MockRestAdapter<List<ReserveStatistics>> adapter = new MockRestAdapter<>(null, null, null); adapter.request(new RepromiseFunction<BitreserveRestAdapter, List<ReserveStatistics>>() { @Override public Promise<List<ReserveStatistics>> call(BitreserveRestAdapter bitreserveRestAdapter) { ReserveService reserveService = adapter.getRestAdapter().create(ReserveService.class); RetrofitPromise<List<ReserveStatistics>> promise = new RetrofitPromise<>(); reserveService.getStatistics(promise); return promise; } }); Request request = adapter.getRequest(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); }
Source:
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(super.toString()); buffer.append(":"); buffer.append(value == null ? "" : value); buffer.append("^"); buffer.append(boost); return buffer.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append(super.toString()); builder.append(value == null ? "" : value); builder.append("^").append(boost); return builder.toString(); }
Source:
public void writeOne() throws IOException { QueueEntry qe = queue.poll(); if (qe != null) { int read = qe.messageStream.read(outBytes); if (LogUtil.isLogAvailable()) { Log.i(TAG, "Message " + qe.messageNo + " written, it's a " + qe.messageClass.getSimpleName() + ", " + read + " bytes in length"); } outStream.write(outBytes, 0, read); int left = qe.messageStream.available(); if (left > 0) { if (LogUtil.isLogAvailable()) { Log.i(TAG, "Message " + qe.messageNo + ", " + left + " bytes left to write"); } queue.add(qe); } else { if (LogUtil.isLogAvailable()) { Log.i(TAG, "Message " + qe.messageNo + " finished writing"); } } } }

Target:
public void writeOne() throws IOException { QueueEntry qe = queue.poll(); if (qe != null) { int read = qe.messageStream.read(outBytes); if (LogUtil.isLogAvailable()) { Log.d(TAG, "Message " + qe.messageNo + " written, it's a " + qe.messageClass.getSimpleName() + ", " + read + " bytes in length"); } outStream.write(outBytes, 0, read); int left = qe.messageStream.available(); if (left > 0) { if (LogUtil.isLogAvailable()) { Log.d(TAG, "Message " + qe.messageNo + ", " + left + " bytes left to write"); } queue.add(qe); } else { if (LogUtil.isLogAvailable()) { Log.i(TAG, "Message " + qe.messageNo + " finished writing"); } } } }
Source:
@Override public CauseOfBlockage getCauseOfBlockage() { if (isLogUpdated() && !isConcurrentBuild()) { return new BlockedBecauseOfBuildInProgress(getLastBuild()); } if (blockBuildWhenDownstreamBuilding()) { AbstractProject<?,?> bup = getBuildingDownstream(); if (bup!=null) return new BecauseOfDownstreamBuildInProgress(bup); } if (blockBuildWhenUpstreamBuilding()) { AbstractProject<?,?> bup = getBuildingUpstream(); if (bup!=null) return new BecauseOfUpstreamBuildInProgress(bup); } return null; }

Target:
public CauseOfBlockage getCauseOfBlockage() { if (isLogUpdated() && !isConcurrentBuild()) { return new BlockedBecauseOfBuildInProgress(getLastBuild()); } if (blockBuildWhenDownstreamBuilding()) { AbstractProject<?,?> bup = getBuildingDownstream(); if (bup!=null) return new BecauseOfDownstreamBuildInProgress(bup); } if (blockBuildWhenUpstreamBuilding()) { AbstractProject<?,?> bup = getBuildingUpstream(); if (bup!=null) return new BecauseOfUpstreamBuildInProgress(bup); } return null; }
Source:
public Response redirectIndexHtml( @HeaderParam(X_FORWARDED_PROTO) String proto, @Context UriInfo uriInfo) { if (isNullOrEmpty(proto)) { proto = uriInfo.getRequestUri().getScheme(); } return Response.status(MOVED_PERMANENTLY) .location(UriBuilder.fromPath("/ui/").scheme(proto).build()) .build(); }

Target:
public Response redirectIndexHtml( @HeaderParam(X_FORWARDED_PROTO) String proto, @Context UriInfo uriInfo) { if (isNullOrEmpty(proto)) { proto = uriInfo.getRequestUri().getScheme(); } return Response.status(MOVED_PERMANENTLY) .location(fromPath("/ui/").scheme(proto).build()) .build(); }
Source:
public void initializeEditorFragment() { if (mEditorFragment instanceof AztecEditorFragment) { AztecEditorFragment aztecEditorFragment = (AztecEditorFragment)mEditorFragment; aztecEditorFragment.setEditorBetaClickListener(EditPostActivity.this); aztecEditorFragment.setAztecImageLoader(new AztecImageLoader(getBaseContext(), aztecEditorFragment.loadingImagePlaceholder)); aztecEditorFragment.setAztecVideoLoader(new AztecVideoLoader(getBaseContext(), aztecEditorFragment.loadingVideoPlaceholder)); } }

Target:
public void initializeEditorFragment() { if (mEditorFragment instanceof AztecEditorFragment) { AztecEditorFragment aztecEditorFragment = (AztecEditorFragment)mEditorFragment; aztecEditorFragment.setEditorBetaClickListener(EditPostActivity.this); Drawable loadingImagePlaceholder = getResources().getDrawable(org.wordpress.android.editor.R.drawable.ic_gridicons_image); loadingImagePlaceholder.setBounds(0, 0, AztecEditorFragment.DEFAULT_MEDIA_PLACEHOLDER_DIMENSION_DP, AztecEditorFragment.DEFAULT_MEDIA_PLACEHOLDER_DIMENSION_DP); aztecEditorFragment.setAztecImageLoader(new AztecImageLoader(getBaseContext(), loadingImagePlaceholder)); aztecEditorFragment.setLoadingImagePlaceholder(loadingImagePlaceholder); Drawable loadingVideoPlaceholder = getResources().getDrawable(org.wordpress.android.editor.R.drawable.ic_gridicons_video_camera); loadingVideoPlaceholder.setBounds(0, 0, AztecEditorFragment.DEFAULT_MEDIA_PLACEHOLDER_DIMENSION_DP, AztecEditorFragment.DEFAULT_MEDIA_PLACEHOLDER_DIMENSION_DP); aztecEditorFragment.setAztecVideoLoader(new AztecVideoLoader(getBaseContext(), loadingVideoPlaceholder)); aztecEditorFragment.setLoadingVideoPlaceholder(loadingVideoPlaceholder); } }
Source:
public static <T> TabbedListItemsPage createWithJson(String targetType, String property, Stream<T> tabItems, Function<T, String> getName, Function<T, Object> getValue) { ObjectMapper mapper = new ObjectMapper(); return new TabbedListItemsPage(targetType, property, tabItems.collect(Collectors.toMap(getName, v -> { try { return mapper.writeValueAsString(getValue.apply(v)); } catch (JsonProcessingException e) { log.error("Failed to serialised tab value as JSON", e); return null; } }, (left, right) -> left, TreeMap::new))); }

Target:
public static <T> TabbedListItemsPage createWithJson(String targetType, String property, Stream<T> tabItems, Function<T, String> getName, Function<T, Object> getValue) { ObjectMapper mapper = new ObjectMapper(); return new TabbedListItemsPage(targetType, property, tabItems.collect(Collectors.toMap(getName, v -> { try { return mapper.writeValueAsString(getValue.apply(v)); } catch (JsonProcessingException e) { throw new IllegalStateException("Failed to serialised tab value as JSON", e); } }, (left, right) -> left, TreeMap::new))); }
Source:
private void processUpdates(List<Update> updates) throws Exception { for (Update update : updates) { log.debug("Received update from Telegram service: " + update); Exchange exchange = endpoint.createExchange(); if (update.getMessage() != null) { exchange.getIn().setBody(update.getMessage()); if (update.getMessage().getChat() != null) { exchange.getIn().setHeader(TelegramConstants.TELEGRAM_CHAT_ID, update.getMessage().getChat().getId()); } } getProcessor().process(exchange); } }

Target:
private void processUpdates(List<Update> updates) throws Exception { for (Update update : updates) { log.debug("Received update from Telegram service: {}", update); Exchange exchange = endpoint.createExchange(update); getProcessor().process(exchange); } }
Source:
private void skip(int items) throws IOException { if (presentStream != null) { int dataToSkip = presentStream.countBitsSet(items); if (inDictionaryStream != null) { inDictionaryStream.skip(dataToSkip); } if (dataStream != null) { dataStream.skip(dataToSkip); } } else { if (inDictionaryStream != null) { inDictionaryStream.skip(items); } dataStream.skip(items); } }

Target:
private void skip(int items) throws IOException { if (presentStream != null) { int dataToSkip = presentStream.countBitsSet(items); if (inDictionaryStream != null) { inDictionaryStream.skip(dataToSkip); } dataStream.skip(dataToSkip); } else { if (inDictionaryStream != null) { inDictionaryStream.skip(items); } dataStream.skip(items); } }
Source:
private void refresh(VirtualItem item) { getContentProvider().preserveState(getTreePathFromItem(item)); if (!item.needsDataUpdate()) { if (item.getParent() != null) { item.setNeedsLabelUpdate(); virtualLazyUpdateHasChildren(item); } for (VirtualItem item2 : item.getItems()) { item2.setNeedsDataUpdate(); } } refreshStruct(item); }

Target:
private void refresh(VirtualItem item) { getContentProvider().preserveState(getTreePathFromItem(item)); if (!item.needsDataUpdate()) { if (item.getParent() != null) { item.setNeedsLabelUpdate(); virtualLazyUpdateHasChildren(item); } for (VirtualItem childItem : item.getItems()) { childItem.setNeedsDataUpdate(); } } refreshStruct(item); }
Source:
private String getClassName(TestIdentifier testIdentifier) { if (testIdentifier.isContainer()) { return testIdentifier.getLegacyReportingName(); } return parentDisplayName(testIdentifier); }

Target:
private Optional<String> getClassName(TestIdentifier testIdentifier) { TestSource testSource = testIdentifier.getSource().orElse(null); if (testSource instanceof ClassSource) { return Optional.of(((ClassSource) testSource).getJavaClass().getName()); } if (testSource instanceof MethodSource) { return Optional.of(((MethodSource) testSource).getClassName()); } return Optional.empty(); }
Source:
private void emitInsertOrUpdateObjectToRealmMethod(JavaWriter writer) throws IOException { writer.emitAnnotation("Override"); writer.beginMethod( "void", "insertOrUpdateToRealm", EnumSet.of(Modifier.PUBLIC), "Realm", "realm", "RealmModel", "obj", "Map<RealmModel, Long>", "cache"); writer.emitSingleLineComment("This cast is correct because obj is either"); writer.emitSingleLineComment("generated by RealmProxy or the original type extending directly from RealmObject"); writer.emitStatement("@SuppressWarnings(\"unchecked\") Class<RealmModel> clazz = (Class<RealmModel>) ((obj instanceof RealmObjectProxy) ? obj.getClass().getSuperclass() : obj.getClass())"); writer.emitEmptyLine(); emitMediatorSwitch(new ProxySwitchStatement() { @Override public void emitStatement(int i, JavaWriter writer) throws IOException { writer.emitStatement("%s.insertOrUpdate(realm, (%s) obj, cache)", proxyClasses.get(i), simpleModelClasses.get(i)); } }, writer, false); writer.endMethod(); writer.emitEmptyLine(); }

Target:
private void emitInsertOrUpdateObjectToRealmMethod(JavaWriter writer) throws IOException { writer.emitAnnotation("Override"); writer.beginMethod( "void", "insertOrUpdate", EnumSet.of(Modifier.PUBLIC), "Realm", "realm", "RealmModel", "obj", "Map<RealmModel, Long>", "cache"); writer.emitSingleLineComment("This cast is correct because obj is either"); writer.emitSingleLineComment("generated by RealmProxy or the original type extending directly from RealmObject"); writer.emitStatement("@SuppressWarnings(\"unchecked\") Class<RealmModel> clazz = (Class<RealmModel>) ((obj instanceof RealmObjectProxy) ? obj.getClass().getSuperclass() : obj.getClass())"); writer.emitEmptyLine(); emitMediatorSwitch(new ProxySwitchStatement() { @Override public void emitStatement(int i, JavaWriter writer) throws IOException { writer.emitStatement("%s.insertOrUpdate(realm, (%s) obj, cache)", proxyClasses.get(i), simpleModelClasses.get(i)); } }, writer, false); writer.endMethod(); writer.emitEmptyLine(); }
Source:
public PieChart getTimeRangePC() { return fTimeRangePC; }

Target:
PieChart getTimeRangePC() { return fTimeRangePC; }
Source:
public boolean isEnableForComponent(Component invoker) { Context ctx = View.getSingleton().getSiteTreePanel().getSelectedContext(); if (ctx == null) { return false; } return invoker.getName().equals(SiteMapPanel.CONTEXT_TREE_COMPONENT_NAME); }

Target:
public boolean isEnableForComponent(Component invoker) { if (invoker.getName().equals(SiteMapPanel.CONTEXT_TREE_COMPONENT_NAME)) { Context ctx = View.getSingleton().getSiteTreePanel().getSelectedContext(); if (ctx != null) { return true; } } return false; }
Source:
public static Set<String> getCompletionKeywords() { Set<String> defaultCompletions = new ArrayList<>(Arrays.asList(QualifierType.values())).stream() .map(QualifierType::name) .map(String::toLowerCase) .collect(Collectors.toSet()); defaultCompletions.addAll(Arrays.asList( "creator", "user", "status", "body", "closed", "open", "issue", "pr", "pullrequest", "read", "unread", "merged", "unmerged", "comments", "nonSelfUpdate")); defaultCompletions.remove("is"); return Collections.unmodifiableSet(defaultCompletions); }

Target:
public static Set<String> getCompletionKeywords() { Set<String> defaultCompletions = new ArrayList<>(Arrays.asList(QualifierType.values())).stream() .map(QualifierType::name) .map(String::toLowerCase) .collect(Collectors.toSet()); defaultCompletions.removeAll(Arrays.asList("false", "empty", "keyword")); defaultCompletions.addAll(ALIASES.keySet()); defaultCompletions.removeAll(Arrays.asList("m", "as", "au", "s")); defaultCompletions.addAll(Arrays.asList("closed", "open", "issue", "pr", "pullrequest", "read", "unread", "merged", "unmerged", "comments", "nonSelfUpdate")); return Collections.unmodifiableSet(defaultCompletions); }
Source:
public DataAccessEditPage(PageParameters parameters) { String wsName = parameters.get(WS_NAME).toOptionalString(); String storeName = parameters.get(STORE_NAME).toString(); DataStoreInfo dsi = getCatalog().getDataStoreByName(wsName, storeName); if(dsi == null) { getSession().error( new ParamResourceModel("DataAccessEditPage.notFound", this, wsName, storeName).getString() ); doReturn(StorePage.class); return; } try { initUI(dsi); } catch (IllegalArgumentException e) { getSession().error(e.getMessage()); doReturn(StorePage.class); } }

Target:
public DataAccessEditPage(PageParameters parameters) { String wsName = parameters.get(WS_NAME).toOptionalString(); String storeName = parameters.get(STORE_NAME).toString(); DataStoreInfo dsi = getCatalog().getDataStoreByName(wsName, storeName); if(dsi == null) { getSession().error( new ParamResourceModel("DataAccessEditPage.notFound", this, wsName, storeName).getString() ); doReturn(StorePage.class); return; } try { initUI(dsi); } catch (IllegalArgumentException e) { error(e.getMessage()); doReturn(StorePage.class); return; } }
Source:
protected PageableResult doSearch(RequestContext context) { ConceptService cs = Context.getConceptService(); String query = context.getParameter("q"); if (query == null) return new EmptySearchResult(); String sourceUuid = context.getParameter("source"); ConceptSource source = null; if(sourceUuid!=null){ source = cs.getConceptSourceByUuid(sourceUuid); } List<ConceptReferenceTerm> terms = cs.getConceptReferenceTerms(query, source, context.getStartIndex(), context.getLimit(), context.getIncludeAll()); int count = cs.getCountOfConceptReferenceTerms(query, source, context.getIncludeAll()); boolean hasMore = count > context.getStartIndex() + context.getLimit(); return new AlreadyPaged<ConceptReferenceTerm>(context, terms, hasMore); }

Target:
protected PageableResult doSearch(RequestContext context) { ConceptService cs = Context.getConceptService(); String query = context.getParameter("q"); if (query == null) return new EmptySearchResult(); List<ConceptReferenceTerm> terms = cs.getConceptReferenceTerms(query, null, context.getStartIndex(), context.getLimit(), context.getIncludeAll()); int count = cs.getCountOfConceptReferenceTerms(query, null, context.getIncludeAll()); boolean hasMore = count > context.getStartIndex() + context.getLimit(); return new AlreadyPaged<ConceptReferenceTerm>(context, terms, hasMore); }
Source:
public static String getKitodoConfigDirectory() { return ConfigCore.getParameter(CONFIG_DIR); }

Target:
public static String getKitodoConfigDirectory() { return getParameter(CONFIG_DIR); }
Source:
public void testMemoryExceeded() throws Exception { try { TypedSet typedSet = new TypedSet(BIGINT, 10, FUNCTION_NAME); for (int i = 0; i <= TypedSet.FOUR_MEGABYTES + 1; i++) { Block block = createLongsBlock(Collections.nCopies((int) 1, (long) i)); typedSet.add(block, 0); } fail("expected exception"); } catch (PrestoException e) { assertEquals(e.getErrorCode(), StandardErrorCode.EXCEEDED_FUNCTION_MEMORY_LIMIT.toErrorCode()); } }

Target:
public void testMemoryExceeded() throws Exception { try { TypedSet typedSet = new TypedSet(BIGINT, 10, FUNCTION_NAME); for (int i = 0; i <= TypedSet.FOUR_MEGABYTES + 1; i++) { Block block = createLongsBlock(nCopies((int) 1, (long) i)); typedSet.add(block, 0); } fail("expected exception"); } catch (PrestoException e) { assertEquals(e.getErrorCode(), EXCEEDED_FUNCTION_MEMORY_LIMIT.toErrorCode()); } }
Source:
@Override public Class<? extends Service> serviceClass() { if (cfg instanceof LazyServiceConfiguration) { if (srvcCls != null) return srvcCls; String clsName = ((LazyServiceConfiguration)cfg).serviceClassName(); try { srvcCls = (Class<? extends Service>)Class.forName(clsName); return srvcCls; } catch (ClassNotFoundException e) { GridDeployment srvcDep = ctx.deploy().getDeployment(clsName); if (srvcDep != null) { srvcCls = (Class<? extends Service>)srvcDep.deployedClass(clsName); if (srvcCls != null) return srvcCls; } throw new IgniteException("Failed to find service class: " + clsName, e); } } else return cfg.getService().getClass(); }

Target:
@Override public Class<? extends Service> serviceClass() { if (cfg instanceof LazyServiceConfiguration) { if (srvcCls != null) return srvcCls; String clsName = ((LazyServiceConfiguration)cfg).serviceClassName(); try { srvcCls = (Class<? extends Service>)Class.forName(clsName); return srvcCls; } catch (ClassNotFoundException e) { if (ctx != null) { GridDeployment srvcDep = ctx.deploy().getDeployment(clsName); if (srvcDep != null) { srvcCls = (Class<? extends Service>)srvcDep.deployedClass(clsName); if (srvcCls != null) return srvcCls; } } throw new IgniteException("Failed to find service class: " + clsName, e); } } else return cfg.getService().getClass(); }
Source:
public final long doSObject(final Object receiver) { if (VmSettings.SNAPSHOTS_ENABLED) { SnapshotBuffer sb = new SnapshotBuffer(); if (!sb.containsObject(receiver)) { SClass sc = Types.getClassOf(receiver); sc.getSerializer().serialize(receiver, sb); } return 0; } return 0; }

Target:
public final Object doSObject(final Object receiver) { if (VmSettings.SNAPSHOTS_ENABLED) { SnapshotBuffer sb = new SnapshotBuffer(); if (!sb.containsObject(receiver)) { SClass sc = Types.getClassOf(receiver); sc.serialize(receiver, sb); } } return receiver; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdcParametersMap otherParamsMap = (VdcParametersMap) obj; if (size() != otherParamsMap.size()) { return false; } for (Entry<VdcParameter, Object> entry : paramsMap.entrySet()) { Object otherValue = otherParamsMap.get(entry.getKey(), entry.getKey().getJavaType()); if (otherValue == null) { return false; } Object thisValue = entry.getValue(); if (!thisValue.equals(otherValue)) { return false; } } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } VdcParametersMap otherParamsMap = (VdcParametersMap) obj; return paramsMap.equals(otherParamsMap.paramsMap); }
Source:
public void testPauseResumeWithDelay() { try { runTestOnUiThread(new TestPauseResumeWithDelay()); } catch (Throwable e) { fail("Exception error!"); } }

Target:
public void testPauseResumeWithDelay() throws InterruptedException { GLSurfaceView view = mActivity.getView(); for (int i = 0; i < NUM_PAUSE_RESUME_ITERATIONS_WITH_DELAY; i++) { Thread.sleep(PAUSE_RESUME_DELAY); if (LOG_PAUSE_RESUME) { Log.w(TAG, "Pause/Resume (w/ delay) step " + i + " - pause"); } view.onPause(); Thread.sleep(PAUSE_RESUME_DELAY); if (LOG_PAUSE_RESUME) { Log.w(TAG, "Pause/Resume (w/ delay) step " + i + " - resume"); } view.onResume(); } }
Source:
private void initializeWithoutRunning(TransactionManager txManager) { initializeWithoutRunning(SpecialTimestampsSupplier.create(txManager), txManager.getTimelockService(), txManager.getKeyValueService(), new TargetedSweepFollower(followers, txManager)); }

Target:
public void initializeWithoutRunning(TransactionManager txManager) { initializeWithoutRunning(SpecialTimestampsSupplier.create(txManager), txManager.getTimelockService(), txManager.getKeyValueService(), new TargetedSweepFollower(followers, txManager)); }
Source:
public MachineSet ensureUnclaimed(int count, ReusableMachineTemplate template) { MachineSet current; synchronized (this) { current = unclaimed(matching(template)); } if (current.size() >= count) return current; MachineSet moreNeeded = create(count-current.size(), template); return current.added(moreNeeded); }

Target:
public MachineSet ensureUnclaimed(int count, ReusableMachineTemplate template) { MachineSet current; current = unclaimed(matching(template)); if (current.size() >= count) return current; MachineSet moreNeeded = create(count-current.size(), template); return current.added(moreNeeded); }
Source:
private boolean hostExists(List<GlusterServerInfo> glusterServers, VDS server) { for (GlusterServerInfo glusterServer : glusterServers) { if (glusterServer.getHostName().equals(server.gethost_name()) || glusterServer.getHostName().equals(server.getManagmentIp())) { return true; } } return false; }

Target:
private boolean hostExists(List<GlusterServerInfo> glusterServers, VDS server) { for (GlusterServerInfo glusterServer : glusterServers) { if (glusterServer.getHostnameOrIp().equals(server.gethost_name())) { return true; } for (VdsNetworkInterface nwInterface : server.getInterfaces()) { if (glusterServer.getHostnameOrIp().equals(nwInterface.getAddress())) { return true; } } } return false; }
Source:
protected void collectFindQueries(BiConsumer<Predicate<SQLCodeListEntry>, Supplier<FindQuery<SQLCodeListEntry>>> queryConsumer) { queryConsumer.accept(sqlCodeListEntry -> !sqlCodeListEntry.isNew(), () -> context.getBatchContext().findQuery(SQLCodeListEntry.class, SQLCodeListEntry.ID)); queryConsumer.accept(sqlCodeListEntry -> Strings.isFilled(sqlCodeListEntry.getCodeListEntryData().getCode()) && sqlCodeListEntry.getCodeList().isFilled(), () -> context.getBatchContext() .findQuery(SQLCodeListEntry.class, SQLCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE), SQLCodeListEntry.CODE_LIST)); }

Target:
protected void collectFindQueries(BiConsumer<Predicate<SQLCodeListEntry>, Supplier<FindQuery<SQLCodeListEntry>>> queryConsumer) { queryConsumer.accept(sqlCodeListEntry -> Strings.isFilled(sqlCodeListEntry.getCodeListEntryData().getCode()) && sqlCodeListEntry.getCodeList().isFilled(), () -> context.getBatchContext() .findQuery(SQLCodeListEntry.class, SQLCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE), SQLCodeListEntry.CODE_LIST)); }
Source:
protected Operation<UsersWorkspaceDto> startWorkspace() { return new Operation<UsersWorkspaceDto>() { @Override public void apply(UsersWorkspaceDto workspaceToStart) throws OperationException { WorkspaceStatus wsFromReferenceStatus = workspaceToStart.getStatus(); Log.info(getClass(), workspaceToStart); startWorkspaceById(workspaceToStart); } }; }

Target:
protected Operation<UsersWorkspaceDto> startWorkspace() { return new Operation<UsersWorkspaceDto>() { @Override public void apply(UsersWorkspaceDto workspaceToStart) throws OperationException { WorkspaceStatus wsFromReferenceStatus = workspaceToStart.getStatus(); startWorkspaceById(workspaceToStart); } }; }
Source:
public static void updateThreadCount(final OnThreadCountUpdateListener listener){ new AsyncTask<Void, Void, List<MailThread>>() { int[] countArray = new int[6]; @Override protected List<MailThread> doInBackground(Void... params) { List<MailThread> threads = getAllThreads(); List<MailThread> res = new ArrayList<>(); for (MailThread thread : threads) { if (hasLabel(thread, Label.INBOX)) { countArray[0]++; } if (hasLabel(thread, Label.UNREAD)) { countArray[1]++; } if (hasLabel(thread, Label.IMPORTANT)) { countArray[2]++; } countArray[3] = DraftDBUtils.getDraftCount(); if (hasLabel(thread, Label.SENT)) { countArray[4]++; } if (hasLabel(thread, Label.ARCHIVED)) { countArray[5]++; } } return res; } @Override protected void onPostExecute(List<MailThread> mailThreads) { super.onPostExecute(mailThreads); listener.onThreadCountUpdated(countArray[0], countArray[1], countArray[2], countArray[3], countArray[4], countArray[5]); } }.execute(); }

Target:
public static void updateThreadCount(final OnThreadCountUpdateListener listener){ new AsyncTask<Void, Void, Void>() { int[] countArray = new int[6]; HashMap<String, Integer> map = new HashMap<String, Integer>(); @Override protected Void doInBackground(Void... params) { List<MailThread> threads = getAllThreads(); List<MailThread> res = new ArrayList<>(); for (MailThread thread : threads) { if (hasLabel(thread, Label.INBOX)) { countArray[0]++; } if (hasLabel(thread, Label.UNREAD)) { countArray[1]++; } if (hasLabel(thread, Label.IMPORTANT)) { countArray[2]++; } countArray[3] = DraftDBUtils.getDraftCount(); if (hasLabel(thread, Label.SENT)) { countArray[4]++; } if (hasLabel(thread, Label.ARCHIVED)) { countArray[5]++; } } return null; } @Override protected void onPostExecute(Void v) { super.onPostExecute(v); map.put(Label.INBOX, countArray[0]); map.put(Label.UNREAD, countArray[1]); map.put(Label.IMPORTANT, countArray[2]); map.put(Label.DRAFT, countArray[3]); map.put(Label.SENT, countArray[4]); map.put(Label.ARCHIVED, countArray[4]); listener.onThreadCountUpdated(map); } }.execute(); }
Source:
public Map<NamedKey, byte[]> getBulk(Iterable<NamedKey> keys) { final Map<byte[], NamedKey> keyLookup = Maps.uniqueIndex( keys, new Function<NamedKey, byte[]>() { @Override public byte[] apply( @Nullable NamedKey input ) { return computeKeyHash(prefix, input); } } ); final Map<NamedKey, byte[]> results = Maps.newHashMap(); if (keyLookup.size() == 0) { return results; } final List<byte[]> keysList = new ArrayList<>(keyLookup.keySet()); final List<byte[]> valuesList; try (final Jedis client = pool.getResource()) { valuesList = client.mget(keysList.toArray(new byte[keysList.size()][])); } catch (JedisConnectionException ex) { if (isTimeout(ex)) { timeoutCount.incrementAndGet(); } throw Throwables.propagate(ex); } catch (JedisException ex) { errorCount.incrementAndGet(); log.warn(ex, "Unable to get cache items"); return results; } final int length = valuesList.size(); int i = 0; while (i < length) { final byte[] value = valuesList.get(i); if (value != null) { final NamedKey key = keyLookup.get(keysList.get(i)); try { final byte[] deserialized = deserialize(key, value); hitCount.incrementAndGet(); results.put(key, deserialized); } catch (LZ4Exception ex) { errorCount.incrementAndGet(); log.warn(ex, "Error decompressing cache item"); } } else { missCount.incrementAndGet(); } i++; } return results; }

Target:
public Map<NamedKey, byte[]> getBulk(Iterable<NamedKey> keys) { final Map<byte[], NamedKey> keyLookup = Maps.uniqueIndex( keys, new Function<NamedKey, byte[]>() { @Override public byte[] apply( @Nullable NamedKey input ) { return CacheImplUtils.computeKeyHash(prefix, input).getBytes(); } } ); if (keyLookup.size() == 0) { return ImmutableMap.of(); } final Map<NamedKey, byte[]> results = Maps.newHashMap(); final byte[][] keysArray = Iterables.toArray(keyLookup.keySet(), byte[].class); final List<Object> valuesList; try (ResourceHolder<ShardedJedis> clientHolder = supplier.get()) { final ShardedJedis jedis = clientHolder.get(); final ShardedJedisPipeline pipeline = jedis.pipelined(); for (byte[] itemKey : keysArray) { pipeline.get(itemKey); } pipeline.sync(); valuesList = pipeline.getResults(); } catch (IOException | JedisException ex) { this.countException(ex); log.warn(ex, "Unable to get cache items"); return results; } final int length = keysArray.length; int i = 0; while (i < length) { final Object value = valuesList.get(i); if (value != null) { final NamedKey key = keyLookup.get(keysArray[i]); try { final byte[] deserialized = deserialize(key, (byte []) value); hitCount.incrementAndGet(); results.put(key, deserialized); } catch (LZ4Exception ex) { errorCount.incrementAndGet(); log.warn(ex, "Error decompressing cache item"); } } else { missCount.incrementAndGet(); } i++; } return results; }
Source:
public void receivedMessage(Message msg) throws InterruptedException { publisher.publish(new TraceEvent("[Recv: " + msg + "]")); if (requestQueue.peek() != null) { MessageRoundtrip messageRoundtrip = requestQueue.peek(); Message waitingMessage = messageRoundtrip.getMsg(); if (waitingMessage instanceof PingMessage) hasPing = false; if (waitingMessage.getAnswerMessage() != null && msg.getClass() == waitingMessage.getAnswerMessage()) { messageRoundtrip.answer(); if (waitingMessage instanceof EthMessage) channel.getPeerStats().pong(messageRoundtrip.lastTimestamp); logger.trace("Message round trip covered: ", messageRoundtrip.getMsg().getClass()); } } }

Target:
public void receivedMessage(Message msg) throws InterruptedException { ethereumListener.trace("[Recv: " + msg + "]"); if (requestQueue.peek() != null) { MessageRoundtrip messageRoundtrip = requestQueue.peek(); Message waitingMessage = messageRoundtrip.getMsg(); if (waitingMessage instanceof PingMessage) hasPing = false; if (waitingMessage.getAnswerMessage() != null && msg.getClass() == waitingMessage.getAnswerMessage()) { messageRoundtrip.answer(); if (waitingMessage instanceof EthMessage) channel.getPeerStats().pong(messageRoundtrip.lastTimestamp); logger.trace("Message round trip covered: ", messageRoundtrip.getMsg().getClass()); } } }
Source:
public BatchMetricQuery findBatchById(String id) { String json = _cacheService.get(ROOT + id); if (json == null) { return null; } try { Map<String, Object> batchData = MAPPER.readValue(json, Map.class); Status status = BatchMetricQuery.Status.fromInt((Integer) batchData.get("status")); int ttl = Integer.valueOf(batchData.get("ttl").toString()); long createdDate = Long.valueOf(batchData.get("createdDate").toString()); String ownerName = (String) batchData.get("ownerName"); String batchId = (String) batchData.get("batchId"); List<AsyncBatchedMetricQuery> queries = new ArrayList<>(); int[] indices = MAPPER.readValue((String) batchData.get("indices"), int[].class); for (int index: indices) { queries.add(_findQueryById(batchId, index)); } BatchMetricQuery batch = new BatchMetricQuery(status, ttl, createdDate, batchId, ownerName, queries); batch.updateStatus(); return batch; } catch (IOException ex) { throw new SystemException(ex); } }

Target:
public BatchMetricQuery findBatchById(String id) { String json = _cacheService.get(ROOT + id); if (json == null) { return null; } try { Map<String, Object> batchData = MAPPER.readValue(json, Map.class); Status status = BatchMetricQuery.Status.fromInt((Integer) batchData.get("status")); int ttl = Integer.valueOf(batchData.get("ttl").toString()); long createdDate = Long.valueOf(batchData.get("createdDate").toString()); String ownerName = (String) batchData.get("ownerName"); String batchId = (String) batchData.get("batchId"); List<AsyncBatchedMetricQuery> queries = new ArrayList<>(); int[] indices = MAPPER.readValue((String) batchData.get("indices"), int[].class); for (int index: indices) { queries.add(_findQueryById(batchId, index)); } BatchMetricQuery batch = new BatchMetricQuery(status, ttl, createdDate, batchId, ownerName, queries); return batch; } catch (IOException ex) { throw new SystemException(ex); } }
Source:
protected Point getInitialLocation(Point initialSize) { Rectangle bounds = getShell().getParent().getMonitor().getBounds(); GC gc = new GC(getShell().getDisplay()); int textExtendX = gc.textExtent(message).x; gc.dispose(); return new Point(bounds.x + bounds.width / 2 - textExtendX / 2, bounds.y + bounds.height / 5); }

Target:
protected Point getInitialLocation(Point initialSize) { if (getShell().getParent() == null) { return super.getInitialLocation(initialSize); } Rectangle bounds = getShell().getParent().getMonitor().getBounds(); GC gc = new GC(getShell().getDisplay()); int textExtendX = gc.textExtent(message).x; gc.dispose(); return new Point(bounds.x + bounds.width / 2 - textExtendX / 2, bounds.y + bounds.height / 5); }