auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock()) { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = getNetworkDao().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } return null; } }); if (vds.getHighlyAvailableIsConfigured()) { SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, false); if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { haMaintenanceFailed = true; } } } } logMonitorLockReleased("Activate"); }

Target:
protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock()) { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = getNetworkDao().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } return null; } }); if (vds.getHighlyAvailableIsConfigured()) { SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, false); if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { haMaintenanceFailed = true; } } if (vds.getVdsGroupSupportsGlusterService()) { runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")); } } } logMonitorLockReleased("Activate"); }
Source:
private boolean isWifiCallingAvailable() { if (mImsMmTelMgr != null) { return mImsMmTelMgr.isCapable(MmTelCapabilities.CAPABILITY_TYPE_VOICE, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN) || mImsMmTelMgr.isCapable(MmTelCapabilities.CAPABILITY_TYPE_VIDEO, ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN); } return false; }

Target:
private boolean isWifiCallingAvailable() { return (mImsRegisteredRadioTech == AccessNetworkConstants.TRANSPORT_TYPE_WLAN) && (mMmTelCapabilities.isCapable(MmTelCapabilities.CAPABILITY_TYPE_VOICE) || mMmTelCapabilities.isCapable(MmTelCapabilities.CAPABILITY_TYPE_VIDEO)); }
Source:
private static FactorComparator<Executor> getLstDispatchedTimeComparator(int weight){ return FactorComparator.create(LSTDISPATCHED_COMPARATOR_NAME, weight, new Comparator<Executor>(){ @Override public int compare(Executor o1, Executor o2) { Statistics stat1 = o1.getExecutorStats(); Statistics stat2 = o2.getExecutorStats(); Integer result = 0; if (statisticsObjectCheck(stat1,stat2,LSTDISPATCHED_COMPARATOR_NAME,result)){ return result; } if (null == stat1.getLastDispatchedTime() && null == stat1.getLastDispatchedTime()){ logger.info(String.format("%s : stats from both side doesn't contain last dispatched time info.", LSTDISPATCHED_COMPARATOR_NAME)); return 0; } if (null == stat2.getLastDispatchedTime()){ logger.info(String.format("%s : choosing left side as right doesn't contain last dispatched time info.", LSTDISPATCHED_COMPARATOR_NAME)); return 1; } if (null == stat1.getLastDispatchedTime()){ logger.info(String.format("%s : choosing right side as left doesn't contain last dispatched time info.", LSTDISPATCHED_COMPARATOR_NAME)); return -1; } return ((Date)stat2.getLastDispatchedTime()).compareTo(stat1.getLastDispatchedTime()); }}); }

Target:
private static FactorComparator<Executor> getLstDispatchedTimeComparator(int weight){ return FactorComparator.create(LSTDISPATCHED_COMPARATOR_NAME, weight, new Comparator<Executor>(){ @Override public int compare(Executor o1, Executor o2) { ExecutorInfo stat1 = o1.getExecutorInfo(); ExecutorInfo stat2 = o2.getExecutorInfo(); int result = 0; if (statisticsObjectCheck(stat1,stat2,LSTDISPATCHED_COMPARATOR_NAME,result)){ return result; } return ((Long)stat2.getLastDispatchedTime()).compareTo(stat1.getLastDispatchedTime()); }}); }
Source:
public String getDescription() { return "Input Library " + inputLibrary.getInputVDir().getLocation().getDescription(); }

Target:
public String getDescription() { return "library " + inputLibrary.getInputVDir().getLocation().getDescription(); }
Source:
protected void tick(Block block, boolean craftLast) { if (!craftLast) { if (BlockStorage.getLocationInfo(block.getLocation(), "enabled").equals("false")) return; } if (ChargableBlock.getCharge(block) < getEnergyConsumption()) return; String input = getSerializedInput(block, craftLast); testInputAgainstRecipes(block, input); }

Target:
protected void tick(Block block, boolean craftLast) { if (!craftLast && BlockStorage.getLocationInfo(block.getLocation(), "enabled").equals("false")) return; if (ChargableBlock.getCharge(block) < getEnergyConsumption()) return; String input = getSerializedInput(block, craftLast); testInputAgainstRecipes(block, input); }
Source:
public void testMappingOneWay() { final AdministrativeStatusType type1 = AdministrativeStatusType.UNDEFINED; final AdministrativeStatusType type2 = AdministrativeStatusType.OFF; final AdministrativeStatusType type3 = AdministrativeStatusType.ON; final com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType type1Mapped = this.mapperFactory .getMapperFacade() .map(type1, com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.class); final com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType type2Mapped = this.mapperFactory .getMapperFacade() .map(type2, com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.class); final com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType type3Mapped = this.mapperFactory .getMapperFacade() .map(type3, com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.class); assertNotNull(type1Mapped); assertNotNull(type2Mapped); assertNotNull(type3Mapped); assertEquals(type1.value(), type1Mapped.value()); assertEquals(type2.value(), type2Mapped.value()); assertEquals(type3.value(), type3Mapped.value()); }

Target:
public void testMappingOneWay() { final com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType undefined = this.configurationMapper .map(AdministrativeStatusType.UNDEFINED, com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.class); final com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType off = this.configurationMapper .map(AdministrativeStatusType.OFF, com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.class); final com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType on = this.configurationMapper .map(AdministrativeStatusType.ON, com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType.class); assertNotNull(undefined); assertNotNull(off); assertNotNull(on); assertEquals(AdministrativeStatusType.UNDEFINED.value(), undefined.value()); assertEquals(AdministrativeStatusType.OFF.value(), off.value()); assertEquals(AdministrativeStatusType.ON.value(), on.value()); }
Source:
private Locale determineLocale(final HttpServletRequest request) { Locale locale = LocaleUtils.getLocaleFromString(request.getParameter(LOCALE)); if (null == locale) { locale = getLocaleFromCookies(request.getCookies()); } if (null == locale) { locale = request.getLocale(); } if (null == locale) { locale = Locale.US; } log.debug("Filter determined locale to be: " + locale.toLanguageTag()); return locale; }

Target:
private Locale determineLocale(final HttpServletRequest request) { Locale locale = LocaleUtils.getLocaleFromString(request.getParameter(LOCALE)); if (locale == null) { locale = getLocaleFromCookies(request.getCookies()); } if (locale == null) { locale = request.getLocale(); } if (locale == null) { locale = Locale.US; } log.debug("Filter determined locale to be: " + locale.toLanguageTag()); return locale; }
Source:
boolean contains(int x, int y) { return false; }

Target:
boolean contains(int x, int y) { StyledText styledText= getTextWidget(); GC gc= null; try { gc= new GC(styledText); return x >= fX && y >= fY && y <= fY + styledText.getLineHeight(position.getOffset()) && x <= fX + gc.stringExtent(getText()).x + 2 * gc.getFontMetrics().getAverageCharacterWidth(); } finally { if (gc != null) { gc.dispose(); } } }
Source:
public int bitIndex(final String key, final int offsetInBits, final int lengthInBits, final String other, final int otherOffsetInBits, final int otherLengthInBits) { boolean allNull = true; if (offsetInBits % LENGTH != 0 || otherOffsetInBits % LENGTH != 0 || lengthInBits % LENGTH != 0 || otherLengthInBits % LENGTH != 0) { throw new IllegalArgumentException("The offsets and lengths must be at Character boundaries"); } final int beginIndex1 = offsetInBits / LENGTH; final int beginIndex2 = otherOffsetInBits / LENGTH; final int endIndex1 = beginIndex1 + lengthInBits / LENGTH; final int endIndex2 = beginIndex2 + otherLengthInBits / LENGTH; final int length = Math.max(endIndex1, endIndex2); char k = 0, f = 0; for(int i = 0; i < length; i++) { final int index1 = beginIndex1 + i; final int index2 = beginIndex2 + i; if (index1 >= endIndex1) { k = 0; } else { k = key.charAt(index1); if (k == 0) { throw new IllegalArgumentException("Don't support '\\u0000' in the key."); } } if (other == null || index2 >= endIndex2) { f = 0; } else { f = other.charAt(index2); } if (k != f) { final int x = k ^ f; return i * LENGTH + Integer.numberOfLeadingZeros(x) - LENGTH; } if (k != 0) { allNull = false; } } if (allNull) { return KeyAnalyzer.NULL_BIT_KEY; } return KeyAnalyzer.EQUAL_BIT_KEY; }

Target:
public int bitIndex(final String key, final int offsetInBits, final int lengthInBits, final String other, final int otherOffsetInBits, final int otherLengthInBits) { boolean allNull = true; if (offsetInBits % LENGTH != 0 || otherOffsetInBits % LENGTH != 0 || lengthInBits % LENGTH != 0 || otherLengthInBits % LENGTH != 0) { throw new IllegalArgumentException("The offsets and lengths must be at Character boundaries"); } final int beginIndex1 = offsetInBits / LENGTH; final int beginIndex2 = otherOffsetInBits / LENGTH; final int endIndex1 = beginIndex1 + lengthInBits / LENGTH; final int endIndex2 = beginIndex2 + otherLengthInBits / LENGTH; final int length = Math.max(endIndex1, endIndex2); char k = 0, f = 0; for(int i = 0; i < length; i++) { final int index1 = beginIndex1 + i; final int index2 = beginIndex2 + i; if (index1 >= endIndex1) { k = 0; } else { k = key.charAt(index1); if (k == 0) { throw new IllegalArgumentException("Character '\\u0000' is not supported in the key."); } } if (other == null || index2 >= endIndex2) { f = 0; } else { f = other.charAt(index2); } if (k != f) { final int x = k ^ f; return i * LENGTH + Integer.numberOfLeadingZeros(x) - LENGTH; } if (k != 0) { allNull = false; } } if (allNull) { return KeyAnalyzer.NULL_BIT_KEY; } return KeyAnalyzer.EQUAL_BIT_KEY; }
Source:
public static Boolean getBoolean(String val) { if (val == null || val.trim().length() == 0) { return false; } try { return Boolean.valueOf(val); } catch (IllegalArgumentException e) { return false; } }

Target:
public static Boolean getBoolean(String val) { return Boolean.valueOf(val); }
Source:
protected static String getPath(String uri) { String path = null; int index = uri.indexOf(':'); if (index != -1) { index = uri.indexOf(':', index + 1); if (index != -1) { path = uri.substring(index + 1); index = path.indexOf('?'); if (index != -1) { path = path.substring(0, index); } path = path.replaceAll(":", ""); try { path = URLDecoder.decode(path, "UTF-8"); } catch (UnsupportedEncodingException e) { LOG.error("Failed to decode URL path '" + path + "'", e); } } } return path; }

Target:
protected static String getPath(String uri) { String path = null; int index = uri.indexOf(':'); if (index != -1) { index = uri.indexOf(':', index + 1); if (index != -1) { path = uri.substring(index + 1); index = path.indexOf('?'); if (index != -1) { path = path.substring(0, index); } path = path.replaceAll(":", ""); try { path = URLDecoder.decode(path, "UTF-8"); } catch (UnsupportedEncodingException e) { LOG.debug("Failed to decode URL path '" + path + "', ignoring exception", e); } } } return path; }
Source:
public SyncSpanningTree(String rootNode) { this(); setRootNode(rootNode); }

Target:
public SyncSpanningTree(String rootNode) { this(); fRootNode = rootNode; }
Source:
public RibbonResponse execute(final RibbonRequest request, IClientConfig configOverride) throws IOException { final Request.Options options; if (configOverride != null) { options = new Request.Options( configOverride.get(CommonClientConfigKey.ConnectTimeout, this.connectTimeout), (configOverride.get(CommonClientConfigKey.ReadTimeout, this.readTimeout))); } else { options = new Request.Options(this.connectTimeout, this.readTimeout); } LoadBalancedRetryPolicy retryPolicy = loadBalancedRetryPolicyFactory.create(this.getClientName(), this); retryTemplate.setRetryPolicy(retryPolicy == null ? new NeverRetryPolicy() : new InterceptorRetryPolicy(request.toHttpRequest(), retryPolicy, this, this.getClientName())); return retryTemplate.execute(new RetryCallback<RibbonResponse, IOException>() { @Override public RibbonResponse doWithRetry(RetryContext retryContext) throws IOException { Request feignRequest = null; if(retryContext instanceof LoadBalancedRetryContext) { ServiceInstance service = ((LoadBalancedRetryContext)retryContext).getServiceInstance(); if(service != null) { feignRequest = ((RibbonRequest)request.replaceUri(reconstructURIWithServer(new Server(service.getHost(), service.getPort()), request.getUri()))).toRequest(); } } if(feignRequest == null) { feignRequest = request.toRequest(); } Response response = request.client().execute(feignRequest, options); return new RibbonResponse(request.getUri(), response); } }); }

Target:
public RibbonResponse execute(final RibbonRequest request, IClientConfig configOverride) throws IOException { final Request.Options options; if (configOverride != null) { options = new Request.Options( configOverride.get(CommonClientConfigKey.ConnectTimeout, this.connectTimeout), (configOverride.get(CommonClientConfigKey.ReadTimeout, this.readTimeout))); } else { options = new Request.Options(this.connectTimeout, this.readTimeout); } LoadBalancedRetryPolicy retryPolicy = loadBalancedRetryPolicyFactory.create(this.getClientName(), this); RetryTemplate retryTemplate = new RetryTemplate(); retryTemplate.setRetryPolicy(retryPolicy == null ? new NeverRetryPolicy() : new FeignRetryPolicy(request.toHttpRequest(), retryPolicy, this, this.getClientName())); return retryTemplate.execute(new RetryCallback<RibbonResponse, IOException>() { @Override public RibbonResponse doWithRetry(RetryContext retryContext) throws IOException { Request feignRequest = null; if(retryContext instanceof LoadBalancedRetryContext) { ServiceInstance service = ((LoadBalancedRetryContext)retryContext).getServiceInstance(); if(service != null) { feignRequest = ((RibbonRequest)request.replaceUri(reconstructURIWithServer(new Server(service.getHost(), service.getPort()), request.getUri()))).toRequest(); } } if(feignRequest == null) { feignRequest = request.toRequest(); } Response response = request.client().execute(feignRequest, options); return new RibbonResponse(request.getUri(), response); } }); }
Source:
public void transform(StructuredRecord structuredRecord, Emitter<KeyValue<Text, Text>> emitter) throws Exception { batchConfig.validateKeyField(structuredRecord.getSchema()); batchConfig.validateInputFieldsDataType(structuredRecord.getSchema()); if (structuredRecord.get(batchConfig.getKeyField()) == null) { return; } emitter.emit(new KeyValue<Text, Text>(new Text(GSON.toJson(structuredRecord.getSchema(), SCHEMA_TYPE)), new Text(StructuredRecordStringConverter.toJsonString(structuredRecord)))); }

Target:
public void transform(StructuredRecord structuredRecord, Emitter<KeyValue<Text, Text>> emitter) throws Exception { Schema recordSchema = structuredRecord.getSchema(); batchConfig.validateKeyField(recordSchema); batchConfig.validateInputFieldsDataType(recordSchema); if (structuredRecord.get(batchConfig.getKeyField()) == null) { metrics.count("invalid", 1); return; } emitter.emit(new KeyValue<Text, Text>((new Text(GSON.toJson(recordSchema, SCHEMA_TYPE))), new Text(StructuredRecordStringConverter.toJsonString(structuredRecord)))); }
Source:
public VideoFrameReleaseTimeHelper(Context context) { this(getDefaultDisplayRefreshRate(context)); this.context = context; registerDisplayListener(); }

Target:
public VideoFrameReleaseTimeHelper(Context context) { this.context = context.getApplicationContext(); defaultDisplayListener = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ? new DefaultDisplayListener(context) : null; useDefaultDisplayVsync = true; vsyncSampler = VSyncSampler.getInstance(); }
Source:
private static ByteRange buildByteRange(String rangeHeaderValue) throws RestServiceException { if (!rangeHeaderValue.startsWith(BYTE_RANGE_PREFIX)) { throw new RestServiceException("Invalid byte range syntax; does not start with '" + BYTE_RANGE_PREFIX + "'", RestServiceErrorCode.InvalidArgs); } try { int hyphenIndex = rangeHeaderValue.indexOf('-', BYTE_RANGE_PREFIX.length()); String startOffsetStr = rangeHeaderValue.substring(BYTE_RANGE_PREFIX.length(), hyphenIndex); String endOffsetStr = rangeHeaderValue.substring(hyphenIndex + 1); if (startOffsetStr.isEmpty()) { return ByteRange.fromLastNBytes(Long.parseLong(endOffsetStr)); } else if (endOffsetStr.isEmpty()) { return ByteRange.fromStartOffset(Long.parseLong(startOffsetStr)); } else { return ByteRange.fromOffsetRange(Long.parseLong(startOffsetStr), Long.parseLong(endOffsetStr)); } } catch (Exception e) { throw new RestServiceException( "Valid byte range could not be parsed from Range header value: " + rangeHeaderValue, RestServiceErrorCode.InvalidArgs); } }

Target:
private static ByteRange buildByteRange(String rangeHeaderValue) throws RestServiceException { if (!rangeHeaderValue.startsWith(BYTE_RANGE_PREFIX)) { throw new RestServiceException("Invalid byte range syntax; does not start with '" + BYTE_RANGE_PREFIX + "'", RestServiceErrorCode.InvalidArgs); } ByteRange range; try { int hyphenIndex = rangeHeaderValue.indexOf('-', BYTE_RANGE_PREFIX.length()); String startOffsetStr = rangeHeaderValue.substring(BYTE_RANGE_PREFIX.length(), hyphenIndex); String endOffsetStr = rangeHeaderValue.substring(hyphenIndex + 1); if (startOffsetStr.isEmpty()) { range = ByteRange.fromLastNBytes(Long.parseLong(endOffsetStr)); } else if (endOffsetStr.isEmpty()) { range = ByteRange.fromStartOffset(Long.parseLong(startOffsetStr)); } else { range = ByteRange.fromOffsetRange(Long.parseLong(startOffsetStr), Long.parseLong(endOffsetStr)); } } catch (Exception e) { throw new RestServiceException( "Valid byte range could not be parsed from Range header value: " + rangeHeaderValue, RestServiceErrorCode.InvalidArgs); } return range; }
Source:
private static List<Method> getDefaultMethods(Class<?> clazz) { List<Method> result = null; for (Class<?> ifc : clazz.getInterfaces()) { for (Method ifcMethod : ifc.getMethods()) { if (!Modifier.isAbstract(ifcMethod.getModifiers())) { if (result == null) { result = new LinkedList<Method>(); } result.add(ifcMethod); } } } return result; }

Target:
private static List<Method> getDefaultMethods(Class<?> clazz) { List<Method> result = new LinkedList<Method>(); for (Class<?> ifc : clazz.getInterfaces()) { for (Method ifcMethod : ifc.getMethods()) { if (!Modifier.isAbstract(ifcMethod.getModifiers())) { result.add(ifcMethod); } } } return result; }
Source:
protected void executeQueryCommand() { switch (getParameters().getOsRepositoryVerb()) { case GetOsNames: setReturnValue(osRepository.getOsNames()); break; case GetUniqueOsNames: setReturnValue(osRepository.getUniqueOsNames()); break; case GetOsIds: setReturnValue(osRepository.getOsIds()); break; case GetLinuxOss: setReturnValue(osRepository.getLinuxOss()); break; case GetWindowsOss: setReturnValue(osRepository.getWindowsOss()); break; case GetMaxOsRam: setReturnValue(osRepository.getMaximumRam(getParameters().getOsId(), getParameters().getVersion())); break; case GetMinimumOsRam: setReturnValue(osRepository.getMinimumRam(getParameters().getOsId(), getParameters().getVersion())); break; case HasSpiceSupportMatrix: setReturnValue(osRepository.spiceSupportMatrix()); break; case GetNetworkDevices: setReturnValue(osRepository.getNetworkDevices(getParameters().getOsId(), getParameters().getVersion())); break; } }

Target:
protected void executeQueryCommand() { switch (getParameters().getOsRepositoryVerb()) { case GetOsNames: setReturnValue(osRepository.getOsNames()); break; case GetUniqueOsNames: setReturnValue(osRepository.getUniqueOsNames()); break; case GetOsIds: setReturnValue(osRepository.getOsIds()); break; case GetLinuxOss: setReturnValue(osRepository.getLinuxOss()); break; case GetWindowsOss: setReturnValue(osRepository.getWindowsOss()); break; case GetMaxOsRam: setReturnValue(osRepository.getMaximumRam(getParameters().getOsId(), getParameters().getVersion())); break; case GetMinimumOsRam: setReturnValue(osRepository.getMinimumRam(getParameters().getOsId(), getParameters().getVersion())); break; case GetSpiceSupportMatrix: setReturnValue(osRepository.getSpiceSupportMatrix()); break; case GetNetworkDevices: setReturnValue(osRepository.getNetworkDevices(getParameters().getOsId(), getParameters().getVersion())); break; } }
Source:
public synchronized Map<String, SummaryStatistics> addAdditionalResult( long startMs, long endMs) throws IOException { Map<String, SummaryStatistics> summaryStatistics = new HashMap<>(); Map<String, MethodStatistics> nameStatistics = processMethodProfiles(startMs, endMs, javaAgentInput -> { if (javaAgentInput.getIsttfb()) { return javaAgentInput.getMethod(); } return null; }); if (!nameStatistics.isEmpty()) { for (Map.Entry<String, MethodStatistics> entry : nameStatistics.entrySet()) { summaryStatistics.put( entry.getKey(), toSummaryStatistics(entry.getValue())); } } return summaryStatistics; }

Target:
public synchronized Map<String, SummaryStatistics> addAdditionalResult( long startMs, long endMs) throws IOException { Map<String, SummaryStatistics> summaryStatistics = new HashMap<>(); Map<String, MethodStatistics> nameStatistics = processMethodProfiles(startMs, endMs, profileInput -> { if (profileInput.getIsttfb()) { return profileInput.getMethod(); } return null; }); if (!nameStatistics.isEmpty()) { for (Map.Entry<String, MethodStatistics> entry : nameStatistics.entrySet()) { summaryStatistics.put( entry.getKey(), toSummaryStatistics(entry.getValue())); } } return summaryStatistics; }
Source:
public void gerrit_has_review_flags_checked_after_jenkins_set_them() { assumeTrue(new File(GerritTriggerEnv.get().getUserHome(),".netrc").exists()); try { Thread.sleep(1000); } catch (InterruptedException e1) { } GerritTriggerNewServer newServer = new GerritTriggerNewServer(jenkins); newServer.saveNewTestServerConfigIfNone(); GerritTriggerServer server = new GerritTriggerServer(jenkins); server.saveTestServerConfig(); String jobName = this.getClass().getCanonicalName(); jenkins.jobs.create(FreeStyleJob.class, jobName); GerritTriggerJob job = new GerritTriggerJob(jenkins, jobName); job.saveTestJobConfig(); try { String changeId = pushChangeForReview(jobName); sleep(10000); String rev = readJson(curl(changeId)); logCurlHttpCodeIssues(rev); getLabelValueFromJSON(rev, "Verified", 1); getLabelValueFromJSON(rev, "Code-Review", 1); } catch(InterruptedException|IOException e) { fail(e.getMessage()); } }

Target:
public void gerrit_has_review_flags_checked_after_jenkins_set_them() { assumeTrue(new File(GerritTriggerEnv.get().getUserHome(),".netrc").exists()); GerritTriggerNewServer newServer = new GerritTriggerNewServer(jenkins); newServer.saveNewTestServerConfigIfNone(); GerritTriggerServer server = new GerritTriggerServer(jenkins); server.saveTestServerConfig(); String jobName = this.getClass().getCanonicalName(); jenkins.jobs.create(FreeStyleJob.class, jobName); GerritTriggerJob job = new GerritTriggerJob(jenkins, jobName); job.saveTestJobConfig(); try { String changeId = pushChangeForReview(jobName); sleep(10000); String rev = readJson(curl(changeId)); logCurlHttpCodeIssues(rev); checkLabelValueFromJSON(rev, "Verified"); checkLabelValueFromJSON(rev, "Code-Review"); } catch(InterruptedException|IOException e) { fail(e.getMessage()); } }
Source:
protected boolean fetchNext() { try { if ( seeker.next() ) { return next( seeker.get().key().entityId ); } else { ensureCursorClosed(); return false; } } catch ( IOException e ) { throw new UncheckedIOException( e ); } }

Target:
protected boolean fetchNext() { try { if ( !closed && seeker.next() ) { return next( seeker.get().key().entityId ); } else { ensureCursorClosed(); return false; } } catch ( IOException e ) { throw new UncheckedIOException( e ); } }
Source:
public void onPlayerUpdate(LivingEvent.LivingUpdateEvent event, EntityPlayer player, @Nonnull ItemStack armorStack, EntityEquipmentSlot slot) { if (ChargableUtility.hasPower(player, 1)) { PlayerData data = player.getCapability(EsteemedInnovation.PLAYER_DATA, null); if (data.getLastMotions() == null) { data.setLastMotions(Pair.of(player.posX, player.posZ)); } double lastX = data.getLastMotions().getLeft(); double lastZ = data.getLastMotions().getRight(); if ((player.moveForward > 0.0F) && (lastX != player.posX || lastZ != player.posZ) && player.onGround && !player.isInWater()) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); player.moveRelative(0F, 1F, 0.075F, 0.0F); if (!chestStack.getTagCompound().hasKey("TicksUntilSteamDrain")) { chestStack.getTagCompound().setInteger("TicksUntilSteamDrain", 2); } if (chestStack.getTagCompound().getInteger("TicksUntilSteamDrain") <= 0) { ChargableUtility.drainSteam(chestStack, Config.runAssistConsumption, player); } } } }

Target:
public void onPlayerUpdate(LivingEvent.LivingUpdateEvent event, EntityPlayer player, @Nonnull ItemStack armorStack, EntityEquipmentSlot slot) { if (ChargableUtility.hasPower(player, 1)) { PlayerData data = player.getCapability(EsteemedInnovation.PLAYER_DATA, null); if (data.getLastMotions() == null) { data.setLastMotions(Pair.of(player.posX, player.posZ)); } double lastX = data.getLastMotions().getLeft(); double lastZ = data.getLastMotions().getRight(); if ((player.moveForward > 0.0F) && (lastX != player.posX || lastZ != player.posZ) && player.onGround && !player.isInWater()) { ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); player.moveRelative(0F, 1F, 0.075F, 0F); if (!chestStack.getTagCompound().hasKey("TicksUntilSteamDrain")) { chestStack.getTagCompound().setInteger("TicksUntilSteamDrain", 2); } if (chestStack.getTagCompound().getInteger("TicksUntilSteamDrain") <= 0) { ChargableUtility.drainSteam(chestStack, ArmorModule.runAssistConsumption, player); } } } }
Source:
public Color getColor() { return Color.ofRgb(colorValue); }

Target:
public Color getColor() { return color; }
Source:
public static DataSource azureSql( String name, String sqlConnectionString, String tableOrViewName, String description, DataChangeDetectionPolicy changeDetectionPolicy, DataDeletionDetectionPolicy deletionDetectionPolicy) { return new DataSource() .setName(name) .setType(DataSourceType.AZURE_SQL) .setCredentials(new DataSourceCredentials().setConnectionString(sqlConnectionString)) .setContainer(new DataContainer().setName(tableOrViewName)) .setDescription(description) .setDataDeletionDetectionPolicy(deletionDetectionPolicy) .setDataChangeDetectionPolicy(changeDetectionPolicy); }

Target:
public static DataSource azureSql( String name, String sqlConnectionString, String tableOrViewName, String description, DataChangeDetectionPolicy changeDetectionPolicy, DataDeletionDetectionPolicy deletionDetectionPolicy) { if (CoreUtils.isNullOrEmpty(name)) { throw new IllegalArgumentException("name cannot be null or empty"); } if (CoreUtils.isNullOrEmpty(sqlConnectionString)) { throw new IllegalArgumentException("sqlConnectionString cannot be null or empty"); } if (CoreUtils.isNullOrEmpty(tableOrViewName)) { throw new IllegalArgumentException("tableOrViewName cannot be null or empty"); } return new DataSource() .setName(name) .setType(DataSourceType.AZURE_SQL) .setCredentials(new DataSourceCredentials().setConnectionString(sqlConnectionString)) .setContainer(new DataContainer().setName(tableOrViewName)) .setDescription(description) .setDataChangeDetectionPolicy(changeDetectionPolicy) .setDataDeletionDetectionPolicy(deletionDetectionPolicy); }
Source:
public List<MeasureDto> selectByComponentsAndMetrics(DbSession dbSession, List<String> componentUuids, List<Integer> metricIds) { return executeLargeInputs(componentUuids, components -> mapper(dbSession).selectByComponentsAndProjectsAndMetrics(components, metricIds)); }

Target:
public List<MeasureDto> selectByComponentsAndMetrics(DbSession dbSession, List<String> componentUuids, List<Integer> metricIds) { return executeLargeInputs(componentUuids, partitionComponentUuids -> mapper(dbSession).selectByComponentsAndMetrics(partitionComponentUuids, metricIds)); }
Source:
private void registerAggregateMetrics() { SlidingTimeWindowReservoir reservoir = new SlidingTimeWindowReservoir(1, TimeUnit.DAYS); Histogram slidingWeek = new Histogram(reservoir); String deletes = MetricRegistry.name(SweepMetrics.class, "totalDeletes"); registerMetricIfNotExists(deletes, slidingWeek); }

Target:
private void registerAggregateMetrics() { forAllMetrics(TableAndAggregateMetric::registerAggregateMetric); }
Source:
void removeTokenCacheItem(final TokenCacheItem tokenCacheItem, final String resource) throws AuthenticationException { final CacheEvent cacheEvent = new CacheEvent(EventStrings.TOKEN_CACHE_DELETE); cacheEvent.setRequestId(mTelemetryRequestId); Telemetry.getInstance().startEvent(mTelemetryRequestId, EventStrings.TOKEN_CACHE_DELETE); final List<String> keys; final TokenEntryType tokenEntryType = tokenCacheItem.getTokenEntryType(); switch (tokenEntryType) { case REGULAR_TOKEN_ENTRY : cacheEvent.setTokenTypeRT(true); Logger.v(TAG, "Regular RT was used to get access token, remove entries " + "for regular RT entries."); keys = getKeyListToRemoveForRT(tokenCacheItem); break; case MRRT_TOKEN_ENTRY : cacheEvent.setTokenTypeMRRT(true); cacheEvent.setTokenTypeRT(true); Logger.v(TAG, "MRRT was used to get access token, remove entries for both " + "MRRT entries and regular RT entries."); keys = getKeyListToRemoveForMRRT(tokenCacheItem); final TokenCacheItem regularRTItem = new TokenCacheItem(tokenCacheItem); regularRTItem.setResource(resource); keys.addAll(getKeyListToRemoveForRT(regularRTItem)); break; case FRT_TOKEN_ENTRY : cacheEvent.setTokenTypeFRT(true); Logger.v(TAG, "FRT was used to get access token, remove entries for " + "FRT entries."); keys = getKeyListToRemoveForFRT(tokenCacheItem); break; default : throw new AuthenticationException(ADALError.INVALID_TOKEN_CACHE_ITEM); } for (final String key : keys) { mTokenCacheStore.removeItem(key); } Telemetry.getInstance().stopEvent(mTelemetryRequestId, cacheEvent, EventStrings.TOKEN_CACHE_DELETE); }

Target:
void removeTokenCacheItem(final TokenCacheItem tokenCacheItem, final String resource) throws AuthenticationException { final CacheEvent cacheEvent = new CacheEvent(EventStrings.TOKEN_CACHE_DELETE); cacheEvent.setRequestId(mTelemetryRequestId); Telemetry.getInstance().startEvent(mTelemetryRequestId, EventStrings.TOKEN_CACHE_DELETE); final List<String> keys; final TokenEntryType tokenEntryType = tokenCacheItem.getTokenEntryType(); switch (tokenEntryType) { case REGULAR_TOKEN_ENTRY : cacheEvent.setTokenTypeRT(true); Logger.v(TAG, "Regular RT was used to get access token, remove entries " + "for regular RT entries."); keys = getKeyListToRemoveForRT(tokenCacheItem); break; case MRRT_TOKEN_ENTRY : cacheEvent.setTokenTypeMRRT(true); Logger.v(TAG, "MRRT was used to get access token, remove entries for both " + "MRRT entries and regular RT entries."); keys = getKeyListToRemoveForMRRT(tokenCacheItem); final TokenCacheItem regularRTItem = new TokenCacheItem(tokenCacheItem); regularRTItem.setResource(resource); keys.addAll(getKeyListToRemoveForRT(regularRTItem)); break; case FRT_TOKEN_ENTRY : cacheEvent.setTokenTypeFRT(true); Logger.v(TAG, "FRT was used to get access token, remove entries for " + "FRT entries."); keys = getKeyListToRemoveForFRT(tokenCacheItem); break; default : throw new AuthenticationException(ADALError.INVALID_TOKEN_CACHE_ITEM); } for (final String key : keys) { mTokenCacheStore.removeItem(key); } Telemetry.getInstance().stopEvent(mTelemetryRequestId, cacheEvent, EventStrings.TOKEN_CACHE_DELETE); }
Source:
private void restoreItems(final ArrayList<IndexedItem> with){ Intent chooserIntent = new Intent(getActivity(), DirectoryChooserActivity.class); chooserIntent.putExtra(DirectoryChooserActivity.EXTRA_NEW_DIR_NAME, "DirChooserSample"); ((HomeActivity)getActivity()).setRequestedActivity(true); startActivityForResult(chooserIntent, REQUEST_DIRECTORY); }

Target:
private void restoreItems(final ArrayList<IndexedItem> with) { Intent chooserIntent = new Intent(getActivity(), DirectoryChooserActivity.class); chooserIntent.putExtra(DirectoryChooserActivity.EXTRA_NEW_DIR_NAME, "Export"); ((HomeActivity) getActivity()).setRequestedActivity(true); startActivityForResult(chooserIntent, REQUEST_DIRECTORY); }
Source:
public void prepareRun(BatchAggregatorContext context) throws Exception { super.prepareRun(context); validate(context.getInputSchema(), conf.getFields(), context.getFailureCollector()); context.getFailureCollector().getOrThrowException(); if (conf.getFields() == null) { context.record(TransformLineageRecorderUtils.generateOneToOnes( TransformLineageRecorderUtils.getFields(context.getInputSchema()), "distinctAggregator", "Removed duplicates in input records.")); } else { context.record(TransformLineageRecorderUtils.generateOneToOnes( Lists.newArrayList(conf.getFields()), "distinctAggregator", "Removed duplicates in input records.")); } }

Target:
public void prepareRun(BatchAggregatorContext context) throws Exception { super.prepareRun(context); validate(context.getInputSchema(), conf.getFields(), context.getFailureCollector()); context.getFailureCollector().getOrThrowException(); List<String> fields = conf.getFields() == null ? TransformLineageRecorderUtils.getFields(context.getInputSchema()) : Lists.newArrayList(conf.getFields()); context.record(TransformLineageRecorderUtils.generateOneToOnes(fields, "distinctAggregator", "Removed duplicates in input records.")); }
Source:
public void execute(IProgressMonitor monitor) throws CoreException { try { if (!repository.isFeature()) { throw new WrongGitFlowStateException( CoreText.FeatureRebaseOperation_notOnAFeatureBranch); } RebaseOperation op = new RebaseOperation( repository.getRepository(), repository.getRepository() .getRef(repository.getDevelopFull())); op.execute(null); operationResult = op.getResult(); } catch (WrongGitFlowStateException e) { throw new CoreException(error(e.getMessage(), e)); } catch (IOException e) { throw new CoreException(error(e.getMessage(), e)); } }

Target:
public void execute(IProgressMonitor monitor) throws CoreException { try { if (!repository.isFeature()) { throw new WrongGitFlowStateException( CoreText.FeatureRebaseOperation_notOnAFeatureBranch); } RebaseOperation op = new RebaseOperation( repository.getRepository(), repository.getRepository() .getRef(repository.getDevelopFull())); op.execute(null); operationResult = op.getResult(); } catch (WrongGitFlowStateException | IOException e) { throw new CoreException(error(e.getMessage(), e)); } }
Source:
public List<ExternalSubnet> getAllSubnets(ProviderNetwork network) { return null; }

Target:
public List<ExternalSubnet> getAllSubnets(ProviderNetwork network) { return Collections.emptyList(); }
Source:
public PrefetchedLoadingLookupFactory( @JsonProperty("dataFetcher") PrefetchableFetcher prefetchableFetcher, @JsonProperty("loadingCacheSpec") LoadingCache<String, String> loadingCache, @JsonProperty("reverseLoadingCacheSpec") LoadingCache<String, List<String>> reverseLoadingCache ) { super(prefetchableFetcher, loadingCache, reverseLoadingCache, new PrefetchedLoadingLookup(prefetchableFetcher,loadingCache,reverseLoadingCache)); }

Target:
public PrefetchedLoadingLookupFactory( @JsonProperty("dataFetcher") PrefetchableFetcher prefetchableFetcher, @JsonProperty("loadingCacheSpec") LoadingCache<String, String> loadingCache, @JsonProperty("reverseLoadingCacheSpec") LoadingCache<String, List<String>> reverseLoadingCache ) { this(prefetchableFetcher, loadingCache, reverseLoadingCache, new PrefetchedLoadingLookup(prefetchableFetcher,loadingCache,reverseLoadingCache)); }
Source:
private void discoverGlobalFaultData(FaultMessage faultMessage) { if (m_recovering) { org.voltdb.VoltDB.crashLocalVoltDB( "Aborting recovery due to a remote node (" + CoreUtils.hsIdToString(faultMessage.failedSite) + ") failure. Retry again.", false, null); } if (VoltDB.instance().rejoining()) { VoltDB.crashLocalVoltDB("Another node failed before this node could finish rejoining. " + "As a result, the rejoin operation has been canceled. Please try again."); } Set<Long> unknownFaultedHosts = new TreeSet<>(); Map<Long, Long> initiatorSafeInitPoint = m_meshArbiter.reconfigureOnFault(m_hsIds, faultMessage, unknownFaultedHosts); ImmutableSet<Long> failedSites = ImmutableSet.copyOf(initiatorSafeInitPoint.keySet()); if (initiatorSafeInitPoint.isEmpty() && unknownFaultedHosts.isEmpty()) { return; } ImmutableSet.Builder<Integer> failedHosts = ImmutableSet.builder(); for (long hsId: failedSites) { failedHosts.add(CoreUtils.getHostIdFromHSId(hsId)); } for (long hsId : unknownFaultedHosts) { failedHosts.add(CoreUtils.getHostIdFromHSId(hsId)); } m_failedHostsCallback.disconnect(failedHosts.build()); if (!initiatorSafeInitPoint.isEmpty()) { handleSiteFaults(failedSites, initiatorSafeInitPoint); } m_hsIds.removeAll(failedSites); }

Target:
private void discoverGlobalFaultData(FaultMessage faultMessage) { if (m_recovering) { org.voltdb.VoltDB.crashLocalVoltDB( "Aborting recovery due to a remote node (" + CoreUtils.hsIdToString(faultMessage.failedSite) + ") failure. Retry again.", false, null); } m_failedHostsCallback.disconnect(null); Set<Long> unknownFaultedHosts = new TreeSet<>(); Map<Long, Long> initiatorSafeInitPoint = m_meshArbiter.reconfigureOnFault(m_hsIds, faultMessage, unknownFaultedHosts); ImmutableSet<Long> failedSites = ImmutableSet.copyOf(initiatorSafeInitPoint.keySet()); if (initiatorSafeInitPoint.isEmpty() && unknownFaultedHosts.isEmpty()) { return; } ImmutableSet.Builder<Integer> failedHosts = ImmutableSet.builder(); for (long hsId: failedSites) { failedHosts.add(CoreUtils.getHostIdFromHSId(hsId)); } for (long hsId : unknownFaultedHosts) { failedHosts.add(CoreUtils.getHostIdFromHSId(hsId)); } m_failedHostsCallback.disconnect(failedHosts.build()); if (!initiatorSafeInitPoint.isEmpty()) { handleSiteFaults(failedSites, initiatorSafeInitPoint); } m_hsIds.removeAll(failedSites); }
Source:
private PathTransferResult doPathTransfer( Transfer transfer, ArtifactStore tgt, PathsPromoteRequest request ) throws IndyWorkflowException { long begin = System.currentTimeMillis(); final String path = transfer.getPath(); PathTransferResult result = new PathTransferResult( path ); if ( !transfer.exists() ) { String msg = String.format( "Failed to promote: %s. Source file not exists.", transfer ); result.error = msg; return result; } Transfer target = contentManager.getTransfer( tgt, path, UPLOAD ); if ( target != null && target.exists() ) { if ( request.isFailWhenExists() ) { String msg = String.format( "Failed to promote: %s. Target: %s. Target file already exists.", transfer, request.getTarget() ); result.error = msg; } else { result.skipped = true; } return result; } try (InputStream stream = transfer.openInputStream( true )) { contentManager.store( tgt, path, stream, UPLOAD, new EventMetadata().set( IGNORE_READONLY, true ) ); } catch ( final IOException e ) { String msg = String.format( "Failed to promote: %s. Error: %s", transfer, e.getMessage() ); result.error = msg; logger.error( msg, e ); } logger.info( "Promotion transfer completed, target: {}, path: {}, timeInMillSeconds: {}", tgt.getKey(), path, timeInMillSeconds( begin ) ); return result; }

Target:
private PathTransferResult doPathTransfer( Transfer transfer, ArtifactStore tgt, PathsPromoteRequest request ) throws IndyWorkflowException { long begin = System.currentTimeMillis(); final String path = transfer.getPath(); PathTransferResult result = new PathTransferResult( path ); if ( !transfer.exists() ) { String msg = String.format( "Failed to promote: %s. Source file not exists.", transfer ); logger.info( msg ); result.error = msg; return result; } Transfer target = contentManager.getTransfer( tgt, path, UPLOAD ); if ( target != null && target.exists() ) { if ( request.isFailWhenExists() ) { String msg = String.format( "Failed to promote: %s. Target: %s. Target file already exists.", transfer, request.getTarget() ); logger.info( msg ); result.error = msg; } else { result.skipped = true; } return result; } try (InputStream stream = transfer.openInputStream( true )) { contentManager.store( tgt, path, stream, UPLOAD, new EventMetadata().set( IGNORE_READONLY, true ) ); } catch ( final IOException e ) { String msg = String.format( "Failed to promote: %s. Error: %s", transfer, e.getMessage() ); result.error = msg; logger.error( msg, e ); } logger.info( "Promotion transfer completed, target: {}, path: {}, timeInMillSeconds: {}", tgt.getKey(), path, timeInMillSeconds( begin ) ); return result; }
Source:
private void assertSTGeometries(String wkt, String... expected) { assertFunction(String.format("transform(ST_Geometries(ST_GeometryFromText('%s')), x -> ST_AsText(x))", wkt), new ArrayType(VARCHAR), ImmutableList.copyOf(expected)); }

Target:
private void assertSTGeometries(String wkt, String... expected) { assertFunction(String.format("transform(ST_Geometries(ST_GeometryFromText('%s')), x -> ST_ASText(x))", wkt), new ArrayType(VARCHAR), ImmutableList.copyOf(expected)); }
Source:
public Sequence<Result<TimeBoundaryResultValue>> run( final Query<Result<TimeBoundaryResultValue>> input, final Map<String, Object> responseContext ) { if (!(input instanceof TimeBoundaryQuery)) { throw new ISE("Got a [%s] which isn't a %s", input.getClass(), TimeBoundaryQuery.class); } final TimeBoundaryQuery legacyQuery = (TimeBoundaryQuery) input; return new BaseSequence<>( new BaseSequence.IteratorMaker<Result<TimeBoundaryResultValue>, Iterator<Result<TimeBoundaryResultValue>>>() { @Override public Iterator<Result<TimeBoundaryResultValue>> make() { if (adapter == null) { throw new ISE( "Null storage adapter found. Probably trying to issue a query against a segment being memory unmapped." ); } final DateTime minTime; final DateTime maxTime; if (legacyQuery.getDimensionsFilter() != null) { minTime = getTimeBoundary(adapter, legacyQuery, false); maxTime = getTimeBoundary(adapter, legacyQuery, true); } else { minTime = legacyQuery.getBound().equalsIgnoreCase(TimeBoundaryQuery.MAX_TIME) ? null : adapter.getMinTime(); maxTime = legacyQuery.getBound().equalsIgnoreCase(TimeBoundaryQuery.MIN_TIME) ? null : adapter.getMaxTime(); } return legacyQuery.buildResult( adapter.getInterval().getStart(), minTime, maxTime ).iterator(); } @Override public void cleanup(Iterator<Result<TimeBoundaryResultValue>> toClean) { } } ); }

Target:
public Sequence<Result<TimeBoundaryResultValue>> run( final Query<Result<TimeBoundaryResultValue>> input, final Map<String, Object> responseContext ) { if (!(input instanceof TimeBoundaryQuery)) { throw new ISE("Got a [%s] which isn't a %s", input.getClass(), TimeBoundaryQuery.class); } final TimeBoundaryQuery legacyQuery = (TimeBoundaryQuery) input; return new BaseSequence<>( new BaseSequence.IteratorMaker<Result<TimeBoundaryResultValue>, Iterator<Result<TimeBoundaryResultValue>>>() { @Override public Iterator<Result<TimeBoundaryResultValue>> make() { if (adapter == null) { throw new ISE( "Null storage adapter found. Probably trying to issue a query against a segment being memory unmapped." ); } final DateTime minTime; final DateTime maxTime; if (legacyQuery.getDimensionsFilter() != null) { minTime = getTimeBoundary(adapter, legacyQuery, false); if (minTime == null) { maxTime = null; } else { maxTime = getTimeBoundary(adapter, legacyQuery, true); } } else { minTime = legacyQuery.getBound().equalsIgnoreCase(TimeBoundaryQuery.MAX_TIME) ? null : adapter.getMinTime(); maxTime = legacyQuery.getBound().equalsIgnoreCase(TimeBoundaryQuery.MIN_TIME) ? null : adapter.getMaxTime(); } return legacyQuery.buildResult( adapter.getInterval().getStart(), minTime, maxTime ).iterator(); } @Override public void cleanup(Iterator<Result<TimeBoundaryResultValue>> toClean) { } } ); }
Source:
private void fetchAndWriteLineage(Set<String> entityIds, FileWriter fw, ClientConfig config) throws IOException { HttpURLConnection connection = createHttpConnection(config, entityIds); InputStream stream = connection.getInputStream(); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true); ArrayList entities = (ArrayList) mapper.readValue(stream, Object.class); Iterator it = entities.iterator(); while (it.hasNext()) { Map<String, Object> m = (Map<String, Object>) it.next(); String id = (String) m.get("id"); Map<String, Object> children = (Map<String, Object>) m.get("children"); if (children != null) { for (Map.Entry<String, Object> entry : children.entrySet()) { ArrayList<String> childrenIds = (ArrayList<String>) entry.getValue(); for (String childId : childrenIds) { fw.write(String.format("%s, %s, %s%n", id, childId, entry.getKey())); } } } } IOUtils.close(connection); }

Target:
private void fetchAndWriteLineage(Set<String> entityIds, FileWriter fw, ClientConfig config) throws IOException { HttpURLConnection connection = createHttpConnection(config, entityIds); try { InputStream stream = connection.getInputStream(); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true); Collection<Map<String, Object>> entities = mapper.readValue(stream, new TypeReference<Collection<Map<String, Object>>>() {}); for (Map<String, Object> m : entities) { String id = (String) m.get("id"); Map<String, Object> children = (Map<String, Object>) m.get("children"); if (children != null) { Collection<String> childrenIds; for (Map.Entry<String, Object> entry : children.entrySet()) { childrenIds = (Collection<String>) entry.getValue(); for (String childId : childrenIds) { fw.write(String.format("%s, %s, %s%n", id, childId, entry.getKey())); } } } } } catch (IOException ioe) { Throwables.propagate(ioe); } finally { IOUtils.close(connection); } }
Source:
public void testInterruptedExceptionIsPassedThrough() throws Exception { InterruptedException thrown = new InterruptedException(); RemoteOptions options = Options.getDefaults(RemoteOptions.class); options.remoteRetryMaxAttempts = 0; RemoteRetrier retrier = new RemoteRetrier(options, (e) -> true, retryService, Retrier.ALLOW_ALL_CALLS); try { retrier.execute(() -> { throw thrown; }); fail(); } catch (InterruptedException expected) { assertThat(expected).isSameAs(thrown); } }

Target:
public void testInterruptedExceptionIsPassedThrough() throws Exception { InterruptedException thrown = new InterruptedException(); RemoteOptions options = Options.getDefaults(RemoteOptions.class); options.remoteMaxRetryAttempts = 0; RemoteRetrier retrier = new RemoteRetrier(options, (e) -> true, retryService, Retrier.ALLOW_ALL_CALLS); try { retrier.execute(() -> { throw thrown; }); fail(); } catch (InterruptedException expected) { assertThat(expected).isSameAs(thrown); } }