auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void updateNonExistingIDInJSONButValidInURL() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateNonExistingIDInJSONButValidInURL") .build(); context.restoreAuthSystemState(); int nonExistentBitstreamFormatID = 404404404; BitstreamFormatRest bitstreamFormatRest = converter.fromModel(bitstreamFormat); String token = getAuthToken(admin.getEmail(), password); bitstreamFormatRest.setShortDescription("Test short UPDATED"); bitstreamFormatRest.setId(nonExistentBitstreamFormatID); getClient(token).perform(put("/api/core/bitstreamformats/" + bitstreamFormat.getID()) .content(mapper.writeValueAsBytes(bitstreamFormatRest)).contentType(contentType)) .andExpect(status().isBadRequest()); }

Target:
public void updateNonExistingIDInJSONButValidInURL() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder .createBitstreamFormat(context) .withShortDescription("Test short") .withMimeType("application/octet-stream") .withDescription("Description - updateNonExistingIDInJSONButValidInURL") .build(); context.restoreAuthSystemState(); int nonExistentBitstreamFormatID = 404404404; BitstreamFormatRest bitstreamFormatRest = converter.fromModel(bitstreamFormat); String token = getAuthToken(admin.getEmail(), password); bitstreamFormatRest.setShortDescription("Test short UPDATED"); bitstreamFormatRest.setId(nonExistentBitstreamFormatID); getClient(token).perform(put("/api/core/bitstreamformats/" + bitstreamFormat.getID()) .content(mapper.writeValueAsBytes(bitstreamFormatRest)) .contentType(contentType)) .andExpect(status().isBadRequest()); getClient(token).perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", Matchers.is( BitstreamFormatMatcher .matchBitstreamFormat(bitstreamFormat.getID(), bitstreamFormat.getMIMEType(), bitstreamFormat.getDescription(), bitstreamFormat.getShortDescription()) ))); }
Source:
public static EventNode createEventNode(final Long eventID, FilteredEventsModel eventsModel) { final SingleEvent eventById = eventsModel.getEventById(eventID); try { SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase(); AbstractFile file = sleuthkitCase.getAbstractFileById(eventById.getFileID()); if (file != null) { if (eventById.getArtifactID().isPresent()) { BlackboardArtifact blackboardArtifact = sleuthkitCase.getBlackboardArtifact(eventById.getArtifactID().get()); return new EventNode(eventById, file, blackboardArtifact); } else { return new EventNode(eventById, file); } } else { LOGGER.log(Level.WARNING, "Failed to lookup sleuthkit object backing TimeLineEvent."); return null; } } catch (IllegalStateException | TskCoreException ex) { LOGGER.log(Level.WARNING, "Failed to lookup sleuthkit object backing TimeLineEvent.", ex); return null; } }

Target:
public static EventNode createEventNode(final Long eventID, FilteredEventsModel eventsModel) throws TskCoreException, IllegalStateException { final SingleEvent eventById = eventsModel.getEventById(eventID); SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase(); AbstractFile file = sleuthkitCase.getAbstractFileById(eventById.getFileID()); if (eventById.getArtifactID().isPresent()) { BlackboardArtifact blackboardArtifact = sleuthkitCase.getBlackboardArtifact(eventById.getArtifactID().get()); return new EventNode(eventById, file, blackboardArtifact); } else { return new EventNode(eventById, file); } }
Source:
protected Callable<Response> getFutureRequest(final Request req, RequestMetrics metrics) { return new Callable<Response>() { @Override public Response call() { LOGGER.debug("Starting a future request",req.getOperation()); RequestMetrics.Context metricCtx = null; Response resp = null; switch (req.getOperation()) { case FIND: metricCtx = metrics.startEntityRequest("find", req.getEntityVersion().getEntity(), req.getEntityVersion().getVersion()); resp = find((FindRequest) req); metricCtx.markAllErrorsAndEndRequestMonitoring(resp.getErrors()); return resp; case INSERT: metricCtx = metrics.startEntityRequest("insert", req.getEntityVersion().getEntity(), req.getEntityVersion().getVersion()); resp = insert((InsertionRequest) req); metricCtx.markAllErrorsAndEndRequestMonitoring(resp.getErrors()); return resp; case DELETE: metricCtx = metrics.startEntityRequest("delete", req.getEntityVersion().getEntity(), req.getEntityVersion().getVersion()); resp = delete((DeleteRequest) req); metricCtx.markAllErrorsAndEndRequestMonitoring(resp.getErrors()); return resp; case UPDATE: metricCtx = metrics.startEntityRequest("update", req.getEntityVersion().getEntity(), req.getEntityVersion().getVersion()); resp = update((UpdateRequest) req); metricCtx.markAllErrorsAndEndRequestMonitoring(resp.getErrors()); return resp; case SAVE: metricCtx = metrics.startEntityRequest("save", req.getEntityVersion().getEntity(), req.getEntityVersion().getVersion()); resp = save((SaveRequest) req); metricCtx.markAllErrorsAndEndRequestMonitoring(resp.getErrors()); return resp; default: throw new UnsupportedOperationException("CRUD operation '"+req.getOperation()+"' is not supported!"); } } }; }

Target:
protected Callable<Response> getFutureRequest(final Request req, RequestMetrics metrics) { return new Callable<Response>() { @Override public Response call() { LOGGER.debug("Starting a future request",req.getOperation()); Response resp = null; RequestMetrics.Context metricCtx = metrics.startEntityRequest(req.getOperation().toString().toLowerCase(), req.getEntityVersion().getEntity(), req.getEntityVersion().getVersion()); switch (req.getOperation()) { case FIND: resp = find((FindRequest) req); break; case INSERT: resp = insert((InsertionRequest) req); break; case DELETE: resp = delete((DeleteRequest) req); break; case UPDATE: resp = update((UpdateRequest) req); break; case SAVE: resp = save((SaveRequest) req); break; default: throw new UnsupportedOperationException("CRUD operation '" + req.getOperation() + "' is not supported!"); } metricCtx.markAllErrorsAndEndRequestMonitoring(resp.getErrors()); return resp; } }; }
Source:
public void enabledFilters(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String workspace = request.getParameter("workspace"); String layer = request.getParameter("layer"); if(workspace==null) { workspace = layer.split(":")[0]; layer = layer.split(":", 2)[1]; } try { respondWithDocument(response, getEnabledFiltersDocument(workspace, layer)); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public void enabledFilters(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String workspace = request.getParameter("workspace"); String layer = request.getParameter("layer"); try { respondWithDocument(response, getEnabledFiltersDocument(workspace, layer)); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public String search(@PathVariable String geneId) { JsonArray result = new JsonArray(); Map<String, List<String>> cellIds = geneSearchService.getCellIdsInExperiments(geneId); cellIds.forEach((experimentAccession, cells) -> { JsonObject resultEntry = new JsonObject(); JsonElement element = GSON.toJsonTree(geneSearchService.getExperimentInformation(experimentAccession)); resultEntry.add("element", element); JsonArray facets = new JsonArray(); cells.forEach(facets::add); resultEntry.add("facets", facets); result.add(resultEntry); }); return GSON.toJson(result); }

Target:
public String search(@PathVariable String geneId) { JsonObject resultObject = new JsonObject(); JsonArray results = new JsonArray(); Map<String, List<String>> cellIds = geneSearchService.getCellIdsInExperiments(geneId); if(!cellIds.isEmpty()) { List<String> allCellIds = cellIds .values() .stream() .flatMap(List::stream) .collect(Collectors.toList()); Map<String, Map<String, List<String>>> factorFacets = geneSearchService.getFacets(allCellIds); Map<String, Map<Integer, List<Integer>>> markerGeneFacets = geneSearchService.getMarkerGeneProfile(geneId); cellIds.forEach((experimentAccession, cells) -> { JsonObject resultEntry = new JsonObject(); JsonObject experimentAttributes = GSON.toJsonTree(geneSearchService.getExperimentInformation(experimentAccession)).getAsJsonObject(); JsonArray facetsJson = convertFacetModel(factorFacets.getOrDefault(experimentAccession, new HashMap<>())); if(markerGeneFacets.containsKey(experimentAccession)) { facetsJson.add(facetValueObject("Marker genes", "Experiments with marker genes")); experimentAttributes.add("markerGenes", convertMarkerGeneModel(experimentAccession, geneId, markerGeneFacets.get(experimentAccession))); } experimentAttributes.addProperty("url", createExperimentPageURL(experimentAccession, geneId)); resultEntry.add("element", experimentAttributes); resultEntry.add("facets", facetsJson); results.add(resultEntry); }); } resultObject.add("results", results); JsonArray checkboxes = new JsonArray(); checkboxes.add("Marker genes"); resultObject.add("checkboxFacetGroups", checkboxes); return GSON.toJson(resultObject); }
Source:
public void cannotSpecifyZeroServersIfUsingLockBlock() { assertThatThrownBy(() -> ImmutableAtlasDbConfig.builder() .keyValueService(KVS_CONFIG_WITHOUT_NAMESPACE) .namespace(CLIENT_NAMESPACE) .timestamp(DEFAULT_SERVER_LIST) .lock(ImmutableServerListConfig.builder().build()) .build()).isInstanceOf(IllegalStateException.class); }

Target:
public void cannotSpecifyZeroServersIfUsingLockBlock() { assertThatThrownBy(() -> ImmutableAtlasDbConfig.builder() .keyValueService(KVS_CONFIG_WITHOUT_NAMESPACE) .namespace(CLIENT_NAMESPACE) .timestamp(SINGLETON_SERVER_LIST) .lock(ImmutableServerListConfig.builder().build()) .build()).isInstanceOf(IllegalStateException.class); }
Source:
public Config generateConfig() { Map<String, String> configs = new HashMap<>(); configs.put(JobConfig.JOB_NAME(), jobName); List<String> inputs = inEdges.stream().map(edge -> edge.getFormattedSystemStream()).collect(Collectors.toList()); configs.put(TaskConfig.INPUT_STREAMS(), Joiner.on(',').join(inputs)); log.info("Job has generated configs {}", jobName, configs); String configPrefix = String.format(CONFIG_PROCESSOR_PREFIX, jobName); return Util.rewriteConfig(extractScopedConfig(config, new MapConfig(configs), configPrefix)); }

Target:
public Config generateConfig() { Map<String, String> configs = new HashMap<>(); configs.put(JobConfig.JOB_NAME(), jobName); List<String> inputs = inEdges.stream().map(edge -> edge.getFormattedSystemStream()).collect(Collectors.toList()); configs.put(TaskConfig.INPUT_STREAMS(), Joiner.on(',').join(inputs)); log.info("Job has generated configs {}", jobName, configs); String configPrefix = String.format(CONFIG_JOB_PREFIX, jobName); return Util.rewriteConfig(extractScopedConfig(config, new MapConfig(configs), configPrefix)); }
Source:
public void askForAudio(Controller controller, final FileChooserListener listener) { Gdx.input.getTextInput(new TextInputListener() { @Override public void input(String text) { listener.fileChosen(text, null); } @Override public void canceled() { } }, "File path!", "", ""); }

Target:
public void askForAudio(Controller controller, final FileChooserListener listener) { Gdx.input.getTextInput(new TextInputListener() { @Override public void input(String text) { listener.fileChosen(text, FileChooserListener.Result.SUCCESS); } @Override public void canceled() { } }, "File path!", "", ""); }
Source:
private int getLayoutId(final IPerson person, final IUserProfile profile) { final Hashtable<Integer, UserProfile> profiles = this.getUserProfileList(person); int layoutId = profile.getLayoutId(); List<Integer> layoutIds = getAllNonZeroLayoutIdsFromProfiles(profiles); if (layoutIds.size() > 0) { layoutId = layoutIds.get(0); } if (layoutIds.size() > 1) { log.warn(String.format(UNSUPPORTED_MULTIPLE_LAYOUTS_FOUND, person.getID(), person.getID())); } return layoutId; }

Target:
private int getLayoutId(final IPerson person, final IUserProfile profile) { final Hashtable<Integer, UserProfile> profiles = this.getUserProfileList(person); int layoutId = profile.getLayoutId(); Set<Integer> layoutIds = getAllNonZeroLayoutIdsFromProfiles(profiles.values()); if (!layoutIds.isEmpty()) { layoutId = layoutIds.iterator().next(); } if (layoutIds.size() > 1) { logger.error(UNSUPPORTED_MULTIPLE_LAYOUTS_FOUND, person.getID() ); } return layoutId; }
Source:
public boolean initialized() { return initialized && store.initialized(); }

Target:
public boolean initialized() { return initialized.get(); }
Source:
public void propertyChange(PropertyChangeEvent event) { if (event.getOldValue() != event.getNewValue()) { if (event.getPropertyName().equals(RenderingConfig.NORMAL_MAPPING)) { isNormalMapping = renderingConfig.isNormalMapping(); if (isNormalMapping) { addDesiredStateChange(setNormalTerrain); if (isParallaxMapping) { addDesiredStateChange(setHeightTerrain); } } else { removeDesiredStateChange(setNormalTerrain); if (isParallaxMapping) { removeDesiredStateChange(setHeightTerrain); } } } else { isParallaxMapping = renderingConfig.isParallaxMapping(); if (isNormalMapping) { if (isParallaxMapping) { addDesiredStateChange(setHeightTerrain); } else { removeDesiredStateChange(setHeightTerrain); } } } worldRenderer.requestTaskListRefresh(); } }

Target:
public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName().equals(RenderingConfig.NORMAL_MAPPING)) { normalMappingIsEnabled = renderingConfig.isNormalMapping(); if (normalMappingIsEnabled) { addDesiredStateChange(setTerrainNormalsInputTexture); if (parallaxMappingIsEnabled) { addDesiredStateChange(setTerrainHeightInputTexture); } } else { removeDesiredStateChange(setTerrainNormalsInputTexture); if (parallaxMappingIsEnabled) { removeDesiredStateChange(setTerrainHeightInputTexture); } } } else if (event.getPropertyName().equals(RenderingConfig.PARALLAX_MAPPING)) { parallaxMappingIsEnabled = renderingConfig.isParallaxMapping(); if (normalMappingIsEnabled) { if (parallaxMappingIsEnabled) { addDesiredStateChange(setTerrainHeightInputTexture); } else { removeDesiredStateChange(setTerrainHeightInputTexture); } } } worldRenderer.requestTaskListRefresh(); }
Source:
public void selectPinType() { waitForElementByElement(pinCategorySelector); Select pinCategorySelectorDropDown = new Select(pinCategorySelector); List<WebElement> pinCategoryList = pinCategorySelectorDropDown.getOptions(); pinCategoryList.get(1).click(); PageObjectLogging.log("selectPinType", "Pin type was choosed", true, driver); }

Target:
public void selectPinType() { waitForElementByElement(pinCategorySelector); Select pinCategorySelectorDropDown = new Select(pinCategorySelector); pinCategorySelectorDropDown.selectByIndex(1); PageObjectLogging.log("selectPinType", "Pin type was choosed", true, driver); }
Source:
public static <T> T handleAuthException(Supplier<T> function) { try { return function.get(); } catch (RuntimeException e) { if (ExceptionUtils.indexOfThrowable(e, AuthenticationException.class) != -1) { throw new ProviderAuthenticationFailedException(e); } else { throw e; } } }

Target:
public <T> T handleAuthException(Supplier<T> function) { try { return function.get(); } catch (RuntimeException e) { if (ExceptionUtils.indexOfThrowable(e, AuthenticationException.class) != -1) { throw new ProviderAuthenticationFailedException(e); } else { throw e; } } }
Source:
private static OperatingSystem mapOperatingSystem(VDS entity) { final OperatingSystem model = new OperatingSystem(); if (StringUtils.isNotBlank(entity.getHostOs())) { OS hostOs = OS.fromPackageVersionString(entity.getHostOs()); Version version = new Version(); if (hostOs.getVersion().getMajor() != org.ovirt.engine.core.compat.Version.VERSION_NOT_SET) { version.setMajor(hostOs.getVersion().getMajor()); } if (hostOs.getVersion().getMinor() != org.ovirt.engine.core.compat.Version.VERSION_NOT_SET) { version.setMinor(hostOs.getVersion().getMinor()); } if (hostOs.getVersion().getBuild() != org.ovirt.engine.core.compat.Version.VERSION_NOT_SET) { version.setBuild(hostOs.getVersion().getBuild()); } version.setFullVersion(hostOs.getFullVersion()); model.setVersion(version); model.setType(hostOs.getName()); } model.setCustomKernelCmdline(Objects.toString(entity.getCurrentKernelCmdline(), "")); model.setReportedKernelCmdline(entity.getKernelArgs()); return model; }

Target:
private static OperatingSystem mapOperatingSystem(VDS entity) { final OperatingSystem model = new OperatingSystem(); if (StringUtils.isNotBlank(entity.getHostOs())) { OS hostOs = OS.fromPackageVersionString(entity.getHostOs()); Version version = new Version(); if (hostOs.getVersion().getMajor() != VERSION_NOT_SET) { version.setMajor(hostOs.getVersion().getMajor()); } if (hostOs.getVersion().getMinor() != VERSION_NOT_SET) { version.setMinor(hostOs.getVersion().getMinor()); } if (hostOs.getVersion().getBuild() != VERSION_NOT_SET) { version.setBuild(hostOs.getVersion().getBuild()); } version.setFullVersion(hostOs.getFullVersion()); model.setVersion(version); model.setType(hostOs.getName()); } model.setCustomKernelCmdline(Objects.toString(entity.getCurrentKernelCmdline(), "")); model.setReportedKernelCmdline(entity.getKernelArgs()); return model; }
Source:
public void remoteControlGranted(RemoteControlGrantedEvent event) { synchronized(videoComponentMutex) { if(videoComponent != null) { DTMFHandler.enableSendingDTMFTone(false); videoComponent.addKeyListener(this); videoComponent.addMouseListener(this); videoComponent.addMouseMotionListener(this); } } }

Target:
public void remoteControlGranted(RemoteControlGrantedEvent event) { synchronized(videoComponentMutex) { if(videoComponent != null) { videoComponent.addKeyListener(this); videoComponent.addMouseListener(this); videoComponent.addMouseMotionListener(this); } if (callPeerRenderer != null) { callPeerRenderer.setDtmfToneEnabled(false); } } }
Source:
public List queryAuditRecords(String messageId, String relatesTo) { Session session = null; List<AuditRepositoryRecord> queryList = null; try { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); session = sessionFactory.openSession(); LOG.info("Getting Record for Audit Viewer "); Criteria queryCriteria = session.createCriteria(AuditRepositoryRecord.class); if (NullChecker.isNotNullish(messageId)) { queryCriteria.add(Restrictions.eq("messageId", messageId)); } if (NullChecker.isNotNullish(relatesTo)) { queryCriteria.add(Restrictions.eq("relatesTo", relatesTo)); } queryCriteria.setProjection(Projections.projectionList() .add(Projections.property("userId")) .add(Projections.property("eventType")) .add(Projections.property("eventId")) .add(Projections.property("outcome")) .add(Projections.property("eventTimestamp")) .add(Projections.property("remoteHcid")) .add(Projections.property("relatesTo")) .add(Projections.property("direction")) .add(Projections.property("id")) .add(Projections.property("messageId"))); queryList = queryCriteria.list(); } catch (HibernateException e) { LOG.error("Exception in AuditLog.get() occurred due to :" + e.getLocalizedMessage(), e); } finally { if (session != null) { session.flush(); session.close(); } } return queryList; }

Target:
public List queryAuditRecords(String messageId, String relatesTo) { Session session = null; List<AuditRepositoryRecord> queryList = null; try { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); session = sessionFactory.openSession(); LOG.info("Getting Record for Audit Viewer "); Criteria queryCriteria = session.createCriteria(AuditRepositoryRecord.class); if (NullChecker.isNotNullish(messageId)) { if (messageId.startsWith(NhincConstants.WS_SOAP_HEADER_MESSAGE_ID_PREFIX)) { queryCriteria.add(Restrictions.eq("messageId", messageId)); } else { queryCriteria.add(Restrictions.eq("messageId", NhincConstants.WS_SOAP_HEADER_MESSAGE_ID_PREFIX + messageId)); } } if (NullChecker.isNotNullish(relatesTo)) { queryCriteria.add(Restrictions.eq("relatesTo", relatesTo)); } queryList = setProjectionFields(queryCriteria).list(); } catch (HibernateException e) { LOG.error("Exception in AuditLog.get() occurred due to :" + e.getLocalizedMessage(), e); } finally { closeSession(session, false); } return queryList; }
Source:
public boolean matches(BlockStateData state, Wool data) throws InvalidBlockStateException { if (state.containsKey("color")) { DyeColor color = StateSerialization.getColor(state.get("color")); if (color == null) { throw new InvalidBlockStateException(data.getItemType(), state); } return data.getColor() == color; } return true; }

Target:
public boolean matches(BlockStateData state, Wool data) throws InvalidBlockStateException { if (state.contains("color")) { DyeColor color = StateSerialization.getColor(state.get("color")); if (color == null) { throw new InvalidBlockStateException(data.getItemType(), state); } return data.getColor() == color; } return true; }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); unpackIntent(getIntent()); if (savedInstanceState != null) { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } setContentView(R.layout.post_list_activity); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } mPostList = getPostListFragment(); showErrorDialogIfNeeded(getIntent().getExtras()); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); if (savedInstanceState != null) { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); mIsPage = savedInstanceState.getBoolean(EXTRA_VIEW_PAGES); } else if (getIntent() != null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); mIsPage = getIntent().getBooleanExtra(EXTRA_VIEW_PAGES, false); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } setContentView(R.layout.post_list_activity); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } mPostList = (PostsListFragment) getFragmentManager().findFragmentById(R.id.postList); showErrorDialogIfNeeded(getIntent().getExtras()); }
Source:
private void storeIfPresent(HttpHeaders headers, String name) { String value = headers.getFirst(Constants.APP_VERSION_HEADER); if (value != null) { storedHeaders.put(name, value); } }

Target:
private void storeIfPresent(HttpHeaders headers, String name) { String value = headers.getFirst(name); if (value != null) { storedHeaders.put(name, value); } }
Source:
public AggregatorFactory optimizeForSegment(PerSegmentQueryOptimizationContext optimizationContext) { if (filter instanceof IntervalDimFilter) { IntervalDimFilter intervalDimFilter = ((IntervalDimFilter) filter); if (intervalDimFilter.getExtractionFn() != null) { return this; } Interval segmentInterval = optimizationContext.getSegmentDescriptor().getInterval(); List<Interval> filterIntervals = intervalDimFilter.getIntervals(); List<Interval> excludedFilterIntervals = new ArrayList<>(); List<Interval> effectiveFilterIntervals = new ArrayList<>(); boolean segmentIsCovered = false; for (Interval filterInterval : filterIntervals) { Interval overlap = filterInterval.overlap(segmentInterval); if (overlap == null) { excludedFilterIntervals.add(filterInterval); continue; } if (overlap.equals(segmentInterval)) { segmentIsCovered = true; break; } else { effectiveFilterIntervals.add(overlap); } } if (segmentIsCovered) { return delegate; } if (excludedFilterIntervals.size() == filterIntervals.size()) { return new SuppressedAggregatorFactory(delegate); } return new FilteredAggregatorFactory( delegate, new IntervalDimFilter( intervalDimFilter.getDimension(), effectiveFilterIntervals, intervalDimFilter.getExtractionFn() ) ); } else { return this; } }

Target:
public AggregatorFactory optimizeForSegment(PerSegmentQueryOptimizationContext optimizationContext) { if (filter instanceof IntervalDimFilter) { IntervalDimFilter intervalDimFilter = ((IntervalDimFilter) filter); if (intervalDimFilter.getExtractionFn() != null) { return this; } if (!intervalDimFilter.getDimension().equals(Column.TIME_COLUMN_NAME)) { return this; } Interval segmentInterval = optimizationContext.getSegmentDescriptor().getInterval(); List<Interval> filterIntervals = intervalDimFilter.getIntervals(); List<Interval> excludedFilterIntervals = new ArrayList<>(); List<Interval> effectiveFilterIntervals = new ArrayList<>(); boolean segmentIsCovered = false; for (Interval filterInterval : filterIntervals) { Interval overlap = filterInterval.overlap(segmentInterval); if (overlap == null) { excludedFilterIntervals.add(filterInterval); continue; } if (overlap.equals(segmentInterval)) { segmentIsCovered = true; break; } else { effectiveFilterIntervals.add(overlap); } } if (segmentIsCovered) { return delegate; } if (excludedFilterIntervals.size() == filterIntervals.size()) { return new SuppressedAggregatorFactory(delegate); } return new FilteredAggregatorFactory( delegate, new IntervalDimFilter( intervalDimFilter.getDimension(), effectiveFilterIntervals, intervalDimFilter.getExtractionFn() ) ); } else { return this; } }
Source:
private boolean informStopActiveActions() { String activeActions = wrapEntriesInLiTags(control.getExtensionLoader().getActiveActions()); if (!activeActions.isEmpty()) { String message = MessageFormat .format(Constant.messages.getString("menu.file.session.activeactions"), activeActions); if (view.showConfirmDialog(message) != JOptionPane.OK_OPTION) { return false; } } return true; }

Target:
private boolean informStopActiveActions() { String activeActions = wrapEntriesInLiTags(control.getExtensionLoader().getActiveActions()); if (!activeActions.isEmpty()) { String message = Constant.messages.getString("menu.file.session.activeactions", activeActions); if (view.showConfirmDialog(message) != JOptionPane.OK_OPTION) { return false; } } return true; }
Source:
public void testMany() { WeightedDoubleReservoirSample reservoir = new WeightedDoubleReservoirSample(200); long streamLength = 1_000_000; for (int i = 0; i < streamLength; ++i) { assertEquals(reservoir.getTotalPopulationWeight(), (double) i); reservoir.add(i, 1.0); } double[] quantized = new double[4]; int count = 0; for (double sample : reservoir.getSamples()) { ++count; int index = (int) (4.0 * sample / (streamLength + 1)); ++quantized[index]; } assertEquals(count, 200, format("Number of samples should be full: got=%s, expected=%s", count, 200)); int expectedMin = 25; for (int i = 0; i < 4; ++i) { assertTrue(quantized[i] > expectedMin, format("Expected quantized[i] > got: i=%s, quantized=%s, got=%s", i, quantized[i], 35)); } }

Target:
public void testMany() { WeightedDoubleReservoirSample reservoir = new WeightedDoubleReservoirSample(200); long streamLength = 1_000_000; for (int i = 0; i < streamLength; ++i) { assertEquals(reservoir.getTotalPopulationWeight(), i, 0.0001); reservoir.add(i, 1.0); } double[] quantized = new double[4]; int count = 0; for (double sample : reservoir.getSamples()) { ++count; int index = (int) (4.0 * sample / (streamLength + 1)); ++quantized[index]; } assertEquals(count, 200, format("Number of samples should be full: got=%s, expected=%s", count, 200)); int expectedMin = 25; for (int i = 0; i < 4; ++i) { assertTrue(quantized[i] > expectedMin, format("Expected quantized[i] > got: i=%s, quantized=%s, got=%s", i, quantized[i], 35)); } }
Source:
public void execute(String[] args, ConsoleReader reader) throws Exception { ApplicationReport appReport = currentApp; String target = args[1]; String logLevel = args[2]; StramAgent.StramUriSpec uriSpec = new StramAgent.StramUriSpec(); uriSpec = uriSpec.path(StramWebServices.PATH_LOGGERS); final JSONObject request = buildRequest(target, logLevel); JSONObject response = getResource(uriSpec, appReport, new WebServicesClient.WebServicesHandler<JSONObject>() { @Override public JSONObject process(WebResource.Builder webResource, Class<JSONObject> clazz) { return webResource.accept(MediaType.APPLICATION_JSON).post(JSONObject.class, request); } }); System.out.println(response); }

Target:
public void execute(String[] args, ConsoleReader reader) throws Exception { ApplicationReport appReport = currentApp; String target = args[1]; String logLevel = args[2]; StramAgent.StramUriSpec uriSpec = new StramAgent.StramUriSpec(); uriSpec = uriSpec.path(StramWebServices.PATH_LOGGERS); final JSONObject request = buildRequest(target, logLevel); JSONObject response = getResource(uriSpec, appReport, new WebServicesClient.WebServicesHandler<JSONObject>() { @Override public JSONObject process(WebResource.Builder webResource, Class<JSONObject> clazz) { return webResource.accept(MediaType.APPLICATION_JSON).post(JSONObject.class, request); } }); printJson(response); }
Source:
private Iterable<Contents> filterContents(final Iterable<Contents> contents, final Path outputPath) throws IOException { final Iterable<Path> localFiles = Utils.listObjectsForDirectory(outputPath); final HashMap<String, Path> mapLocalFiles = new HashMap<>(); for (final Path localFile : localFiles) { mapLocalFiles.put(Utils.getFileName(outputPath, localFile), localFile); } final ArrayList<Contents> filteredContents = new ArrayList<>(); for (final Contents content : contents) { final Path filePath = mapLocalFiles.get(content.getKey()); if (filePath == null) { filteredContents.add(content); } else if (SyncUtils.needToSync(filePath, content, false)) { LOG.info("Syncing new version of " + filePath.toString()); filteredContents.add(content); } else { LOG.info("No need to sync " + filePath.toString()); } } return filteredContents; }

Target:
private Iterable<Contents> filterContents(final Iterable<Contents> contents, final Path outputPath) throws IOException { final Iterable<Path> localFiles = Utils.listObjectsForDirectory(outputPath); final Map<String, Path> mapLocalFiles = new HashMap<>(); for (final Path localFile : localFiles) { mapLocalFiles.put(Utils.getFileName(outputPath, localFile), localFile); } final List<Contents> filteredContents = new ArrayList<>(); for (final Contents content : contents) { final Path filePath = mapLocalFiles.get(content.getKey()); if (filePath == null) { filteredContents.add(content); } else if (SyncUtils.isNewFile(filePath, content, false)) { LOG.info("Syncing new version of " + filePath.toString()); filteredContents.add(content); } else { LOG.info("No need to sync " + filePath.toString()); } } return filteredContents; }
Source:
public void setup() throws Exception { workspaceQueryMigration = new WorkspaceQueryMigration(catalogFramework, filterBuilder, xmlInputTransformer); workspaceQueryMigration.setSecurity(security); when(security.runAsAdmin(any(PrivilegedAction.class))).thenReturn(subject); doAnswer( new Answer<Void>() { public Void answer(InvocationOnMock invocation) { ((Runnable) invocation.getArgument(0)).run(); return null; } }) .when(subject) .execute(any(Runnable.class)); workspace = getWorkspaceMetacard(WORKSPACE_ID); doReturn(workspace).when(result).getMetacard(); doReturn(Collections.singletonList(result)).when(queryResponse).getResults(); workspace = getWorkspaceMetacard(WORKSPACE_ID); doReturn(workspace).when(result).getMetacard(); doReturn(queryResponse).when(catalogFramework).query(any(QueryRequest.class)); doReturn(new MetacardImpl()).when(xmlInputTransformer).transform(any(InputStream.class)); Metacard query1 = getQueryMetacard("queryId1"); Metacard query2 = getQueryMetacard("queryId2"); CreateResponse createResponse = mock(CreateResponse.class); doReturn(ImmutableList.of(query1, query2)).when(createResponse).getCreatedMetacards(); doReturn(createResponse).when(catalogFramework).create(any(CreateRequest.class)); }

Target:
public void setup() throws Exception { workspaceQueryMigration = new WorkspaceQueryMigration(catalogFramework, filterBuilder, xmlInputTransformer, security); when(security.runAsAdmin(any(PrivilegedAction.class))).thenReturn(subject); doAnswer( new Answer<Void>() { public Void answer(InvocationOnMock invocation) { ((Runnable) invocation.getArgument(0)).run(); return null; } }) .when(subject) .execute(any(Runnable.class)); workspace = getWorkspaceMetacard(WORKSPACE_ID); doReturn(workspace).when(result).getMetacard(); doReturn(Collections.singletonList(result)).when(queryResponse).getResults(); doReturn(queryResponse).when(catalogFramework).query(any(QueryRequest.class)); doReturn(new MetacardImpl()).when(xmlInputTransformer).transform(any(InputStream.class)); Metacard query1 = getQueryMetacard("queryId1"); Metacard query2 = getQueryMetacard("queryId2"); CreateResponse createResponse = mock(CreateResponse.class); doReturn(ImmutableList.of(query1, query2)).when(createResponse).getCreatedMetacards(); doReturn(createResponse).when(catalogFramework).create(any(CreateRequest.class)); }
Source:
public void unindexMarkers(final IResource resource) { if(resource == null) { return; } try { Logger.debugIndexing("Unindexing markers on after removal...", resource.getFullPath()); final Term elementTypeTerm = LuceneDocumentFactory.getMarkerTypeTerm(); final Term resourcePathTerm = LuceneDocumentFactory.getResourcePathTerm(resource); final BooleanQuery deleteResourceMarkersQuery = new BooleanQuery(); deleteResourceMarkersQuery.add(new BooleanClause(new TermQuery(elementTypeTerm), Occur.MUST)); deleteResourceMarkersQuery.add(new BooleanClause(new TermQuery(resourcePathTerm), Occur.MUST)); indexWriter.deleteDocuments(deleteResourceMarkersQuery); indexWriter.commit(); } catch (Exception e) { Logger.error("Failed to unindex the Resource " + resource.getFullPath(), e); } finally { Logger.traceIndexing("Done unindexing {}.", resource.getFullPath()); } }

Target:
public void unindexMarkers(final IResource resource) { if(resource == null) { return; } try { Logger.debugIndexing("Unindexing markers on after removal...", resource.getFullPath()); final Term elementTypeTerm = LuceneDocumentFactory.getMarkerTypeTerm(); final Term resourcePathTerm = LuceneDocumentFactory.getResourcePathTerm(resource); final BooleanQuery deleteResourceMarkersQuery = new BooleanQuery(); deleteResourceMarkersQuery.add(new BooleanClause(new TermQuery(elementTypeTerm), Occur.MUST)); deleteResourceMarkersQuery.add(new BooleanClause(new TermQuery(resourcePathTerm), Occur.MUST)); indexWriter.deleteDocuments(deleteResourceMarkersQuery); indexWriter.commit(); } catch (IOException e) { Logger.error("Failed to unindex the Resource " + resource.getFullPath(), e); } finally { Logger.traceIndexing("Done unindexing {}.", resource.getFullPath()); } }
Source:
protected void handlePropertyChangeEvent(PropertyChangeEvent event) { String key = event.getProperty(); if (key.equals(UNMERGEABLE_DIFF_COLOR_THEME_KEY) || key.equals(REQUIRED_DIFF_COLOR_THEME_KEY) || key.equals(INCOMING_CHANGE_COLOR_THEME_KEY) || key.equals(CONFLICTING_CHANGE_COLOR_THEME_KEY) || key.equals(OUTGOING_CHANGE_COLOR_THEME_KEY) || key.equals(RESOLVED_CHANGE_COLOR_THEME_KEY)) { updateColors(); } }

Target:
protected void handlePropertyChangeEvent(PropertyChangeEvent event) { String propertyKey = event.getProperty(); ColorChangeEvent colorEvent = new ColorChangeEvent(); if (propertyKey.equals(UNMERGEABLE_DIFF_COLOR_THEME_KEY)) { changeUnmergeableColor(colorEvent); } else if (propertyKey.equals(INCOMING_CHANGE_COLOR_THEME_KEY)) { changeIncomingColor(colorEvent); } else if (propertyKey.equals(REQUIRED_DIFF_COLOR_THEME_KEY)) { changeRequiredColor(colorEvent); } else if (propertyKey.equals(CONFLICTING_CHANGE_COLOR_THEME_KEY)) { changeConflictingColor(colorEvent); } else if (propertyKey.equals(OUTGOING_CHANGE_COLOR_THEME_KEY)) { changeOutgoingColor(colorEvent); } if (colorEvent.isAffectingEvent()) { if (eventBus != null) { eventBus.post(colorEvent); } } }
Source:
private static GroupsRequest toGroupsRequest(Request request) { return GroupsRequest.builder() .setLogin(request.mandatoryParam(PARAM_LOGIN)) .setOrganization(request.param(PARAM_ORGANIZATION)) .setSelected(request.mandatoryParam(SELECTED)) .setQuery(request.param(TEXT_QUERY)) .setPage(request.mandatoryParamAsInt(PAGE)) .setPageSize(request.mandatoryParamAsInt(PAGE_SIZE)) .build(); }

Target:
private static GroupsRequest toGroupsRequest(Request request) { int pageSize = request.mandatoryParamAsInt(PAGE_SIZE); checkArgument(pageSize <= MAX_PAGE_SIZE, "The '%s' parameter must be less than %s", PAGE_SIZE, MAX_PAGE_SIZE); return GroupsRequest.builder() .setLogin(request.mandatoryParam(PARAM_LOGIN)) .setOrganization(request.param(PARAM_ORGANIZATION)) .setSelected(request.mandatoryParam(SELECTED)) .setQuery(request.param(TEXT_QUERY)) .setPage(request.mandatoryParamAsInt(PAGE)) .setPageSize(pageSize) .build(); }
Source:
public void checkIfCanBeExecutedOnChannel(Channel channel) throws IOException { super.checkIfCanBeExecutedOnChannel(channel); if (channel.isClosingOrClosed()) { throw new IOException("The request cannot be executed on channel " + channel + ". The channel is closing down or has closed down"); } }

Target:
public void checkIfCanBeExecutedOnChannel(Channel channel) throws IOException { super.checkIfCanBeExecutedOnChannel(channel); if (channel.isClosingOrClosed()) { throw new ChannelClosedException("The request cannot be executed on channel " + channel + ". " + "The channel is closing down or has closed down", channel.getCloseRequestCause()); } }
Source:
public ListenableFuture<Boolean> update(final LabelMeta meta) { return transform(getLabelMeta(meta.type(), meta.identifier()), new AsyncFunction<Optional<LabelMeta>, Boolean>() { @Override public ListenableFuture<Boolean> apply(final Optional<LabelMeta> storedMeta) throws Exception { if (!storedMeta.isPresent()) { LOG.debug("{} was not found.", meta); return Futures.immediateFuture(Boolean.FALSE); } if (!storedMeta.get().equals(meta)) { return store.updateMeta(meta); } LOG.debug("{} does not have any changes, skipping update", meta); return Futures.immediateFuture(Boolean.FALSE); } }); }

Target:
public ListenableFuture<Boolean> update(final LabelMeta meta) { return transform(getLabelMeta(meta.type(), meta.identifier()), new AsyncFunction<Optional<LabelMeta>, Boolean>() { @Override public ListenableFuture<Boolean> apply(final Optional<LabelMeta> storedMeta) throws Exception { if (!storedMeta.isPresent()) { return store.updateMeta(meta); } if (!storedMeta.get().equals(meta)) { return store.updateMeta(meta); } LOG.debug("{} does not have any changes, skipping update", meta); return Futures.immediateFuture(Boolean.FALSE); } }); }
Source:
private void sendPower() { TileEntity tile = getTileBuffer(currentDirection).getTile(); if (tile == null) { return; } if (getClass() == tile.getClass()) { TileEngineBase_BC8 other = (TileEngineBase_BC8) tile; if (currentDirection == other.currentDirection) { other.power += extractPower(0, power, true); } return; } IMjReceiver receiver = getReceiverToPower(tile, currentDirection); if (receiver != null && mjConnector.canConnect(receiver) && receiver.canConnect(mjConnector)) { long extracted = getPowerToExtract(true); if (extracted > 0) { long excess = receiver.receivePower(extracted, false); extractPower(extracted - excess, extracted - excess, true); } } }

Target:
private void sendPower() { TileEntity tile = getTileBuffer(currentDirection).getTile(); if (tile == null) { return; } if (getClass() == tile.getClass()) { TileEngineBase_BC8 other = (TileEngineBase_BC8) tile; if (currentDirection == other.currentDirection) { other.power += extractPower(0, power, true); } return; } IMjReceiver receiver = getReceiverToPower(tile, currentDirection); if (receiver != null) { long extracted = getPowerToExtract(true); if (extracted > 0) { long excess = receiver.receivePower(extracted, false); extractPower(extracted - excess, extracted - excess, true); } } }
Source:
public synchronized BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException { TableName tableName = params.getTableName(); if (tableName == null) { throw new IllegalArgumentException("TableName cannot be null."); } long maxHeapSize = params.getWriteBufferSize(); if (maxHeapSize == BufferedMutatorParams.UNSET) { params.writeBufferSize(tableConfig.getWriteBufferSize()); maxHeapSize = params.getWriteBufferSize(); } int defaultRpcCount = AsyncExecutor.MAX_INFLIGHT_RPCS_DEFAULT * options.getChannelCount(); int maxInflightRpcs = conf.getInt(MAX_INFLIGHT_RPCS_KEY, defaultRpcCount); final long id = SEQUENCE_GENERATOR.incrementAndGet(); if (this.bufferedMutatorExecutorService == null) { this.bufferedMutatorExecutorService = BigtableBufferedMutator.createExecutorService(options); } BigtableBufferedMutator bigtableBufferedMutator = new BigtableBufferedMutator( session.getDataClient(), createAdapter(tableName), conf, options, params.getListener(), new HeapSizeManager(maxHeapSize, maxInflightRpcs)) { @Override public void close() throws IOException { try { super.close(); } finally { ACTIVE_BUFFERED_MUTATORS.remove(id); } } }; ACTIVE_BUFFERED_MUTATORS.put(id, bigtableBufferedMutator); return bigtableBufferedMutator; }

Target:
public synchronized BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException { TableName tableName = params.getTableName(); if (tableName == null) { throw new IllegalArgumentException("TableName cannot be null."); } long maxHeapSize = params.getWriteBufferSize(); if (maxHeapSize == BufferedMutatorParams.UNSET) { params.writeBufferSize(tableConfig.getWriteBufferSize()); maxHeapSize = params.getWriteBufferSize(); } int defaultRpcCount = AsyncExecutor.MAX_INFLIGHT_RPCS_DEFAULT * options.getChannelCount(); int maxInflightRpcs = conf.getInt(MAX_INFLIGHT_RPCS_KEY, defaultRpcCount); final long id = SEQUENCE_GENERATOR.incrementAndGet(); if (this.bufferedMutatorExecutorService == null && options.getAsyncMutatorCount() > 0) { bufferedMutatorExecutorService = Executors.newCachedThreadPool( new ThreadFactoryBuilder() .setNameFormat("BigtableBufferedMutator-worker-%s") .setDaemon(true) .build()); } BigtableBufferedMutator bigtableBufferedMutator = new BigtableBufferedMutator( session.getDataClient(), createAdapter(tableName), conf, options, params.getListener(), new HeapSizeManager(maxHeapSize, maxInflightRpcs), bufferedMutatorExecutorService) { @Override public void close() throws IOException { try { super.close(); } finally { ACTIVE_BUFFERED_MUTATORS.remove(id); } } }; ACTIVE_BUFFERED_MUTATORS.put(id, bigtableBufferedMutator); return bigtableBufferedMutator; }
Source:
public Iterable<UV> values() { Map<UK, UV> userMap = stateTable.get(currentNamespace); return userMap == null ? emptyState.values() : userMap.values(); }

Target:
public Iterable<UV> values() { Map<UK, UV> userMap = stateTable.get(currentNamespace); return userMap == null ? Collections.emptySet() : userMap.values(); }
Source:
public HiveBucketProperty toTableBucketProperty() { if (isVirtuallyBucketed(columns)) { return null; } return new HiveBucketProperty( columns.stream() .map(HiveColumnHandle::getName) .collect(toList()), tableBucketCount, ImmutableList.of()); }

Target:
public HiveBucketProperty toTableBucketProperty() { checkState(!isVirtuallyBucketed(), "Virtual bucket does not have table bucket property"); return new HiveBucketProperty( columns.stream() .map(HiveColumnHandle::getName) .collect(toList()), tableBucketCount, ImmutableList.of()); }
Source:
public static void main(String[] args) { if (args == null || args.length == 0) { printHelp(); } run(args); System.exit(0); }

Target:
public static void main(String[] args) { if (args == null || args.length == 0) { printHelpAndExit(); } if (Arrays.asList(args).contains("-h") || Arrays.asList(args).contains("--help")) { printHelpAndExit(); } run(args); System.exit(0); }
Source:
public @NonNull ProfileTypeUID getUID() { return profileTypeUID; }

Target:
public ProfileTypeUID getUID() { return profileTypeUID; }
Source:
public Optional<Closeable> acquireReferences() { Closer closer = Closer.create(); boolean acquireFailed = baseSegment.acquireReferences().map(closeable -> { closer.register(closeable); return false; }).orElse(true); for (JoinableClause claws : clauses) { if (acquireFailed) { break; } acquireFailed |= claws.acquireReferences().map(closeable -> { closer.register(closeable); return false; }).orElse(true); } if (acquireFailed) { CloseQuietly.close(closer); return Optional.empty(); } else { return Optional.of(closer); } }

Target:
public Optional<Closeable> acquireReferences() { Closer closer = Closer.create(); try { boolean acquireFailed = baseSegment.acquireReferences().map(closeable -> { closer.register(closeable); return false; }).orElse(true); for (JoinableClause joinClause : clauses) { if (acquireFailed) { break; } acquireFailed |= joinClause.acquireReferences().map(closeable -> { closer.register(closeable); return false; }).orElse(true); } if (acquireFailed) { CloseQuietly.close(closer); return Optional.empty(); } else { return Optional.of(closer); } } catch (Exception ex) { CloseQuietly.close(closer); return Optional.empty(); } }
Source:
private static String resolve(GoExpression argument) { if (argument instanceof GoStringLiteral) { return argument.getText(); } if (!(argument instanceof GoReferenceExpression)) { return null; } PsiReference resolved = argument.getReference(); if (resolved == null) { return null; } PsiElement element = resolved.resolve(); while (element != null && element.getReference() != null && element.getReference().resolve() != null) { resolved = element.getReference(); element = resolved.resolve(); } if (element == null) { return null; } if (element.getReference() != null) { resolved = element.getReference(); if (resolved instanceof GoVarReference) { if (resolved.getElement().getParent() instanceof GoShortVarDeclaration) { element = resolved.getElement(); GoShortVarDeclaration shortVarDeclaration = (GoShortVarDeclaration)resolved.getElement().getParent(); int varPosition = shortVarDeclaration.getVarDefinitionList().indexOf(element); return resolve(shortVarDeclaration.getExpressionList().get(varPosition)); } return ""; } } else if (element instanceof GoConstDefinition) { if (element.getParent() instanceof GoConstSpec) { GoConstSpec constSpec = (GoConstSpec)element.getParent(); int constPosition = constSpec.getConstDefinitionList().indexOf(element); return resolve(constSpec.getExpressionList().get(constPosition)); } return ""; } return null; }

Target:
private static String resolve(GoExpression argument) { if (argument instanceof GoStringLiteral) return argument.getText(); if (argument.getReference() == null) return null; PsiElement resolved = argument.getReference().resolve(); if (resolved instanceof GoVarDefinition) { return getValue(((GoVarDefinition)resolved).getValue()); } else if (resolved instanceof GoConstDefinition) { return getValue(((GoConstDefinition)resolved).getValue()); } return null; }
Source:
private void setPackageFilePath() throws IOException, MojoFailureException { validateIncludeAndPackageType(); String projectBuildDir = getPackageDirectory(); String projectBuildName = getPackageName(); packageFile = new File(projectBuildDir, projectBuildName + packageFileType.getFileExtension()); }

Target:
private void setPackageFilePath() throws IOException, MojoFailureException { setPackageFileType(); String projectBuildDir = getPackageDirectory(); String projectBuildName = getPackageName(); packageFile = new File(projectBuildDir, projectBuildName + "." + packageFileType.getValue()); }