auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void doesNotAcceptEmptySchemaWhenNotMSSQL() throws SQLException { try (Connection conn = getConnection("ignoreCatalogs;IGNORE_CATALOGS=TRUE;init=drop all objects\\;create schema dbo\\;set schema dbo\\;")) { try (Statement stat = conn.createStatement()) { stat.execute("create table catalog1.dbo.test(id int primary key, name varchar(255))"); assertThrows(ErrorCode.SYNTAX_ERROR_2,stat,"comment on table catalog1..test is 'table comment3'"); assertThrows(ErrorCode.SYNTAX_ERROR_2,stat,"create table catalog1..test2(id int primary key, name varchar(255))"); stat.execute("comment on table catalog1.dbo.test is 'table comment1'"); stat.execute("insert into test values(1, 'Hello')"); stat.execute("insert into cat.dbo.test values(2, 'Hello2')"); assertThrows(ErrorCode.SYNTAX_ERROR_2,stat,"comment on column catalog1...test.id is 'id comment1'"); assertThrows(ErrorCode.SYNTAX_ERROR_2,stat,"comment on column catalog1..test..id is 'id comment1'"); assertThrows(ErrorCode.SYNTAX_ERROR_2,stat,"comment on column ..test..id is 'id comment1'"); } } finally { deleteDb("ignoreCatalogs"); } }

Target:
public void doesNotAcceptEmptySchemaWhenNotMSSQL() throws SQLException { try (Connection conn = getConnection("ignoreCatalogs;IGNORE_CATALOGS=TRUE")) { try (Statement stat = conn.createStatement()) { prepareDbAndSetDefaultSchema(stat); stat.execute("set schema dbo"); stat.execute("create table catalog1.dbo.test(id int primary key, name varchar(255))"); assertThrows(ErrorCode.SYNTAX_ERROR_2, stat, "comment on table catalog1..test is 'table comment3'"); assertThrows(ErrorCode.SYNTAX_ERROR_2, stat, "create table catalog1..test2(id int primary key, " + "name varchar(255))"); stat.execute("comment on table catalog1.dbo.test is 'table comment1'"); stat.execute("insert into test values(1, 'Hello')"); stat.execute("insert into cat.dbo.test values(2, 'Hello2')"); assertThrows(ErrorCode.SYNTAX_ERROR_2, stat, "comment on column catalog1...test.id is 'id comment1'"); assertThrows(ErrorCode.SYNTAX_ERROR_2, stat, "comment on column catalog1..test..id is 'id comment1'"); assertThrows(ErrorCode.SYNTAX_ERROR_2, stat, "comment on column ..test..id is 'id comment1'"); } } finally { deleteDb("ignoreCatalogs"); } }
Source:
protected void build(VmBase vm, UnitVmModel model) { model.getMemSize().setEntity(vm.getMemSizeMb()); if (supported(ConfigurationValues.IoThreadsSupported, model)) { model.getIoThreadsEnabled().setEntity(vm.getNumOfIoThreads() != 0); model.getNumOfIoThreads().setEntity(vm.getNumOfIoThreads()); } model.getMinAllocatedMemory().setEntity(vm.getMinAllocatedMem()); model.getUsbPolicy().setSelectedItem(vm.getUsbPolicy()); model.getNumOfMonitors().setSelectedItem(vm.getNumOfMonitors()); model.getIsSingleQxlEnabled().setEntity(vm.getSingleQxlPci()); model.setBootSequence(vm.getDefaultBootSequence()); model.getTotalCPUCores().setEntity(Integer.toString(vm.getNumOfCpus())); model.getNumOfSockets().setSelectedItem(vm.getNumOfSockets()); model.getIsSmartcardEnabled().setEntity(vm.isSmartcardEnabled()); model.setSelectedMigrationDowntime(vm.getMigrationDowntime()); model.getEmulatedMachine().setSelectedItem(vm.getCustomEmulatedMachine()); model.getCustomCpu().setSelectedItem(vm.getCustomCpuName()); model.getCompatibilityVersion().setSelectedItem(vm.getCompatibilityVersion()); }

Target:
protected void build(VmBase vm, UnitVmModel model) { model.getMemSize().setEntity(vm.getMemSizeMb()); if (supported(ConfigurationValues.IoThreadsSupported, model)) { model.getIoThreadsEnabled().setEntity(vm.getNumOfIoThreads() != 0); model.getNumOfIoThreads().setEntity(vm.getNumOfIoThreads()); } model.getMinAllocatedMemory().setEntity(vm.getMinAllocatedMem()); model.getUsbPolicy().setSelectedItem(vm.getUsbPolicy()); model.getNumOfMonitors().setSelectedItem(vm.getNumOfMonitors()); model.getIsSingleQxlEnabled().setEntity(vm.getSingleQxlPci()); model.setBootSequence(vm.getDefaultBootSequence()); model.getTotalCPUCores().setEntity(Integer.toString(vm.getNumOfCpus())); model.getNumOfSockets().setSelectedItem(vm.getNumOfSockets()); model.getIsSmartcardEnabled().setEntity(vm.isSmartcardEnabled()); model.setSelectedMigrationDowntime(vm.getMigrationDowntime()); model.getEmulatedMachine().setSelectedItem(vm.getCustomEmulatedMachine()); model.getCustomCpu().setSelectedItem(vm.getCustomCpuName()); }
Source:
public static ProcessMetricGroup instantiateProcessMetricGroup( final MetricRegistry metricRegistry, final String hostname, final Optional<Time> systemResourceProbeInterval) { final ProcessMetricGroup processMetricGroup = ProcessMetricGroup.create(metricRegistry, hostname); instantiateStatusMetricGroup(processMetricGroup); systemResourceProbeInterval.ifPresent(interval -> instantiateSystemMetrics(processMetricGroup, interval)); return processMetricGroup; }

Target:
public static ProcessMetricGroup instantiateProcessMetricGroup( final MetricRegistry metricRegistry, final String hostname, final Optional<Time> systemResourceProbeInterval) { final ProcessMetricGroup processMetricGroup = ProcessMetricGroup.create(metricRegistry, hostname); createAndInitializeStatusMetricGroup(processMetricGroup); systemResourceProbeInterval.ifPresent(interval -> instantiateSystemMetrics(processMetricGroup, interval)); return processMetricGroup; }
Source:
private boolean redefineVmCheckpoints() { VDSReturnValue vdsRetVal; try { List<VmCheckpoint> checkpoints = vmCheckpointDao.getAllForVm(getVmId()); if (checkpoints.isEmpty()) { log.info("No previous VM checkpoints found for VM '{}', skip redefine VM checkpoints", getVmId()); return true; } for (VmCheckpoint checkpoint : checkpoints) { vdsRetVal = runVdsCommand(VDSCommandType.RedefineVmCheckpoints, new VmCheckpointsVDSParameters(getVdsId(), getVmId(), List.of(checkpoint))); VmCheckpointInfo VmCheckpointInfo = (VmCheckpointInfo) vdsRetVal.getReturnValue(); if (!vdsRetVal.getSucceeded() || VmCheckpointInfo.getError() != null) { EngineException engineException = new EngineException(); engineException.setVdsError(vdsRetVal.getVdsError()); engineException.setVdsReturnValue(vdsRetVal); throw engineException; } } return true; } catch (EngineException e) { log.error("Failed to execute VM.redefineCheckpoints: {}", e); return false; } }

Target:
private boolean redefineVmCheckpoints() { VDSReturnValue vdsRetVal; try { List<VmCheckpoint> checkpoints = vmCheckpointDao.getAllForVm(getVmId()); if (checkpoints.isEmpty()) { log.info("No previous VM checkpoints found for VM '{}', skip redefine VM checkpoints", getVmId()); return true; } for (VmCheckpoint checkpoint : checkpoints) { vdsRetVal = runVdsCommand(VDSCommandType.RedefineVmCheckpoints, new VmCheckpointsVDSParameters(getVdsId(), getVmId(), List.of(checkpoint))); VmCheckpointInfo vmCheckpointInfo = (VmCheckpointInfo) vdsRetVal.getReturnValue(); if (!vdsRetVal.getSucceeded() || vmCheckpointInfo.getError() != null) { EngineException engineException = new EngineException(); engineException.setVdsError(vdsRetVal.getVdsError()); engineException.setVdsReturnValue(vdsRetVal); throw engineException; } } return true; } catch (EngineException e) { log.error("Failed to execute VM.redefineCheckpoints: {}", e); return false; } }
Source:
protected boolean storeManagedBlob(BlobHolder blobHolder) { Blob blob = blobHolder.getBlob(); if (!(blob instanceof ManagedBlob) || blobHolder.getBlobs().size() > 1) { return false; } ManagedBlob mBlob = (ManagedBlob) blob; BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(mBlob); if (blobProvider.canConvert(mBlob, destinationMimeType)) { this.managedBlob = mBlob; return true; } return false; }

Target:
protected boolean storeManagedBlob(BlobHolder blobHolder) { Blob blob = blobHolder.getBlob(); if (!(blob instanceof ManagedBlob) || !(blob instanceof Serializable) || blobHolder.getBlobs().size() > 1) { return false; } ManagedBlob mBlob = (ManagedBlob) blob; BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(mBlob); if (blobProvider.canConvert(mBlob, destinationMimeType)) { this.managedBlob = mBlob; return true; } return false; }
Source:
public void stop() { if (isLeader()) { zkLeaderElector.resignLeadership(); } zkUtils.deleteProcessorNode(processorId); if (zkUtils != null) { zkUtils.close(); } }

Target:
public void stop() { try { if (isLeader()) { zkLeaderElector.resignLeadership(); } } finally { zkUtils.deleteProcessorNode(processorId); zkUtils.close(); } }
Source:
private void archiveConversation(Conversation conversation, final boolean maySyncronizeWithBookmarks) { getNotificationService().clear(conversation); conversation.setStatus(Conversation.STATUS_ARCHIVED); conversation.setNextMessage(null); synchronized (this.conversations) { getMessageArchiveService().kill(conversation); if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getAccount().getStatus() == Account.State.ONLINE) { Bookmark bookmark = conversation.getBookmark(); if (maySyncronizeWithBookmarks && bookmark != null && synchronizeWithBookmarks()) { if (conversation.getMucOptions().getError() == MucOptions.Error.DESTROYED) { Account account = bookmark.getAccount(); bookmark.setConversation(null); account.getBookmarks().remove(bookmark); pushBookmarks(account); } else { if (bookmark.autojoin()) { bookmark.setAutojoin(false); pushBookmarks(bookmark.getAccount()); } } } } leaveMuc(conversation); } else { if (conversation.getContact().getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { stopPresenceUpdatesTo(conversation.getContact()); } } updateConversation(conversation); this.conversations.remove(conversation); updateConversationUi(); } }

Target:
private void archiveConversation(Conversation conversation, final boolean maySyncronizeWithBookmarks) { getNotificationService().clear(conversation); conversation.setStatus(Conversation.STATUS_ARCHIVED); conversation.setNextMessage(null); synchronized (this.conversations) { getMessageArchiveService().kill(conversation); if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getAccount().getStatus() == Account.State.ONLINE) { Bookmark bookmark = conversation.getBookmark(); if (maySyncronizeWithBookmarks && bookmark != null && synchronizeWithBookmarks()) { if (conversation.getMucOptions().getError() == MucOptions.Error.DESTROYED) { Account account = bookmark.getAccount(); bookmark.setConversation(null); account.getBookmarks().remove(bookmark); pushBookmarks(account); } else if (bookmark.autojoin()) { bookmark.setAutojoin(false); pushBookmarks(bookmark.getAccount()); } } } leaveMuc(conversation); } else { if (conversation.getContact().getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { stopPresenceUpdatesTo(conversation.getContact()); } } updateConversation(conversation); this.conversations.remove(conversation); updateConversationUi(); } }
Source:
protected TdLoadOperator(OperatorContext context) { super(context, env, systemConfig); params = request.getConfig().mergeDefault( request.getConfig().getNestedOrGetEmpty("td")); config = params.getOptionalNested("config"); name = params.getOptional("name", String.class); command = params.getOptional("_command", String.class); if (config.isPresent() && name.isPresent()) { throw new ConfigException("The parameters config and name cannot both be set"); } long numExistParams = Stream.of(command, name, config).filter(Optional::isPresent).count(); if ( numExistParams > 1) { throw new ConfigException("Only the command or one of the config and name params may be set"); } else if (numExistParams <= 0) { throw new ConfigException("No parameter is set"); } if (command.isPresent()) { if (command.get().endsWith(".yml") || command.get().endsWith(".yaml")) { this.embulkConfig = Optional.of(compileEmbulkConfig(params, command.get())); this.sessionName = Optional.absent(); } else { this.embulkConfig = Optional.absent(); this.sessionName = Optional.of(command.get()); } } else if (name.isPresent()) { this.embulkConfig = Optional.absent(); this.sessionName = name; } else if (config.isPresent()) { this.embulkConfig = Optional.of(config.get().getInternalObjectNode()); this.sessionName = Optional.absent(); } else { throw new ConfigException("Unexpected config error"); } }

Target:
protected TdLoadOperator(OperatorContext context) { super(context, env, systemConfig); params = request.getConfig().mergeDefault( request.getConfig().getNestedOrGetEmpty("td")); config = params.getOptionalNested("config"); name = params.getOptional("name", String.class); command = params.getOptional("_command", String.class); if (config.isPresent() && name.isPresent()) { throw new ConfigException("The parameters config and name cannot both be set"); } long numExistParams = Stream.of(command, name, config).filter(Optional::isPresent).count(); if ( numExistParams > 1) { throw new ConfigException("Only the command or one of the config and name params may be set"); } else if (numExistParams == 0) { throw new ConfigException("No parameter is set"); } if (command.isPresent()) { if (command.get().endsWith(".yml") || command.get().endsWith(".yaml")) { this.embulkConfig = Optional.of(compileEmbulkConfig(params, command.get())); this.sessionName = Optional.absent(); } else { this.embulkConfig = Optional.absent(); this.sessionName = Optional.of(command.get()); } } else if (name.isPresent()) { this.embulkConfig = Optional.absent(); this.sessionName = name; } else { this.embulkConfig = Optional.of(config.get().getInternalObjectNode()); this.sessionName = Optional.absent(); } }
Source:
private static NumberGenerator getKeyChooser(String requestDistrib, int recordCount, double zipfContant, Properties p) throws WorkloadException { NumberGenerator keychooser = null; if (requestDistrib.compareTo("exponential") == 0) { double percentile = Double.parseDouble(p.getProperty(ExponentialGenerator.EXPONENTIAL_PERCENTILE_PROPERTY, ExponentialGenerator.EXPONENTIAL_PERCENTILE_DEFAULT)); double frac = Double.parseDouble(p.getProperty(ExponentialGenerator.EXPONENTIAL_FRAC_PROPERTY, ExponentialGenerator.EXPONENTIAL_FRAC_DEFAULT)); keychooser = new ExponentialGenerator(percentile, recordCount * frac); } else if (requestDistrib.compareTo("uniform") == 0) { keychooser = new UniformIntegerGenerator(0, recordCount - 1); } else if (requestDistrib.compareTo("zipfian") == 0) { keychooser = new ZipfianGenerator(recordCount, zipfContant); } else if (requestDistrib.compareTo("latest") == 0) { System.err.println("Latest request distribution is not supported"); } else if (requestDistrib.equals("hotspot")) { double hotsetfraction = Double .parseDouble(p.getProperty(HOTSPOT_DATA_FRACTION, HOTSPOT_DATA_FRACTION_DEFAULT)); double hotopnfraction = Double .parseDouble(p.getProperty(HOTSPOT_OPN_FRACTION, HOTSPOT_OPN_FRACTION_DEFAULT)); keychooser = new HotspotIntegerGenerator(0, recordCount - 1, hotsetfraction, hotopnfraction); } else { throw new WorkloadException("Unknown request distribution \"" + requestDistrib + "\""); } return keychooser; }

Target:
private static NumberGenerator getKeyChooser(String requestDistrib, int recordCount, double zipfContant, Properties p) throws WorkloadException { NumberGenerator keychooser = null; switch(requestDistrib) { case "exponential": double percentile = Double.parseDouble(p.getProperty(ExponentialGenerator.EXPONENTIAL_PERCENTILE_PROPERTY, ExponentialGenerator.EXPONENTIAL_PERCENTILE_DEFAULT)); double frac = Double.parseDouble(p.getProperty(ExponentialGenerator.EXPONENTIAL_FRAC_PROPERTY, ExponentialGenerator.EXPONENTIAL_FRAC_DEFAULT)); keychooser = new ExponentialGenerator(percentile, recordCount * frac); break; case "uniform": keychooser = new UniformIntegerGenerator(0, recordCount - 1); break; case "zipfian": keychooser = new ZipfianGenerator(recordCount, zipfContant); break; case "latest": throw new WorkloadException("Latest request distribution is not supported for RestWorkload."); case "hotspot": double hotsetfraction = Double .parseDouble(p.getProperty(HOTSPOT_DATA_FRACTION, HOTSPOT_DATA_FRACTION_DEFAULT)); double hotopnfraction = Double .parseDouble(p.getProperty(HOTSPOT_OPN_FRACTION, HOTSPOT_OPN_FRACTION_DEFAULT)); keychooser = new HotspotIntegerGenerator(0, recordCount - 1, hotsetfraction, hotopnfraction); break; default: throw new WorkloadException("Unknown request distribution \"" + requestDistrib + "\""); } return keychooser; }
Source:
public void initCredentials() throws Ex; public void act() throws HttpResponseException, IOException, InterruptedException, ExecutorException, Ex; public boolean moreWork(); } public static <Ex extends Throwable> void performRequestWithReinitCredentials(RepeatAction<Ex> a, int retries) throws IOException, InterruptedException, ExecutorException, Ex { int budget = retries; do { a.initCredentials(); try { while (a.moreWork()) { a.act(); budget = retries; } } catch (HttpResponseException e) { if (budget > 0 && e.getStatusCode() == STATUS_CODE_UNAUTHORIZED) { logger.fine("Remote credentials expired, retrying."); budget--; } else { throw new IOException(Messages.AbstractUpload_ExceptionFileUpload(), e); } } } while (a.moreWork()); }

Target:
public void initCredentials() throws Ex; public void act() throws HttpResponseException, IOException, InterruptedException, ExecutorException, Ex; public boolean moreWork(); } public static <Ex extends Throwable> void performRequestWithReinitCredentials(RepeatOperation<Ex> a, int retries) throws IOException, InterruptedException, ExecutorException, Ex { int budget = retries; do { a.initCredentials(); try { while (a.moreWork()) { a.act(); budget = retries; } } catch (HttpResponseException e) { if (budget > 0 && e.getStatusCode() == STATUS_CODE_UNAUTHORIZED) { logger.fine("Remote credentials expired, retrying."); budget--; } else { throw new IOException(Messages.AbstractUpload_ExceptionFileUpload(), e); } } } while (a.moreWork()); }
Source:
void setLocalPartitionCount(int partitionCount) { if (!offlineCount.compareAndSet(0, partitionCount)) { logger.warn("Number of OFFLINE partitions has changed before initializing participant metrics"); } }

Target:
void setLocalPartitionCount(int partitionCount) { if (!offlineCount.compareAndSet(0, partitionCount)) { throw new IllegalStateException( "Number of OFFLINE partitions has changed before initializing participant metrics"); } }
Source:
public void testDumpCommandOnLinux() throws Exception { String[] cmdArray; Process processDump = null; try { if (CarbonCommandToolsUtil.isCurrentOSWindows()) { throw new SkipException("Feature --start is not available for windows"); } else { cmdArray = new String[] {"sh", "carbondump.sh", "-carbonHome", carbonHome, "-pid", processId}; processDump = CarbonCommandToolsUtil.runScript(carbonHome + "/bin", cmdArray); } assertTrue(isFoundDumpFile(carbonHome), "Couldn't find the dump file"); } finally { processDump.destroy(); } }

Target:
public void testDumpCommandOnLinux() throws CarbonToolsIntegrationTestException { String[] cmdArray; Process processDump = null; try { if ((CarbonCommandToolsUtil.getCurrentOperatingSystem(). contains(OperatingSystems.WINDOWS.name().toLowerCase())) ) { throw new SkipException("Feature --start is not available for windows"); } else { cmdArray = new String[] {"sh", "carbondump.sh", "-carbonHome", carbonHome, "-pid", processId}; processDump = CarbonCommandToolsUtil.runScript(carbonHome + "/bin", cmdArray); } assertTrue(isFoundDumpFile(carbonHome), "Couldn't find the dump file"); } finally { processDump.destroy(); } }
Source:
public void cleanup() { if (weld != null) { try { weld.shutdown(); } catch (NullPointerException npeException) { Logger.getLogger(CDITestSetup.class.getName()) .log(Level.WARNING, "Problem occured during weld clean up: " + npeException.getMessage()); } } }

Target:
public void cleanup() { if (weld != null) { try { weld.shutdown(); } catch (NullPointerException npeException) { LoggerFactory.getLogger(CDITestSetup.class) .warn("Problem occured during weld clean up: " + npeException.getMessage()); } } }
Source:
private void runWriteRequest(SensorTagRequestInfo requestInfo) { ChannelRecord record = requestInfo.channelRecord; record.setTimestamp(System.currentTimeMillis()); TiSensorTag sensorTag; try { sensorTag = getSensorTag(requestInfo); } catch (KuraBluetoothIOException e) { record.setChannelStatus(new ChannelStatus(FAILURE, message.writeFailed(), null)); logger.error("Io Exception encountered while connecting."); return; } final TypedValue<?> value = record.getValue(); if (!value.getType().equals(DataType.BOOLEAN)) { record.setChannelStatus(new ChannelStatus(FAILURE, message.writeFailed(), null)); logger.error("Only boolean types are allowed for this asset"); return; } switch (requestInfo.sensorName) { case GREEN_LED: if ((boolean) value.getValue()) { sensorTag.switchOnGreenLed(); } else { sensorTag.switchOffGreenLed(); } break; case RED_LED: if ((boolean) value.getValue()) { sensorTag.switchOnRedLed(); } else { sensorTag.switchOffRedLed(); } break; case BUZZER: if ((boolean) value.getValue()) { sensorTag.switchOnBuzzer(); } else { sensorTag.switchOffBuzzer(); } break; default: } record.setChannelStatus(new ChannelStatus(SUCCESS)); }

Target:
private void runWriteRequest(SensorTagRequestInfo requestInfo) { ChannelRecord record = requestInfo.channelRecord; record.setTimestamp(System.currentTimeMillis()); TiSensorTag sensorTag; try { sensorTag = getSensorTag(requestInfo); } catch (KuraBluetoothIOException e) { record.setChannelStatus(new ChannelStatus(FAILURE, message.writeFailed(), null)); logger.error("IO Exception encountered while connecting."); return; } final TypedValue<?> value = record.getValue(); if (!value.getType().equals(DataType.BOOLEAN)) { record.setChannelStatus(new ChannelStatus(FAILURE, message.writeFailed(), null)); logger.error("Only boolean types are allowed for this asset"); return; } switch (requestInfo.sensorName) { case GREEN_LED: if ((boolean) value.getValue()) { sensorTag.switchOnGreenLed(); } else { sensorTag.switchOffGreenLed(); } break; case RED_LED: if ((boolean) value.getValue()) { sensorTag.switchOnRedLed(); } else { sensorTag.switchOffRedLed(); } break; case BUZZER: if ((boolean) value.getValue()) { sensorTag.switchOnBuzzer(); } else { sensorTag.switchOffBuzzer(); } break; default: } record.setChannelStatus(new ChannelStatus(SUCCESS)); }
Source:
public CounterToRateMetricTransform( MetricObserver observer, long heartbeat, long estPollingInterval, TimeUnit unit, final Clock clock) { this.observer = observer; this.intervalMillis = TimeUnit.MILLISECONDS.convert(estPollingInterval, unit); final long heartbeatMillis = TimeUnit.MILLISECONDS.convert(heartbeat, unit); this.cache = new LinkedHashMap<MonitorConfig, CounterValue>(16, 0.75f, true) { protected boolean removeEldestEntry(Map.Entry<MonitorConfig, CounterValue> eldest) { final long now = clock.now(); final long lastMod = eldest.getValue().getTimestamp(); final boolean expired = (now - lastMod) > heartbeatMillis; if (expired) { LOGGER.debug("heartbeat interval exceeded, expiring {}", eldest.getKey()); } return expired; } }; }

Target:
CounterToRateMetricTransform( MetricObserver observer, long heartbeat, long estPollingInterval, TimeUnit unit, final Clock clock) { this.observer = observer; this.intervalMillis = TimeUnit.MILLISECONDS.convert(estPollingInterval, unit); final long heartbeatMillis = TimeUnit.MILLISECONDS.convert(heartbeat, unit); this.cache = new LinkedHashMap<MonitorConfig, CounterValue>(16, 0.75f, true) { protected boolean removeEldestEntry(Map.Entry<MonitorConfig, CounterValue> eldest) { final long now = clock.now(); final long lastMod = eldest.getValue().getTimestamp(); final boolean expired = (now - lastMod) > heartbeatMillis; if (expired) { LOGGER.debug("heartbeat interval exceeded, expiring {}", eldest.getKey()); } return expired; } }; }
Source:
public Long getOvfGeneration(Guid id) { return getCallsHandler().executeRead("GetOvfGeneration", new ParameterizedRowMapper<Long>() { @Override public Long mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getLong(1); }; }, getCustomMapSqlParameterSource() .addValue("vm_id", id)); }

Target:
public Long getOvfGeneration(Guid id) { return getCallsHandler().executeRead("GetOvfGeneration", createLongMapper(), getCustomMapSqlParameterSource() .addValue("vm_id", id)); }
Source:
void expandConditions() { expandConditions(whereExpressions, false); for (HsqlArrayList whereExpression : whereExpressions) { if (whereExpression.size() > whereExpressionElementsUpperBound) { String msg = "Limit of predicate expressions in \"where\" clause exceeded the maximum limit of " + whereExpressionElementsUpperBound + " predicates, predicates detected: " + whereExpression.size() + ". Reduce the number of predicates in the \"where\" clause to " + whereExpressionElementsUpperBound; throw new HsqlException(msg, "", ErrorCode.X_47002); } } expandConditions(joinExpressions, false); }

Target:
void expandConditions() { expandConditions(whereExpressions, false); expandConditions(joinExpressions, false); }
Source:
protected void onAddElement(Rule element) throws IllegalArgumentException { try { validateModuleIDs(element, element.getModules(Module.class)); resolveConfigurations(element); } catch (Exception e) { logger.debug("Added rule '{}' is invalid", element.getUID(), e); } }

Target:
protected void onAddElement(Rule element) throws IllegalArgumentException { String uid = element.getUID(); try { resolveConfigurations(element); } catch (IllegalArgumentException e) { logger.debug("Added rule '{}' is invalid", uid, e); } }
Source:
void outputSingleBinary(B options) throws IOException { Function<String, String> escaper = null; String marker = OUTPUT_MARKER; if (config.outputWrapper.contains(OUTPUT_MARKER_JS_STRING)) { marker = OUTPUT_MARKER_JS_STRING; escaper = getJavascriptEscaper(); } Appendable jsOutput; if (config.useJsonStreams) { jsOutput = new StringBuilder(); } else { jsOutput = createDefaultOutput(); } writeOutput( jsOutput, compiler, compiler.toSource(), config.outputWrapper, marker, escaper); closeAppendable(jsOutput); if (config.useJsonStreams) { JsonFileSpec jsonOutput = new JsonFileSpec(jsOutput.toString(), Strings.isNullOrEmpty(config.jsOutputFile) ? "compiled.js" : config.jsOutputFile); if (!Strings.isNullOrEmpty(options.sourceMapOutputPath)) { StringBuilder sourcemap = new StringBuilder(); compiler.getSourceMap().appendTo(sourcemap, jsonOutput.getPath()); jsonOutput.setSourceMap(sourcemap.toString()); } this.filesToStreamOut.add(jsonOutput); } }

Target:
void outputSingleBinary(B options) throws IOException { Function<String, String> escaper = null; String marker = OUTPUT_MARKER; if (config.outputWrapper.contains(OUTPUT_MARKER_JS_STRING)) { marker = OUTPUT_MARKER_JS_STRING; escaper = getJavascriptEscaper(); } if (config.useJsonStreams) { this.filesToStreamOut.add(createJsonFile(options, marker, escaper)); } else { Appendable jsOutput = createDefaultOutput(); writeOutput( jsOutput, compiler, compiler.toSource(), config.outputWrapper, marker, escaper); closeAppendable(jsOutput); } }
Source:
public static double calculateDistance(Position firstPosition, Position lastPosition, boolean useOdometer) { BigDecimal distance = new BigDecimal("0.0"); if (useOdometer && firstPosition.getAttributes().containsKey(Position.KEY_ODOMETER) && lastPosition.getAttributes().containsKey(Position.KEY_ODOMETER)) { distance = new BigDecimal(lastPosition.getAttributes().get(Position.KEY_ODOMETER).toString()) .subtract(new BigDecimal(firstPosition.getAttributes().get(Position.KEY_ODOMETER).toString())) .multiply(new BigDecimal("1000")); } else if (firstPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE) && lastPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { distance = new BigDecimal(lastPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE).toString()) .subtract(new BigDecimal(firstPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE) .toString())); } return distance.setScale(2, RoundingMode.HALF_EVEN).doubleValue(); }

Target:
public static double calculateDistance(Position firstPosition, Position lastPosition, boolean useOdometer) { double distance = 0.0; if (useOdometer && firstPosition.getAttributes().containsKey(Position.KEY_ODOMETER) && lastPosition.getAttributes().containsKey(Position.KEY_ODOMETER)) { distance = (((Number) lastPosition.getAttributes().get(Position.KEY_ODOMETER)).doubleValue() - ((Number) firstPosition.getAttributes().get(Position.KEY_ODOMETER)).doubleValue()) * 1000; } else if (firstPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE) && lastPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { distance = ((Number) lastPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue() - ((Number) firstPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); } return distance; }
Source:
public void refresh(BavetJoinTriTuple<A, B, C> tuple) { A a = tuple.getFactA(); B b = tuple.getFactB(); C c = tuple.getFactC(); List<BavetAbstractTriTuple<A, B, C>> childTupleList = tuple.getChildTupleList(); for (BavetAbstractTriTuple<A, B, C> childTuple : childTupleList) { session.transitionTuple(childTuple, BavetTupleState.DYING); } childTupleList.clear(); if (tuple.isActive()) { for (BavetAbstractTriNode<A, B, C> childNode : childNodeList) { BavetAbstractTriTuple<A, B, C> childTuple = childNode.createTuple(tuple); childTupleList.add(childTuple); session.transitionTuple(childTuple, BavetTupleState.CREATING); } } tuple.refreshed(); }

Target:
public void refresh(BavetJoinTriTuple<A, B, C> tuple) { List<BavetAbstractTriTuple<A, B, C>> childTupleList = tuple.getChildTupleList(); for (BavetAbstractTriTuple<A, B, C> childTuple : childTupleList) { session.transitionTuple(childTuple, BavetTupleState.DYING); } childTupleList.clear(); if (tuple.isActive()) { for (BavetAbstractTriNode<A, B, C> childNode : childNodeList) { BavetAbstractTriTuple<A, B, C> childTuple = childNode.createTuple(tuple); childTupleList.add(childTuple); session.transitionTuple(childTuple, BavetTupleState.CREATING); } } tuple.refreshed(); }
Source:
public void testLoadDuringMaitenance() { final LoadQueuePeon mockPeon1 = createEmptyPeon(); final LoadQueuePeon mockPeon2 = createOneCallPeonMock(); LoadRule rule = createLoadRule(ImmutableMap.of( "tier1", 1, "tier2", 1 )); final DataSegment segment = createDataSegment("foo"); EasyMock.expect(mockBalancerStrategy.findNewSegmentHomeReplicator(EasyMock.anyObject(), EasyMock.anyObject())) .andDelegateTo(balancerStrategy) .times(1); EasyMock.replay(mockPeon1, mockPeon2, mockBalancerStrategy); DruidCluster druidCluster = new DruidCluster( null, ImmutableMap.of( "tier1", Stream.of( createServerHolder("tier1", mockPeon1, true) ).collect(Collectors.toCollection(() -> new TreeSet<>())), "tier2", Stream.of( createServerHolder("tier2", mockPeon2, false) ).collect(Collectors.toCollection(() -> new TreeSet<>())) ) ); CoordinatorStats stats = rule.run( null, DruidCoordinatorRuntimeParams.newBuilder() .withDruidCluster(druidCluster) .withSegmentReplicantLookup(SegmentReplicantLookup.make(druidCluster)) .withReplicationManager(throttler) .withBalancerStrategy(mockBalancerStrategy) .withBalancerReferenceTimestamp(DateTimes.of("2013-01-01")) .withAvailableSegments(Collections.singletonList(segment)).build(), segment ); Assert.assertEquals(1L, stats.getTieredStat(LoadRule.ASSIGNED_COUNT, "tier2")); EasyMock.verify(mockPeon1, mockPeon2, mockBalancerStrategy); }

Target:
public void testLoadDuringMaitenance() { final LoadQueuePeon mockPeon1 = createEmptyPeon(); final LoadQueuePeon mockPeon2 = createOneCallPeonMock(); LoadRule rule = createLoadRule(ImmutableMap.of( "tier1", 1, "tier2", 1 )); final DataSegment segment = createDataSegment("foo"); EasyMock.expect(mockBalancerStrategy.findNewSegmentHomeReplicator(EasyMock.anyObject(), EasyMock.anyObject())) .andDelegateTo(balancerStrategy) .times(1); EasyMock.replay(mockPeon1, mockPeon2, mockBalancerStrategy); DruidCluster druidCluster = new DruidCluster( null, ImmutableMap.of( "tier1", Collections.singleton(createServerHolder("tier1", mockPeon1, true)), "tier2", Collections.singleton(createServerHolder("tier2", mockPeon2, false)) ) ); CoordinatorStats stats = rule.run( null, DruidCoordinatorRuntimeParams.newBuilder() .withDruidCluster(druidCluster) .withSegmentReplicantLookup(SegmentReplicantLookup.make(druidCluster)) .withReplicationManager(throttler) .withBalancerStrategy(mockBalancerStrategy) .withBalancerReferenceTimestamp(DateTimes.of("2013-01-01")) .withAvailableSegments(segment).build(), segment ); Assert.assertEquals(1L, stats.getTieredStat(LoadRule.ASSIGNED_COUNT, "tier2")); EasyMock.verify(mockPeon1, mockPeon2, mockBalancerStrategy); }
Source:
private static void putCpus(ITmfStateSystem ss, int quark, Map<String, String> retMap, List<ITmfStateInterval> full, String irqs, int status) { List<@NonNull String> cpuList = new ArrayList<>(); int grandParentAttribute = ss.getParentAttributeQuark(ss.getParentAttributeQuark(quark)); if (grandParentAttribute != org.eclipse.tracecompass.statesystem.core.ITmfStateSystem.ROOT_ATTRIBUTE && ss.getAttributeName(ss.getParentAttributeQuark(ss.getParentAttributeQuark(ss.getParentAttributeQuark(quark)))).equals(Attributes.CPUS)) { cpuList.add(ss.getAttributeName(grandParentAttribute)); } else { for (int cpuQuark : ss.getQuarks(Attributes.CPUS, "*", irqs, ss.getAttributeName(quark))) { ITmfStateInterval interval = full.get(cpuQuark); if (interval.getValue() != null) { Object object = full.get(cpuQuark).getValue(); if (object instanceof Integer) { int objectStatus = (int) object; if (objectStatus == status) { String cpu = ss.getAttributeName(ss.getParentAttributeQuark(ss.getParentAttributeQuark(cpuQuark))); cpuList.add(cpu); } } } } } if (!cpuList.isEmpty()) { Collections.sort(cpuList); retMap.put(Messages.ResourcesStatusDataProvider_attributeCpuName, String.join(", ", cpuList)); } }

Target:
private static void putCpus(ITmfStateSystem ss, int quark, Map<String, String> retMap, List<ITmfStateInterval> full, String irqs, int status) { List<@NonNull String> cpuList = new ArrayList<>(); int grandParentAttribute = ss.getParentAttributeQuark(ss.getParentAttributeQuark(quark)); if (grandParentAttribute != org.eclipse.tracecompass.statesystem.core.ITmfStateSystem.ROOT_ATTRIBUTE && ss.getAttributeName(ss.getParentAttributeQuark(ss.getParentAttributeQuark(ss.getParentAttributeQuark(quark)))).equals(Attributes.CPUS)) { cpuList.add(ss.getAttributeName(grandParentAttribute)); } else { for (int cpuQuark : ss.getQuarks(Attributes.CPUS, "*", irqs, ss.getAttributeName(quark))) { ITmfStateInterval interval = full.get(cpuQuark); if (interval.getValue() != null) { Object object = full.get(cpuQuark).getValue(); if (object instanceof Integer) { int objectStatus = (int) object; if (objectStatus == status) { String cpu = ss.getAttributeName(ss.getParentAttributeQuark(ss.getParentAttributeQuark(cpuQuark))); cpuList.add(cpu); } } } } } if (!cpuList.isEmpty()) { Collections.sort(cpuList, (s1, s2) -> Integer.compare(Integer.parseInt(s1), Integer.parseInt(s2))); retMap.put(Messages.ResourcesStatusDataProvider_attributeCpuName, String.join(", ", cpuList)); } }
Source:
public Object performOperation(List<Object> input, Map<String, String> parameters) throws TransformationOperationException { if (input.size() != getOperationInputCount()) { throw new TransformationOperationException( "The input values are not matching with the operation input count."); } Object sourceObject = input.get(0); String targetType = parameters.get(typeParam); String targetTypeInit = parameters.get(initFuncParam); Object targetObject = null; Class<?> targetClass = null; try { targetClass = this.getClass().getClassLoader().loadClass(targetType); } catch (Exception e) { String message = "The class %s can't be found. The instantiate operation will be ignored."; message = String.format(message, targetType); LOGGER.error(message); throw new TransformationOperationException(message, e); } try { if (targetTypeInit == null) { Constructor<?> constr = targetClass.getConstructor(sourceObject.getClass()); targetObject = constr.newInstance(sourceObject); } else { Method method = targetClass.getMethod(targetTypeInit, sourceObject.getClass()); if (Modifier.isStatic(method.getModifiers())) { targetObject = method.invoke(null, sourceObject); } else { targetObject = method.invoke(targetClass.newInstance(), sourceObject); } } } catch (Exception e) { String message = "Unable to create the desired object. The instantiate operation will be ignored."; message = String.format(message, targetType); LOGGER.error(message); throw new TransformationOperationException(message, e); } return targetObject; }

Target:
public Object performOperation(List<Object> input, Map<String, String> parameters) throws TransformationOperationException { checkInputSize(input); String targetType = getParameterOrException(parameters, typeParam); String initMethodName = getParameterOrDefault(parameters, initFuncParam, null); return tryInitiatingObject(targetType, initMethodName, input.get(0)); }
Source:
public static WeightedReservoirSampleStateStrategy deserialize(SliceInput input) { WeightedDoubleReservoirSample reservoir = WeightedDoubleReservoirSample.deserialize(input); return new WeightedReservoirSampleStateStrategy(reservoir); }

Target:
public static WeightedReservoirSampleStateStrategy deserialize(SliceInput input) { return new WeightedReservoirSampleStateStrategy(WeightedDoubleReservoirSample.deserialize(input)); }
Source:
private Concept mapConcept(org.openmrs.Concept openmrsConcept) { ConceptName fullySpecifiedName = openmrsConcept.getFullySpecifiedName(Context.getLocale()); Concept concept = new Concept(); if (fullySpecifiedName == null) { fullySpecifiedName = openmrsConcept.getFullySpecifiedName(getDefaultLocale()); } if (fullySpecifiedName != null) { concept = new Concept(openmrsConcept.getUuid(), fullySpecifiedName.getName()); } ConceptName shortName = openmrsConcept.getShortNameInLocale(Context.getLocale()); if (shortName != null) { concept.setShortName(shortName.getName()); } return concept; }

Target:
private Concept mapConcept(org.openmrs.Concept openmrsConcept) { ConceptName fullySpecifiedName = openmrsConcept.getFullySpecifiedName(Context.getLocale()); if(fullySpecifiedName == null){ fullySpecifiedName = openmrsConcept.getFullySpecifiedName(getDefaultLocale()); } Concept concept = new Concept(openmrsConcept.getUuid(), fullySpecifiedName.getName()); ConceptName shortName = openmrsConcept.getShortNameInLocale(Context.getLocale()); if (shortName != null) { concept.setShortName(shortName.getName()); } return concept; }
Source:
public T convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { for (T t : type_.getEnumConstants()) { if (t.toString().equals(value)) { return t; } } String choices = TextHelper.concat(type_.getEnumConstants(), 0, ",", "{", "}"); throw new ArgumentParserException(String.format( TextHelper.LOCALE_ROOT, "could not convert '%s' (choose from %s)", value, choices), null, parser, arg); }

Target:
public T convert(ArgumentParser parser, Argument arg, String value) throws ArgumentParserException { for (T t : type_.getEnumConstants()) { if (t.toString().equals(value)) { return t; } } String choices = TextHelper.concat(type_.getEnumConstants(), 0, ",", "{", "}"); throw new ArgumentParserException(String.format( TextHelper.LOCALE_ROOT, "could not convert '%s' (choose from %s)", value, choices), parser, arg); }
Source:
public void onAsyncPlayerPreLoginEventHighest(AsyncPlayerPreLoginEvent event) { if (event.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { return; } final String name = event.getName(); if (validationService.isUnrestricted(name)) { return; } try { final PlayerAuth auth = dataSource.getAuth(name); final boolean isAuthAvailable = auth != null; onJoinVerifier.checkKickNonRegistered(isAuthAvailable); final JoiningPlayer joiningPlayer = JoiningPlayer.fromName(name); onJoinVerifier.checkAntibot(joiningPlayer, isAuthAvailable); onJoinVerifier.checkNameCasing(name, auth); final String ip = event.getAddress().getHostAddress(); onJoinVerifier.checkPlayerCountry(joiningPlayer, ip, isAuthAvailable); } catch (FailedVerificationException e) { event.setKickMessage(messages.retrieveSingle(name, e.getReason(), e.getArgs())); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); } }

Target:
public void onAsyncPlayerPreLoginEventHighest(AsyncPlayerPreLoginEvent event) { if (event.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { return; } final String name = event.getName(); if (validationService.isUnrestricted(name)) { return; } try { final PlayerAuth auth = dataSource.getAuth(name); final boolean isAuthAvailable = auth != null; onJoinVerifier.checkKickNonRegistered(isAuthAvailable); onJoinVerifier.checkAntibot(name, isAuthAvailable); onJoinVerifier.checkNameCasing(name, auth); final String ip = event.getAddress().getHostAddress(); onJoinVerifier.checkPlayerCountry(name, ip, isAuthAvailable); } catch (FailedVerificationException e) { event.setKickMessage(messages.retrieveSingle(name, e.getReason(), e.getArgs())); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); } }
Source:
public boolean isExist(KEY key) throws IOException { return cache.get(new CacheKey<>(key)) != null || rawTable.isExist(codecRegistry.asRawData(key)); }

Target:
public boolean isExist(KEY key) throws IOException { CacheValue<VALUE> cacheValue= cache.get(new CacheKey<>(key)); return (cacheValue != null && cacheValue.getValue() != null) || rawTable.isExist(codecRegistry.asRawData(key)); }
Source:
public void filter(final MethodNode methodNode, final IFilterContext context, final IFilterOutput output) { if ((methodNode.access & Opcodes.ACC_SYNTHETIC) == 0) { return; } if (methodNode.name.startsWith("lambda$")) { return; } if (methodNode.name.endsWith(KotlinDefaultArgumentsFilter.SUFFIX) && context.getClassAnnotations() .contains(KotlinGeneratedFilter.KOTLIN_METADATA_DESC)) { return; } output.ignore(methodNode.instructions.getFirst(), methodNode.instructions.getLast()); }

Target:
public void filter(final MethodNode methodNode, final IFilterContext context, final IFilterOutput output) { if ((methodNode.access & Opcodes.ACC_SYNTHETIC) == 0) { return; } if (methodNode.name.startsWith("lambda$")) { return; } if (KotlinDefaultArgumentsFilter .isDefaultArgumentsMethodName(methodNode.name) && KotlinGeneratedFilter.isKotlinClass(context)) { return; } output.ignore(methodNode.instructions.getFirst(), methodNode.instructions.getLast()); }
Source:
@Override public byte[] next() { if (modCount != expectedModCount) throw new ConcurrentModificationException(); if (isEmpty()) throw new NoSuchElementException(); try { Element current = readElement(nextElementPosition); byte[] buffer = new byte[current.length]; nextElementPosition = wrapPosition(current.position + Element.HEADER_LENGTH); ringRead(nextElementPosition, buffer, 0, current.length); nextElementPosition = wrapPosition(current.position + Element.HEADER_LENGTH + current.length); nextElementIndex++; return buffer; } catch (IOException e) { throw new RuntimeException("todo: throw a proper error", e); } }

Target:
@Override public byte[] next() { checkForComodification(); if (isEmpty()) throw new NoSuchElementException(); if (nextElementIndex >= elementCount) throw new NoSuchElementException(); try { Element current = readElement(nextElementPosition); byte[] buffer = new byte[current.length]; nextElementPosition = wrapPosition(current.position + Element.HEADER_LENGTH); ringRead(nextElementPosition, buffer, 0, current.length); nextElementPosition = wrapPosition(current.position + Element.HEADER_LENGTH + current.length); nextElementIndex++; return buffer; } catch (IOException e) { throw new RuntimeException("todo: throw a proper error", e); } }
Source:
public XBeePacket sendXBeePacket(final XBeePacket packet) throws InterfaceNotOpenException, InvalidOperatingModeException, IOException, TimeoutException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); switch (getOperatingMode()) { case AT: case UNKNOWN: default: throw new InvalidOperatingModeException(); case API: case API_ESCAPE: ArrayList<XBeePacket> responseList = new ArrayList<XBeePacket>(); if (packet instanceof XBeeAPIPacket) { if (!((XBeeAPIPacket)packet).needsAPIFrameID()) { sendXBeePacketAsync(packet); return null; } } else { sendXBeePacketAsync(packet); return null; } insertFrameID(packet); IPacketReceiveListener packetReceiveListener = createPacketReceivedListener(packet, responseList); dataReader.addPacketReceiveListener(packetReceiveListener); logger.debug("Sending XBee packet: \n{}", packet.toPrettyString()); writePacket(packet); try { synchronized (responseList) { try { responseList.wait(receiveTimeout); } catch (InterruptedException e) } if (responseList.size() < 1) throw new TimeoutException(); return responseList.get(0); } finally { dataReader.removePacketReceiveListener(packetReceiveListener); } } }

Target:
public XBeePacket sendXBeePacket(final XBeePacket packet) throws InterfaceNotOpenException, InvalidOperatingModeException, TimeoutException, IOException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); OperatingMode operatingMode = getOperatingMode(); switch (operatingMode) { case AT: case UNKNOWN: default: throw new InvalidOperatingModeException(operatingMode); case API: case API_ESCAPE: ArrayList<XBeePacket> responseList = new ArrayList<XBeePacket>(); if (packet instanceof XBeeAPIPacket) { if (!((XBeeAPIPacket)packet).needsAPIFrameID()) { sendXBeePacketAsync(packet); return null; } } else { sendXBeePacketAsync(packet); return null; } insertFrameID(packet); IPacketReceiveListener packetReceiveListener = createPacketReceivedListener(packet, responseList); dataReader.addPacketReceiveListener(packetReceiveListener); writePacket(packet); try { synchronized (responseList) { try { responseList.wait(receiveTimeout); } catch (InterruptedException e) } if (responseList.size() < 1) throw new TimeoutException(); return responseList.get(0); } finally { dataReader.removePacketReceiveListener(packetReceiveListener); } } }
Source:
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException { PrintStream logger = listener.getLogger(); EnvVars envVars = run.getEnvironment(listener); FilePath buildStepWorkspace = getBuildStepWorkspace(workspace); try { buildStepWorkspace.mkdirs(); } catch (IOException ex) { logger.println(ex.getMessage() + " : Permission denied"); run.setResult(Result.FAILURE); return; } boolean isVirtualenvInstallation = false; if (isGlobalBztInstalled(buildStepWorkspace, logger, launcher, envVars) || (isVirtualenvInstallation = installBztAndCheck(buildStepWorkspace, logger, launcher, envVars))) { int testExitCode = runPerformanceTest(buildStepWorkspace, logger, launcher, envVars, isVirtualenvInstallation); run.setResult(useBztExitCode ? getBztJobResult(testExitCode) : getJobResult(testExitCode) ); if (generatePerformanceTrend && run.getResult().isBetterThan(Result.FAILURE)) { generatePerformanceTrend(run, buildStepWorkspace, launcher, listener); } return; } run.setResult(Result.FAILURE); }

Target:
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException { PrintStream logger = listener.getLogger(); EnvVars envVars = run.getEnvironment(listener); FilePath buildStepWorkspace = getBuildStepWorkspace(workspace); try { buildStepWorkspace.mkdirs(); } catch (IOException ex) { logger.println("Cannot create directory because of error: " + ex.getMessage()); run.setResult(Result.FAILURE); return; } boolean isVirtualenvInstallation = false; if (isGlobalBztInstalled(buildStepWorkspace, logger, launcher, envVars) || (isVirtualenvInstallation = installBztAndCheck(buildStepWorkspace, logger, launcher, envVars))) { int testExitCode = runPerformanceTest(buildStepWorkspace, logger, launcher, envVars, isVirtualenvInstallation); run.setResult(useBztExitCode ? getBztJobResult(testExitCode) : getJobResult(testExitCode) ); if (generatePerformanceTrend && run.getResult().isBetterThan(Result.FAILURE)) { generatePerformanceTrend(run, buildStepWorkspace, launcher, listener); } return; } run.setResult(Result.FAILURE); }