auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public OpenShiftEnvironment convert(DockerImageEnvironment environment) throws ValidationException { final Map<String, InternalMachineConfig> machines = environment.getMachines(); if (!machines.keySet().iterator().hasNext()) { throw new ValidationException("Environment must contain at least one machine configuration"); } final String machineName = machines.keySet().iterator().next(); final String dockerImage = environment.getRecipe().getContent(); final Map<String, String> annotations = new HashMap<>(); annotations.put(format(MACHINE_NAME_ANNOTATION_FMT, CONTAINER_NAME), machineName); final Pod pod = new PodBuilder() .withNewMetadata() .withName(POD_NAME) .withAnnotations(annotations) .endMetadata() .withNewSpec() .withContainers( new ContainerBuilder().withImage(dockerImage).withName(CONTAINER_NAME).build()) .endSpec() .build(); return OpenShiftEnvironment.builder() .setMachines(machines) .setInternalRecipe(environment.getRecipe()) .setWarnings(environment.getWarnings()) .setPods(ImmutableMap.of(POD_NAME, pod)) .build(); }

Target:
public OpenShiftEnvironment convert(DockerImageEnvironment environment) throws InfrastructureException { final Iterator<String> iterator = environment.getMachines().keySet().iterator(); if (!iterator.hasNext()) { throw new InternalInfrastructureException( "DockerImage environment must contain at least one machine configuration"); } final String machineName = iterator.next(); final String dockerImage = environment.getRecipe().getContent(); final Map<String, String> annotations = new HashMap<>(); annotations.put(format(MACHINE_NAME_ANNOTATION_FMT, CONTAINER_NAME), machineName); final Pod pod = new PodBuilder() .withNewMetadata() .withName(POD_NAME) .withAnnotations(annotations) .endMetadata() .withNewSpec() .withContainers( new ContainerBuilder().withImage(dockerImage).withName(CONTAINER_NAME).build()) .endSpec() .build(); return OpenShiftEnvironment.builder() .setMachines(environment.getMachines()) .setInternalRecipe(environment.getRecipe()) .setWarnings(environment.getWarnings()) .setPods(ImmutableMap.of(POD_NAME, pod)) .build(); }
Source:
public void put(Collection<SinkRecord> records) { if (records.isEmpty()) { return; } final SinkRecord first = records.iterator().next(); final int recordsCount = records.size(); log.trace( "Received records. First record kafka coordinates:({}-{}-{}). Writing them to the " + "database...", recordsCount, first.topic(), first.kafkaPartition(), first.kafkaOffset() ); try { writer.write(records); } catch (SQLException sqle) { log.warn( "Write of records failed, remainingRetries={}", records.size(), remainingRetries, sqle ); String sqleAllMessages = ""; for (Throwable e : sqle) { sqleAllMessages += e.getMessage() + "\n"; } if (remainingRetries == 0) { throw new ConnectException(sqleAllMessages); } else { writer.closeQuietly(); initWriter(); remainingRetries--; context.timeout(config.retryBackoffMs); throw new RetriableException(sqleAllMessages); } } remainingRetries = config.maxRetries; }

Target:
public void put(Collection<SinkRecord> records) { if (records.isEmpty()) { return; } final SinkRecord first = records.iterator().next(); final int recordsCount = records.size(); log.trace( "Received records. First record kafka coordinates:({}-{}-{}). Writing them to the " + "database...", recordsCount, first.topic(), first.kafkaPartition(), first.kafkaOffset() ); try { writer.write(records); } catch (SQLException sqle) { log.warn( "Write of records failed, remainingRetries={}", records.size(), remainingRetries, sqle ); String sqleAllMessages = ""; for (Throwable e : sqle) { sqleAllMessages += e + System.lineSeparator(); } if (remainingRetries == 0) { throw new ConnectException(new SQLException(sqleAllMessages)); } else { writer.closeQuietly(); initWriter(); remainingRetries--; context.timeout(config.retryBackoffMs); throw new RetriableException(new SQLException(sqleAllMessages)); } } remainingRetries = config.maxRetries; }
Source:
protected void setupDocks() { final String basicFiltersScreenId = getBasicFiltersScreenId(); if (basicFiltersScreenId != null) { basicFiltersDock = new UberfireDock(UberfireDockPosition.WEST, IconType.FILTER.toString(), new DefaultPlaceRequest(basicFiltersScreenId), getPerspectiveId()).withSize(400).withLabel(Constants.INSTANCE.Filters()); uberfireDocks.add(basicFiltersDock); } final String advancedFiltersScreenId = getAdvancedFiltersScreenId(); if (advancedFiltersScreenId != null) { advancedFiltersDock = new UberfireDock(UberfireDockPosition.WEST, IconType.SEARCH_PLUS.toString(), new DefaultPlaceRequest(advancedFiltersScreenId), getPerspectiveId()).withSize(500).withLabel(Constants.INSTANCE.AdvancedFilters()); uberfireDocks.add(advancedFiltersDock); } final String savedFiltersScreenId = getSavedFiltersScreenId(); if (savedFiltersScreenId != null) { savedFiltersDock = new UberfireDock(UberfireDockPosition.WEST, IconType.STAR_O.toString(), new DefaultPlaceRequest(savedFiltersScreenId), getPerspectiveId()).withSize(400).withLabel(Constants.INSTANCE.SavedFilters()); uberfireDocks.add(savedFiltersDock); } }

Target:
protected void setupDocks() { final String basicFiltersScreenId = getBasicFiltersScreenId(); if (basicFiltersScreenId != null) { basicFiltersDock = new UberfireDock(UberfireDockPosition.WEST, IconType.FILTER.toString(), new DefaultPlaceRequest(basicFiltersScreenId), getPerspectiveId()).withSize(400).withLabel(Constants.INSTANCE.Filters()); uberfireDocks.add(basicFiltersDock); } final String advancedFiltersScreenId = getAdvancedFiltersScreenId(); if (advancedFiltersScreenId != null) { advancedFiltersDock = new UberfireDock(UberfireDockPosition.WEST, IconType.PLUS_SQUARE_O.toString(), new DefaultPlaceRequest(advancedFiltersScreenId), getPerspectiveId()).withSize(500).withLabel(Constants.INSTANCE.AdvancedFilters()); uberfireDocks.add(advancedFiltersDock); } final String savedFiltersScreenId = getSavedFiltersScreenId(); if (savedFiltersScreenId != null) { savedFiltersDock = new UberfireDock(UberfireDockPosition.WEST, IconType.STAR_O.toString(), new DefaultPlaceRequest(savedFiltersScreenId), getPerspectiveId()).withSize(400).withLabel(Constants.INSTANCE.SavedFilters()); uberfireDocks.add(savedFiltersDock); } }
Source:
public synchronized void stop() { if (initiatedShutdown) { LOG.debug("Job Coordinator shutdown is already in progress!"); return; } LOG.info("Shutting down Job Coordinator..."); initiatedShutdown = true; boolean shutdownSuccessful = false; metrics.isLeader.set(false); try { if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } debounceTimer.stopScheduler(); LOG.debug("Shutting down Zk Client."); if (leaderElector.amILeader()) { leaderElector.resignLeadership(); } if (zkUtils != null) { zkUtils.close(); } LOG.debug("Shutting down system admins."); systemAdmins.stop(); LOG.debug("Shutting down metrics."); shutdownMetrics(); if (coordinatorListener != null) { coordinatorListener.onCoordinatorStop(); } shutdownSuccessful = true; } catch (Throwable t) { LOG.error("Encountered errors during job coordinator stop.", t); if (coordinatorListener != null) { coordinatorListener.onCoordinatorFailure(t); } } finally { LOG.info("Job Coordinator shutdown finished with ShutdownComplete=" + shutdownSuccessful); } }

Target:
public void stop() { if (initiatedShutdown.compareAndSet(false, true)) { LOG.info("Shutting down JobCoordinator."); boolean shutdownSuccessful = false; metrics.isLeader.set(false); try { if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } debounceTimer.stopScheduler(); if (leaderElector.amILeader()) { LOG.info("Resigning leadership for processorId: " + processorId); leaderElector.resignLeadership(); } LOG.info("Shutting down ZkUtils."); if (zkUtils != null) { zkUtils.close(); } LOG.debug("Shutting down system admins."); systemAdmins.stop(); LOG.debug("Shutting down metrics."); shutdownMetrics(); if (coordinatorListener != null) { coordinatorListener.onCoordinatorStop(); } shutdownSuccessful = true; } catch (Throwable t) { LOG.error("Encountered errors during job coordinator stop.", t); if (coordinatorListener != null) { coordinatorListener.onCoordinatorFailure(t); } } finally { LOG.info("Job Coordinator shutdown finished with ShutdownComplete=" + shutdownSuccessful); } } else { LOG.info("Job Coordinator shutdown is in progress!"); } }
Source:
private Throwable getExceptionCause(Throwable throwable) { if (throwable.getClass().equals(ModuleException.class)) { return throwable.getCause() != null ? suppressIfPresent(throwable.getCause(), MessagingException.class) : new MuleRuntimeException(createStaticMessage(throwable.getMessage())); } else { return throwable; } }

Target:
private Throwable getExceptionCause(Throwable throwable) { if (throwable.getClass().equals(ModuleException.class)) { return throwable.getCause() != null ? suppressIfPresent(throwable.getCause(), MessagingException.class) : new MuleRuntimeException(createStaticMessage(throwable.getMessage())); } else { return suppressIfPresent(throwable, MessagingException.class); } }
Source:
public boolean performOk() { for (int i= 0; i < fCheckBoxes.size(); i++) { Button button= fCheckBoxes.get(i); String key= (String) button.getData(); IPreferenceStore nextStore = (IPreferenceStore) button.getData(PREFERENCE_STORE_KEY); nextStore.setValue(key, button.getSelection()); } IPreferenceStore store= getPreferenceStore(); for (int i= 0; i < fRadioButtons.size(); i++) { Button button= fRadioButtons.get(i); if (button.getSelection()) { String[] info= (String[]) button.getData(); store.setValue(info[0], info[1]); } } for (int i= 0; i < fTextControls.size(); i++) { Text text= fTextControls.get(i); String key= (String) text.getData(); store.setValue(key, text.getText()); } JavaPlugin.flushInstanceScope(); return super.performOk(); }

Target:
public boolean performOk() { for (int i= 0; i < fCheckBoxes.size(); i++) { Button button= fCheckBoxes.get(i); String key= (String) button.getData(); IPreferenceStore buttonPreferenceStore = (IPreferenceStore) button.getData(PREFERENCE_STORE_KEY); buttonPreferenceStore.setValue(key, button.getSelection()); } IPreferenceStore store= getPreferenceStore(); for (int i= 0; i < fRadioButtons.size(); i++) { Button button= fRadioButtons.get(i); if (button.getSelection()) { String[] info= (String[]) button.getData(); store.setValue(info[0], info[1]); } } for (int i= 0; i < fTextControls.size(); i++) { Text text= fTextControls.get(i); String key= (String) text.getData(); store.setValue(key, text.getText()); } JavaPlugin.flushInstanceScope(); return super.performOk(); }
Source:
public HaMaintenanceMode getMode() { return this.mode; }

Target:
public HaMaintenanceMode getMode() { return mode; }
Source:
public ProjectNegotiationData( String referencePointID, String projectName, boolean partial, FileList fileList) { this.fileList = fileList; this.referencePointName = projectName; this.projectID = referencePointID; this.partial = partial; }

Target:
public ProjectNegotiationData( String referencePointID, String projectName, boolean partial, FileList fileList) { this.fileList = fileList; this.referencePointName = projectName; this.referencePointID = referencePointID; this.partial = partial; }
Source:
public String getTableState( @ApiParam(value = "Name of the table to get its state", required = true) @PathParam("tableName") String tableName, @ApiParam(value = "realtime|offline", required = true) @QueryParam("type") String tableTypeStr ) { TableType tableType; try { tableType = TableType.valueOf(tableTypeStr.toUpperCase()); } catch (IllegalArgumentException e) { throw new ControllerApplicationException(LOGGER, "Illegal table type: " + tableTypeStr, Response.Status.BAD_REQUEST); } String tableNameWithType = TableNameBuilder.forType(tableType).tableNameWithType(tableName); try { ObjectNode data = JsonUtils.newObjectNode(); data.put("tableName", tableNameWithType); data.put("state", _pinotHelixResourceManager.isTableEnabled(tableNameWithType) ? "enabled" : "disabled"); return data.toString(); } catch (TableNotFoundException e) { throw new ControllerApplicationException(LOGGER, "Failed to find table: " + tableNameWithType, Response.Status.NOT_FOUND); } }

Target:
public String getTableState( @ApiParam(value = "Name of the table to get its state", required = true) @PathParam("tableName") String tableName, @ApiParam(value = "realtime|offline", required = true) @QueryParam("type") String tableTypeStr ) { TableType tableType; try { tableType = TableType.valueOf(tableTypeStr.toUpperCase()); } catch (IllegalArgumentException e) { throw new ControllerApplicationException(LOGGER, "Illegal table type: " + tableTypeStr, Response.Status.BAD_REQUEST); } String tableNameWithType = TableNameBuilder.forType(tableType).tableNameWithType(tableName); try { ObjectNode data = JsonUtils.newObjectNode(); data.put("state", _pinotHelixResourceManager.isTableEnabled(tableNameWithType) ? "enabled" : "disabled"); return data.toString(); } catch (TableNotFoundException e) { throw new ControllerApplicationException(LOGGER, "Failed to find table: " + tableNameWithType, Response.Status.NOT_FOUND); } }
Source:
private void validate() { if (countType == VCFHeaderLineCount.INTEGER && count <= 0) throw new IllegalArgumentException(String.format("Invalid count number, with fixed count the number should be 1 or higher: key=%s name=%s type=%s desc=%s lineType=%s count=%s", super.getKey(), name, type, description, lineType, count)); if (name == null || type == null || description == null || lineType == null) throw new IllegalArgumentException(String.format("Invalid VCFCompoundHeaderLine: key=%s name=%s type=%s desc=%s lineType=%s", super.getKey(), name, type, description, lineType)); if (name.contains("<") || name.contains(">")) throw new IllegalArgumentException("VCFHeaderLine: ID cannot contain angle brackets"); if (name.contains("=")) throw new IllegalArgumentException("VCFHeaderLine: ID cannot contain an equals sign"); if (type == VCFHeaderLineType.Flag && count != 0) { count = 0; if (GeneralUtils.DEBUG_MODE_ENABLED) { System.err.println("FLAG fields must have a count value of 0, but saw " + count + " for header line " + getID() + ". Changing it to 0 inside the code"); } } }

Target:
private void validate() { if (type != VCFHeaderLineType.Flag && countType == VCFHeaderLineCount.INTEGER && count <= 0) throw new IllegalArgumentException(String.format("Invalid count number, with fixed count the number should be 1 or higher: key=%s name=%s type=%s desc=%s lineType=%s count=%s", getKey(), name, type, description, lineType, count)); if (name == null || type == null || description == null || lineType == null) throw new IllegalArgumentException(String.format("Invalid VCFCompoundHeaderLine: key=%s name=%s type=%s desc=%s lineType=%s", getKey(), name, type, description, lineType)); if (name.contains("<") || name.contains(">")) throw new IllegalArgumentException("VCFHeaderLine: ID cannot contain angle brackets"); if (name.contains("=")) throw new IllegalArgumentException("VCFHeaderLine: ID cannot contain an equals sign"); if (type == VCFHeaderLineType.Flag && count != 0) { count = 0; if (GeneralUtils.DEBUG_MODE_ENABLED) { System.err.println("FLAG fields must have a count value of 0, but saw " + count + " for header line " + getID() + ". Changing it to 0 inside the code"); } } }
Source:
public void close() { throw new UnsupportedOperationException(format("%s should be closed directly", getClass())); }

Target:
public void close() { throw new UnsupportedOperationException(format("%s should not be closed directly", getClass())); }
Source:
private String formatDate(long date) { return dateFormat.format(new Date(date)); }

Target:
private static String formatDate(long date) { return dateFormat.format(new Date(date)); }
Source:
public void logout() { logoutButton.perform(click()); logoutConfirmationButton.perform(click()); }

Target:
public void logout() { scrollToThenClickOn(R.id.row_logout); clickOn(android.R.id.button1); }
Source:
private static Path getCacheDir(SitePaths site, String name) { Path loc = site.resolve(name).toPath(); if (loc == null) { return null; } if (!Files.exists(loc)) { try { Files.createDirectories(loc); } catch (IOException e) { log.warn("Can't create disk cache: " + loc.toAbsolutePath()); return null; } } if (!Files.isWritable(loc)) { log.warn("Can't write to disk cache: " + loc.toAbsolutePath()); return null; } log.info("Enabling disk cache " + loc.toAbsolutePath()); return loc; }

Target:
private static Path getCacheDir(SitePaths site, String name) { if (name == null) { return null; } Path loc = site.resolve(name).toPath(); if (!Files.exists(loc)) { try { Files.createDirectories(loc); } catch (IOException e) { log.warn("Can't create disk cache: " + loc.toAbsolutePath()); return null; } } if (!Files.isWritable(loc)) { log.warn("Can't write to disk cache: " + loc.toAbsolutePath()); return null; } log.info("Enabling disk cache " + loc.toAbsolutePath()); return loc; }
Source:
private static GitHub getGitHub() throws IOException { GitHubBuilder builder; try { builder = GitHubBuilder.fromCredentials(); } catch (IOException noAuthorizationDetails) { builder = new GitHubBuilder(); } OkHttpClient client = new OkHttpClient(); client.setCache(new Cache(Paths.get(".", ".cache").toFile(), FileUtils.ONE_MB * 10)); return builder .withConnector(new OkHttpConnector(new OkUrlFactory(client))) .build(); }

Target:
private static GitHub getGitHub() throws IOException { OkHttpClient client = new OkHttpClient(); client.setCache(new Cache(Paths.get(".", ".cache").toFile(), FileUtils.ONE_MB * 10)); return new GitHubBuilder() .withConnector(new RawGitOkHttpConnector(new OkUrlFactory(client))) .build(); }
Source:
public void setAndKeepttl() { String status = jedis.set(bfoo, binaryValue, setParams().nx().ex(expireSeconds)); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); status = jedis.set(bfoo, binaryValue, setParams().keepttl()); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); long ttl = jedis.ttl(bfoo); assertTrue(0 < ttl && ttl <= expireSeconds); }

Target:
public void setAndKeepttl() { String status = jedis.set(bfoo, binaryValue, setParams().nx().ex(expireSeconds)); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); status = jedis.set(bfoo, binaryValue, setParams().keepttl()); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); long ttl = jedis.ttl(bfoo); assertTrue(0 < ttl && ttl <= expireSeconds); jedis.set(bfoo, binaryValue); ttl = jedis.ttl(bfoo); assertTrue(ttl < 0); }
Source:
private void checkFieldType(String fieldName, long columnIndex, RealmFieldType expectedType) { RealmFieldType columnType = proxyState.getRow$realm().getColumnType(columnIndex); if (columnType != expectedType) { String indefiniteVowel = ""; if (expectedType == RealmFieldType.INTEGER || expectedType == RealmFieldType.LIST) { indefiniteVowel = "n"; } throw new IllegalArgumentException(String.format("'%s' is not a%s '%s', but a%s '%s'.", fieldName, indefiniteVowel, expectedType, indefiniteVowel, columnType)); } }

Target:
private void checkFieldType(String fieldName, long columnIndex, RealmFieldType expectedType) { RealmFieldType columnType = proxyState.getRow$realm().getColumnType(columnIndex); if (columnType != expectedType) { String expectedIndefiniteVowel = ""; if (expectedType == RealmFieldType.INTEGER || expectedType == RealmFieldType.OBJECT) { expectedIndefiniteVowel = "n"; } String columnTypeIndefiniteVowel = ""; if (expectedType == RealmFieldType.INTEGER || expectedType == RealmFieldType.OBJECT) { columnTypeIndefiniteVowel = "n"; } throw new IllegalArgumentException(String.format("'%s' is not a%s '%s', but a%s '%s'.", fieldName, expectedIndefiniteVowel, expectedType, columnTypeIndefiniteVowel, columnType)); } }
Source:
public void postExecution(ActionEvaluationResponse response) { if(response == null || null == response.getExecutedAction()) { return; } final ActionRequest request = response.getRequest(); final String metricKey = response.getExecutedAction().getMetricKey(); if(null == response.getException()) { MetricUtil.getInstance() .registerActionFailure(request.getOpcode(), metricKey, response.getElapsedTime()); } if(response.isCached()) { MetricUtil.getInstance().registerActionCacheHit(request.getOpcode(), metricKey); } else { MetricUtil.getInstance().registerActionCacheMiss(request.getOpcode(), metricKey); } MetricUtil.getInstance() .registerActionSuccess(request.getOpcode(), metricKey, response.getElapsedTime()); }

Target:
public void postExecution(ActionEvaluationResponse response) { if(null == response || null == response.getExecutedAction()) { return; } final ActionRequest request = response.getRequest(); final String metricKey = response.getExecutedAction().getMetricKey(); if(null == response.getException()) { MetricUtil.getInstance() .registerActionFailure(request.getOpcode(), metricKey, response.getElapsedTime()); } if(response.isCached()) { MetricUtil.getInstance().registerActionCacheHit(request.getOpcode(), metricKey); } else { MetricUtil.getInstance().registerActionCacheMiss(request.getOpcode(), metricKey); } MetricUtil.getInstance() .registerActionSuccess(request.getOpcode(), metricKey, response.getElapsedTime()); }
Source:
public String getPartitionId(RowData element) { keyBuffer.setLength(fixedPrefixLength); for (int i = fixedPrefix.length; i < dynamicFieldGetters.length; i++) { RowData.FieldGetter getter = dynamicFieldGetters[i]; Object fieldValue = getter.getFieldOrNull(element); keyBuffer.append(fieldValue); keyBuffer.append(delimiter); if (keyBuffer.length() >= MAX_PARTITION_KEY_LENGTH) { break; } } int length = Math.min( keyBuffer.length() - delimiter.length(), MAX_PARTITION_KEY_LENGTH); return keyBuffer.substring(0, length); }

Target:
public String getPartitionId(RowData element) { keyBuffer.setLength(keyBufferStaticPrefixLength); for (int i = fieldNamesStaticPrefixLength; i < fieldNames.size(); i++) { String fieldName = fieldNames.get(i); if (!staticFields.containsKey(fieldName)) { keyBuffer.append(dynamicFieldGetters.get(fieldName).getFieldOrNull(element)); } else { keyBuffer.append(staticFields.get(fieldName)); } keyBuffer.append(delimiter); if (keyBuffer.length() >= MAX_PARTITION_KEY_LENGTH) { break; } } int length = Math.min(keyBuffer.length() - delimiter.length(), MAX_PARTITION_KEY_LENGTH); return keyBuffer.substring(0, length); }
Source:
private static List<VisitableElement<?>> wrap(String property, String value, Double distance) { return Arrays.asList( new VisitableJsonElementImpl(FAKE_PROPERTY_OPERATOR, property), new VisitableJsonElementImpl(FAKE_DISTANCE_OPERATOR, distance), new VisitableJsonElementImpl(FAKE_VALUE_OPERATOR, Collections.singletonList(value))); }

Target:
private static List<VisitableElement<?>> wrap(String property, String value, Double distance) { return ImmutableList.of( new VisitableJsonElementImpl(FAKE_PROPERTY_OPERATOR, property), new VisitableJsonElementImpl(FAKE_DISTANCE_OPERATOR, distance), new VisitableJsonElementImpl(FAKE_VALUE_OPERATOR, Collections.singletonList(value))); }
Source:
private static BibEntry createABibEntryAuthor(String author) { BibEntry bibEntry = new BibEntry(); bibEntry.setField(StandardField.AUTHOR, author); return bibEntry; }

Target:
private static BibEntry createABibEntryAuthor(String author) { return new BibEntry().withField(StandardField.AUTHOR, author); }
Source:
private ProgramEnrollment getProgramEnrollment(String lookupName, Map<String, String> lookupFields, String configName) { List<ProgramEnrollment> programEnrollments = null; switch (lookupName) { case BY_MOTECH_ID_AND_PROGRAM_NAME: { programEnrollments = programEnrollmentService.getProgramEnrollmentByPatientMotechId(configName, lookupFields.get(PATIENT_MOTECH_ID)); break; } case BY_UUID_AMD_PROGRAM_NAME: { programEnrollments = programEnrollmentService.getProgramEnrollmentByPatientUuid(configName, lookupFields.get(PATIENT_UUID)); break; } default: { LOGGER.error("Lookup with name doesn't exist for patient object", lookupName); break; } } if(CollectionUtils.isNotEmpty(programEnrollments)) { List<ProgramEnrollment> filteredProgramEnrollments = new ArrayList<>(); for (ProgramEnrollment programEnrollment : programEnrollments) { if (programEnrollment.getProgram().getName().equals(lookupFields.get(PROGRAM_NAME))) { filteredProgramEnrollments.add(programEnrollment); } } if (CollectionUtils.isNotEmpty(filteredProgramEnrollments)) { return filteredProgramEnrollments.get(0); } } ProgramEnrollment notEnrolled = new ProgramEnrollment(); notEnrolled.setEnrolled(ProgramEnrollment.NOT_ENROLLED); return notEnrolled; }

Target:
private ProgramEnrollment getProgramEnrollment(String lookupName, Map<String, String> lookupFields, String configName) { List<ProgramEnrollment> programEnrollments = null; switch (lookupName) { case BY_MOTECH_ID_AND_PROGRAM_NAME: { programEnrollments = programEnrollmentService.getProgramEnrollmentByPatientMotechId(configName, lookupFields.get(PATIENT_MOTECH_ID)); break; } case BY_UUID_AMD_PROGRAM_NAME: { programEnrollments = programEnrollmentService.getProgramEnrollmentByPatientUuid(configName, lookupFields.get(PATIENT_UUID)); break; } default: { LOGGER.error("Lookup with name doesn't exist for patient object", lookupName); break; } } return filterByProgramName(programEnrollments, lookupFields.get(PROGRAM_NAME)); }
Source:
public void resetTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry) { Iterator<ITimeEvent> iterator = timeAnalysisEntry.getTimeEventsIterator(); TimeChartEvent event = null; boolean hasNext = true; while (!interrupted && hasNext) { synchronized (timeAnalysisEntry) { hasNext = iterator.hasNext(); event = (TimeChartEvent) iterator.next(); } if (hasNext) { event.setColorSettingPriority(ColorSettingsManager.PRIORITY_NONE); if (event.getItemizedEntry() != null) { resetTraceEntry(event.getItemizedEntry()); } } } }

Target:
public void resetTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry) { Iterator<ITimeEvent> iterator = timeAnalysisEntry.getTimeEventsIterator(); TimeChartEvent event = null; boolean hasNext = true; while (!interrupted && hasNext) { synchronized (timeAnalysisEntry) { while ((hasNext = iterator.hasNext()) == true) { event = (TimeChartEvent) iterator.next(); break; } } if (hasNext && event != null) { event.setColorSettingPriority(ColorSettingsManager.PRIORITY_NONE); if (event.getItemizedEntry() != null) { resetTraceEntry(event.getItemizedEntry()); } } } }
Source:
public void run() { for (int i = 0; i < 100; ++i) { try { WeakReference<Class<?>> ref = loadClassInLoader(); Runtime.getRuntime().gc(); } catch (Throwable e) { System.err.println(e); break; } } completed.set(true); }

Target:
public void run() { for (int i = 0; i < NUM_ITERATIONS; ++i) { try { WeakReference<Class<?>> ref = $noinline$loadClassInLoader(); Runtime.getRuntime().gc(); Thread.yield(); } catch (Throwable e) { System.err.println(e); break; } } completed.set(true); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); res = this.getResources(); app = (cgeoapplication) this.getApplication(); prefs = getSharedPreferences(Settings.preferences, Context.MODE_PRIVATE); base = new cgBase(app); Settings.setLanguage(Settings.isUseEnglish()); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); res = this.getResources(); app = (cgeoapplication) this.getApplication(); prefs = getSharedPreferences(Settings.preferences, Context.MODE_PRIVATE); base = new cgBase(app); }
Source:
public void testMessageDigest_MultipleThreads_Misuse() throws Exception { ExecutorService es = Executors.newFixedThreadPool(THREAD_COUNT); final CountDownLatch latch = new CountDownLatch(THREAD_COUNT); final MessageDigest md = MessageDigest.getInstance("SHA-256"); final byte[] message = new byte[64]; for (int i = 0; i < THREAD_COUNT; i++) { es.submit(new Callable<Void>() { @Override public Void call() throws Exception { latch.countDown(); for (int j = 0; j < 100; j++) { md.update(message); md.digest(); } return null; } }); } es.shutdown(); es.awaitTermination(1, TimeUnit.MINUTES); }

Target:
public void testMessageDigest_MultipleThreads_Misuse() throws Exception { ExecutorService es = Executors.newFixedThreadPool(THREAD_COUNT); final CountDownLatch latch = new CountDownLatch(THREAD_COUNT); final MessageDigest md = MessageDigest.getInstance("SHA-256"); final byte[] message = new byte[64]; for (int i = 0; i < THREAD_COUNT; i++) { es.submit(new Callable<Void>() { @Override public Void call() throws Exception { latch.countDown(); latch.await(); for (int j = 0; j < 100; j++) { md.update(message); md.digest(); } return null; } }); } es.shutdown(); assertTrue("Test should not timeout", es.awaitTermination(1, TimeUnit.MINUTES)); }
Source:
public void postAcknowledge(final MessageReference ref, AckReason reason) { QueueImpl queue = (QueueImpl) ref.getQueue(); queue.decDelivering(ref); if (isNonDestructive() && reason == AckReason.NORMAL) { ref.setInDelivery(false); } if (reason == AckReason.EXPIRED) { messagesExpired.incrementAndGet(); } else if (reason == AckReason.KILLED) { messagesKilled.incrementAndGet(); } else if (reason == AckReason.REPLACED) { messagesReplaced.incrementAndGet(); } else { messagesAcknowledged.incrementAndGet(); } if (ref.isPaged()) { return; } Message message; try { message = ref.getMessage(); } catch (Throwable e) { ActiveMQServerLogger.LOGGER.unableToPerformPostAcknowledge(e); message = null; } if (message == null || (isNonDestructive() && reason == AckReason.NORMAL)) return; boolean durableRef = message.isDurable() && queue.isDurable(); try { message.decrementRefCount(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorDecrementingRefCount(e); } if (durableRef) { int count = message.decrementDurableRefCount(); if (count == 0) { try { storageManager.deleteMessage(message.getMessageID()); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorRemovingMessage(e, message.getMessageID()); } } } }

Target:
public void postAcknowledge(final MessageReference ref, AckReason reason) { QueueImpl queue = (QueueImpl) ref.getQueue(); queue.decDelivering(ref); if (nonDestructive && reason == AckReason.NORMAL) { ref.setInDelivery(false); } if (reason == AckReason.EXPIRED) { messagesExpired.incrementAndGet(); } else if (reason == AckReason.KILLED) { messagesKilled.incrementAndGet(); } else if (reason == AckReason.REPLACED) { messagesReplaced.incrementAndGet(); } else { messagesAcknowledged.incrementAndGet(); } if (ref.isPaged()) { return; } Message message; try { message = ref.getMessage(); } catch (Throwable e) { ActiveMQServerLogger.LOGGER.unableToPerformPostAcknowledge(e); message = null; } if (message == null || (nonDestructive && reason == AckReason.NORMAL)) return; boolean durableRef = message.isDurable() && queue.isDurable(); try { message.decrementRefCount(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorDecrementingRefCount(e); } if (durableRef) { int count = message.decrementDurableRefCount(); if (count == 0) { try { storageManager.deleteMessage(message.getMessageID()); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorRemovingMessage(e, message.getMessageID()); } } } }
Source:
public Listener() { super("ListenerThread"); portBindMaxRetry = Integer.getInteger("zookeeper.electionPortBindRetry", 3); }

Target:
public Listener() { super("ListenerThread"); final Integer maxRetry = Integer.getInteger(ELECTION_PORT_BIND_RETRY, DEFAULT_PORT_BIND_MAX_RETRY); if (maxRetry >= 0) { LOG.info("Election port bind maximum retries is {}", maxRetry); portBindMaxRetry = maxRetry; } else { LOG.info("'{}' contains invalid value: {}(must be >= 0). " + "Use default value of instead.", ELECTION_PORT_BIND_RETRY, maxRetry, DEFAULT_PORT_BIND_MAX_RETRY); portBindMaxRetry = DEFAULT_PORT_BIND_MAX_RETRY; } }
Source:
public String toString() { StringBuilder result = new StringBuilder(); result.append("DashBoard settings{ New item registry : "); for (ItemRegistry item : this.newItemsRegistry) { result.append(item.toString()).append(" / "); } return result.append("}").toString(); }

Target:
public String toString() { return "DashboardSettings{" + "newItemsRegistry=" + newItemsRegistry + '}'; }
Source:
public CRUDHealth checkHealth() { boolean isHealthy = true; Collection<MongoConfiguration> configs = dbResolver.getConfigurations(); List<String> details = new ArrayList<>(configs.size()); DBObject ping = new BasicDBObject("ping", 1); for (MongoConfiguration config : configs) { try { CommandResult result = config.getDB().command(ping); if (!result.get("ok").equals(1.0)) { isHealthy = false; details.add(new StringBuilder(config.toString()).append("\n").append("ping:NOK").toString()); } else { details.add(new StringBuilder(config.toString()).append("\n").append("ping:OK").toString()); } } catch (Exception e) { isHealthy = false; details.add(new StringBuilder(config.toString()).append("\n").append("ping:").append(e).toString()); } } return new CRUDHealth(isHealthy, details.toString()); }

Target:
public CRUDHealth checkHealth() { boolean isHealthy = true; Collection<MongoConfiguration> configs = dbResolver.getConfigurations(); List<String> details = new ArrayList<>(configs.size()); DBObject ping = new BasicDBObject("ping", 1); for (MongoConfiguration config : configs) { try { CommandResult result = config.getDB().command(ping); if (!result.get("ok").equals(1.0)) { isHealthy = false; details.add(new StringBuilder(getMongoConfigDetails(config)).append("=>").append("ping:NOT_OK") .toString()); } else { details.add( new StringBuilder(getMongoConfigDetails(config)).append("=>").append("ping:OK").toString()); } } catch (Exception e) { isHealthy = false; details.add(new StringBuilder(getMongoConfigDetails(config)).append("=>").append("ping:").append(e) .toString()); } } return new CRUDHealth(isHealthy, details.toString()); }
Source:
public void testArbitaryElementsAreNotFiltered() { Object element = new Object(); Assert.assertFalse(element instanceof ITask); TaskReviewArtifactFilter filter = new TaskReviewArtifactFilter(); boolean wasntFiltered = filter.select(null, element); Assert.assertTrue(wasntFiltered); }

Target:
public void testArbitaryElementsAreNotFiltered() { Object element = new Object(); TaskReviewArtifactFilter filter = new TaskReviewArtifactFilter(); boolean wasFiltered = !filter.select(null, element); assertFalse(wasFiltered); }
Source:
public void updateUserProfile(AuthzToken authzToken, UserProfile userDetails) throws IamAdminServicesException, AuthorizationException, TException { TenantManagementKeycloakImpl keycloakclient = new TenantManagementKeycloakImpl(); try { String username = authzToken.getClaimsMap().get(Constants.USER_NAME); String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); if (!gatewayId.equals(userDetails.getGatewayId())) { throw new IamAdminServicesException("gatewayId in user profile doesn't match authorization token!"); } if (!username.equals(userDetails.getUserId())) { throw new IamAdminServicesException("userId in user profile doesn't match authorization token!"); } PasswordCredential credential = getTenantAdminPasswordCredential(gatewayId); keycloakclient.updateUserProfile(credential, gatewayId, username, userDetails); } catch (ApplicationSettingsException e) { throw new IamAdminServicesException("Unable to create service clients. Reason: " + e.getMessage()); } }

Target:
public void updateUserProfile(AuthzToken authzToken, UserProfile userDetails) throws IamAdminServicesException, AuthorizationException, TException { TenantManagementKeycloakImpl keycloakclient = new TenantManagementKeycloakImpl(); try { String username = authzToken.getClaimsMap().get(Constants.USER_NAME); String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); if (!gatewayId.equals(userDetails.getGatewayId())) { throw new IamAdminServicesException("gatewayId in user profile doesn't match authorization token!"); } if (!username.equals(userDetails.getUserId())) { String msg = "userId in user profile "+userDetails.getUserId()+" doesn't match authorization token "+username+""; logger.error(msg); throw new IamAdminServicesException("userId in user profile doesn't match authorization token!"); } PasswordCredential credential = getTenantAdminPasswordCredential(gatewayId); keycloakclient.updateUserProfile(credential, gatewayId, username, userDetails); } catch (ApplicationSettingsException e) { throw new IamAdminServicesException("Unable to create service clients. Reason: " + e.getMessage()); } }
Source:
public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); if (!player.hasPlayedBefore()) { for (Object map : kits.getKits().keySet()) { Kit kit = kits.getKits().get(map); if (CommandBook.inst().hasPermission(player, "commandbook.kits.onfirstlogin."+map)) { kit.distribute(player); } } } }

Target:
public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); if (!player.hasPlayedBefore()) { for (Entry<String, Kit> map : kits.getKits().entrySet()) { if (CommandBook.inst().hasPermission(player, "commandbook.kits.onfirstlogin." + map)) { map.getValue().distribute(player); } } } }
Source:
public HttpResponse doCreateAdminUser(StaplerRequest req, StaplerResponse rsp) throws IOException { Jenkins j = Jenkins.getInstance(); j.checkPermission(Jenkins.ADMINISTER); HudsonPrivateSecurityRealm securityRealm = (HudsonPrivateSecurityRealm)j.getSecurityRealm(); User admin = securityRealm.getUser(SetupWizard.initialSetupAdminUserName); try { if(admin != null) { admin.delete(); } User u = securityRealm.createAccountFromSetupWizard(req); if(admin != null) { admin = null; } try { getInitialAdminPasswordFile().delete(); } catch (InterruptedException e) { throw new IOException(e); } InstallUtil.proceedToNextStateFrom(InstallState.CREATE_ADMIN_USER); Authentication a = new UsernamePasswordAuthenticationToken(u.getId(),req.getParameter("password1")); a = securityRealm.getSecurityComponents().manager.authenticate(a); SecurityContextHolder.getContext().setAuthentication(a); CrumbIssuer crumbIssuer = Jenkins.getInstance().getCrumbIssuer(); JSONObject data = new JSONObject(); if (crumbIssuer != null) { data.accumulate("crumbRequestField", crumbIssuer.getCrumbRequestField()).accumulate("crumb", crumbIssuer.getCrumb(req)); } return HttpResponses.okJSON(data); } catch (AccountCreationFailedException e) { rsp.setStatus(400); return HttpResponses.forwardToView(securityRealm, "/jenkins/install/SetupWizard/setupWizardFirstUser.jelly"); } finally { if(admin != null) { admin.save(); } } }

Target:
public HttpResponse doCreateAdminUser(StaplerRequest req, StaplerResponse rsp) throws IOException { Jenkins j = Jenkins.getInstance(); j.checkPermission(Jenkins.ADMINISTER); HudsonPrivateSecurityRealm securityRealm = (HudsonPrivateSecurityRealm) j.getSecurityRealm(); User admin = securityRealm.getUser(SetupWizard.initialSetupAdminUserName); try { if (admin != null) { admin.delete(); } User newUser = securityRealm.createAccountFromSetupWizard(req); if (admin != null) { admin = null; } try { getInitialAdminPasswordFile().delete(); } catch (InterruptedException e) { throw new IOException(e); } InstallUtil.proceedToNextStateFrom(InstallState.CREATE_ADMIN_USER); Authentication auth = new UsernamePasswordAuthenticationToken(newUser.getId(), req.getParameter("password1")); auth = securityRealm.getSecurityComponents().manager.authenticate(auth); SecurityContextHolder.getContext().setAuthentication(auth); CrumbIssuer crumbIssuer = Jenkins.getInstance().getCrumbIssuer(); JSONObject data = new JSONObject(); if (crumbIssuer != null) { data.accumulate("crumbRequestField", crumbIssuer.getCrumbRequestField()).accumulate("crumb", crumbIssuer.getCrumb(req)); } return HttpResponses.okJSON(data); } catch (AccountCreationFailedException e) { rsp.setStatus(422); return HttpResponses.forwardToView(securityRealm, "/jenkins/install/SetupWizard/setupWizardFirstUser.jelly"); } finally { if (admin != null) { admin.save(); } } }
Source:
protected DfLastaFlutePhysicalHolder preparePhysicalHolder(File rootDir) { final DfLastaFlutePhysicalHolder physicalHolder = new DfLastaFlutePhysicalHolder(); final FileHierarchyTracer tracer = new FileHierarchyTracer(); tracer.trace(rootDir, new FileHierarchyTracingHandler() { @Override public boolean isTargetFileOrDir(File currentFile) { return true; } @Override public void handleFile(File currentFile) throws IOException { final String path = toPath(currentFile); if (path.contains("/app/web/") && path.endsWith("Action.java")) { physicalHolder.addAction(currentFile); } } }); return physicalHolder; }

Target:
protected DfLastaFlutePhysicalHolder preparePhysicalHolder(File rootDir) { final DfLastaFlutePhysicalHolder physicalHolder = new DfLastaFlutePhysicalHolder(); final FileHierarchyTracer tracer = new FileHierarchyTracer(); tracer.trace(rootDir, new FileHierarchyTracingHandler() { public boolean isTargetFileOrDir(File currentFile) { return true; } public void handleFile(File currentFile) throws IOException { final String path = toPath(currentFile); if (path.contains("/app/web/") && path.endsWith("Action.java")) { physicalHolder.addAction(currentFile); } } }); return physicalHolder; }
Source:
public SootMethodRef makeMethodRef(SootClass declaringClass, String name, List<Type> parameterTypes, Type returnType, boolean isStatic) { if (declaringClass.getName().equals(SootMethodRefHandleImpl.METHODHANDLE_SIGNATURE) || declaringClass.getName().equals(SootMethodRefHandleImpl.VARHANDLE_SIGNATURE)) { return new SootMethodRefHandleImpl(declaringClass, name, parameterTypes, returnType, isStatic); } return new SootMethodRefImpl(declaringClass, name, parameterTypes, returnType, isStatic); }

Target:
public SootMethodRef makeMethodRef(SootClass declaringClass, String name, List<Type> parameterTypes, Type returnType, boolean isStatic) { if (PolymorphicMethodRef.handlesClass(declaringClass)) { return new PolymorphicMethodRef(declaringClass, name, parameterTypes, returnType, isStatic); } return new SootMethodRefImpl(declaringClass, name, parameterTypes, returnType, isStatic); }
Source:
public SpongeSelector(SelectorType type, Map<String, String> arguments, boolean requiresLocation) { this.type = type; this.arguments = arguments; this.requiresLocation = requiresLocation; }

Target:
public SpongeSelector(SelectorType type, Map<String, String> arguments, boolean requiresLocation) { this.type = type; this.arguments = ImmutableMap.copyOf(arguments); this.requiresLocation = requiresLocation; }
Source:
protected CachingClusteredClient makeClient( final ListeningExecutorService backgroundExecutorService, final Cache cache, final int mergeLimit ) { return new CachingClusteredClient( WAREHOUSE, new TimelineServerView() { @Override public void registerSegmentCallback(Executor exec, SegmentCallback callback) { } @Override public VersionedIntervalTimeline<String, ServerSelector> getTimeline(DataSource dataSource) { return timeline; } @Override public <T> QueryRunner<T> getQueryRunner(DruidServer server) { return serverView.getQueryRunner(server); } @Override public void registerServerCallback(Executor exec, ServerCallback callback) { } }, cache, jsonMapper, backgroundExecutorService, new CacheConfig() { @Override public boolean isPopulateCache() { return true; } @Override public boolean isUseCache() { return true; } @Override public boolean isQueryCacheable(Query query) { return !query.isDescending(); } @Override public int getCacheBulkMergeLimit() { return mergeLimit; } } ); }

Target:
protected CachingClusteredClient makeClient( final ListeningExecutorService backgroundExecutorService, final Cache cache, final int mergeLimit ) { return new CachingClusteredClient( WAREHOUSE, new TimelineServerView() { @Override public void registerSegmentCallback(Executor exec, SegmentCallback callback) { } @Override public VersionedIntervalTimeline<String, ServerSelector> getTimeline(DataSource dataSource) { return timeline; } @Override public <T> QueryRunner<T> getQueryRunner(DruidServer server) { return serverView.getQueryRunner(server); } @Override public void registerServerCallback(Executor exec, ServerCallback callback) { } }, cache, jsonMapper, backgroundExecutorService, new CacheConfig() { @Override public boolean isPopulateCache() { return true; } @Override public boolean isUseCache() { return true; } @Override public boolean isQueryCacheable(Query query) { return true; } @Override public int getCacheBulkMergeLimit() { return mergeLimit; } } ); }
Source:
public static boolean isValidMtu(final Integer mtu) { if (mtu == null) { return false; } return MTU_MIN_SIZE <= mtu && mtu <= MTU_MAX_SIZE; }

Target:
public static boolean isValidMtu(final Integer mtu) { if (isNull(mtu)) { return false; } return (MTU_MIN_SIZE <= mtu) && (mtu <= MTU_MAX_SIZE); }
Source:
private static boolean isTextEqual(DetailAST instanceOfNode, DetailAST notEqualNode) { return getFullText(instanceOfNode).equals(getFullText(notEqualNode)); }

Target:
private static boolean isTextEqual(DetailAST instanceOfNode, DetailAST notEqualNode) { return instanceOfNode != null && isNullTest(notEqualNode) && getFullText(instanceOfNode).equals(getFullText(notEqualNode)); }
Source:
public void requestSpecialDays(final DlmsDeviceMessageMetadata messageMetadata, final SpecialDaysRequest specialDaysRequest) throws OsgpException, ProtocolAdapterException { LnClientConnection conn = null; try { final SpecialDaysRequestData specialDaysRequestData = specialDaysRequest.getSpecialDaysRequestData(); LOGGER.info("******************************************************"); LOGGER.info("********** Set Special Days: 0-0:11.0.0.255 **********"); LOGGER.info("******************************************************"); final List<SpecialDay> specialDays = specialDaysRequestData.getSpecialDays(); for (final SpecialDay specialDay : specialDays) { LOGGER.info("Date :{}, dayId : ", specialDay.getSpecialDayDate(), specialDay.getDayId()); } LOGGER.info("******************************************************"); final DlmsDevice device = this.domainHelperService.findDlmsDevice(messageMetadata); conn = this.dlmsConnectionFactory.getConnection(device); final AccessResultCode accessResultCode = this.setSpecialDaysCommandExecutor.execute(conn, device, specialDays); if (!AccessResultCode.SUCCESS.equals(accessResultCode)) { throw new ProtocolAdapterException("Set special days reported result is: " + accessResultCode); } } finally { if (conn != null) { conn.close(); } } }

Target:
public void requestSpecialDays(final DlmsDeviceMessageMetadata messageMetadata, final SpecialDaysRequest specialDaysRequest) throws OsgpException, ProtocolAdapterException { LnClientConnection conn = null; try { final SpecialDaysRequestData specialDaysRequestData = specialDaysRequest.getSpecialDaysRequestData(); LOGGER.info(VISUAL_SEPARATOR); LOGGER.info("********** Set Special Days: 0-0:11.0.0.255 **********"); LOGGER.info(VISUAL_SEPARATOR); final List<SpecialDay> specialDays = specialDaysRequestData.getSpecialDays(); for (final SpecialDay specialDay : specialDays) { LOGGER.info("Date :{}, dayId : ", specialDay.getSpecialDayDate(), specialDay.getDayId()); } LOGGER.info(VISUAL_SEPARATOR); final DlmsDevice device = this.domainHelperService.findDlmsDevice(messageMetadata); conn = this.dlmsConnectionFactory.getConnection(device); final AccessResultCode accessResultCode = this.setSpecialDaysCommandExecutor.execute(conn, device, specialDays); if (!AccessResultCode.SUCCESS.equals(accessResultCode)) { throw new ProtocolAdapterException("Set special days reported result is: " + accessResultCode); } } finally { if (conn != null) { conn.close(); } } }
Source:
public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnavailableException { Boolean result = propagateAgentEvent(hostId, Event.ShutdownRequested); if (result == null) { super.reconnect(hostId); } else { if (!result) { throw new CloudRuntimeException("Failed to propagating agent change request event:" + Event.ShutdownRequested + " to host:" + hostId); } } }

Target:
public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnavailableException { Boolean result = propagateAgentEvent(hostId, Event.ShutdownRequested); if (result == null) { super.reconnect(hostId); return; } if (!result) { throw new CloudRuntimeException("Failed to propagate agent change request event:" + Event.ShutdownRequested + " to host:" + hostId); } }