auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void loadData(Priority priority, final DataCallback<? super InputStream> callback) { Request.Builder requestBuilder = new Request.Builder().url(url.toStringUrl()); for (Map.Entry<String, String> headerEntry : url.getHeaders().entrySet()) { String key = headerEntry.getKey(); requestBuilder.addHeader(key, headerEntry.getValue()); } Request request = requestBuilder.build(); call = client.newCall(request); call.enqueue(new okhttp3.Callback() { @Override public void onFailure(Call call, IOException e) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "OkHttp failed to obtain result", e); } callback.onLoadFailed(e); } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()) { long contentLength = response.body().contentLength(); responseBody = response.body(); stream = ContentLengthInputStream.obtain(responseBody.byteStream(), contentLength); } else if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "OkHttp got error response: " + response.code() + ", " + response.message()); response.body().close(); } callback.onDataReady(stream); } }); }

Target:
public void loadData(Priority priority, final DataCallback<? super InputStream> callback) { Request.Builder requestBuilder = new Request.Builder().url(url.toStringUrl()); for (Map.Entry<String, String> headerEntry : url.getHeaders().entrySet()) { String key = headerEntry.getKey(); requestBuilder.addHeader(key, headerEntry.getValue()); } Request request = requestBuilder.build(); call = client.newCall(request); call.enqueue(new okhttp3.Callback() { @Override public void onFailure(Call call, IOException e) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "OkHttp failed to obtain result", e); } callback.onLoadFailed(e); } @Override public void onResponse(Call call, Response response) throws IOException { responseBody = response.body(); if (response.isSuccessful()) { long contentLength = response.body().contentLength(); stream = ContentLengthInputStream.obtain(responseBody.byteStream(), contentLength); } else if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "OkHttp got error response: " + response.code() + ", " + response.message()); } callback.onDataReady(stream); } }); }
Source:
public static ReplicationPeerConfig addBasePeerConfigsIfNotPresent(Configuration conf, ReplicationPeerConfig receivedPeerConfig){ boolean isPeerConfigChanged = false; String defaultPeerConfigs = conf.get(HBASE_REPLICATION_PEER_BASE_CONFIG,null); ReplicationPeerConfigBuilder copiedPeerConfigBuilder = ReplicationPeerConfig. newBuilder(receivedPeerConfig); Map<String,String> peerConfigurations = receivedPeerConfig.getConfiguration(); if (defaultPeerConfigs != null && defaultPeerConfigs.length() != 0) { String[] defaultPeerConfigList = defaultPeerConfigs.split(";"); for (String defaultPeerConfig : defaultPeerConfigList) { String[] configSplit = defaultPeerConfig.split("="); if (configSplit != null && configSplit.length == 2) { String configName = configSplit[0]; String configValue = configSplit[1]; if (!peerConfigurations.containsKey(configName)) { copiedPeerConfigBuilder.putConfiguration(configName,configValue); isPeerConfigChanged = true; } } } } return isPeerConfigChanged ? copiedPeerConfigBuilder.build() : null; }

Target:
public static ReplicationPeerConfig addBasePeerConfigsIfNotPresent(Configuration conf, ReplicationPeerConfig receivedPeerConfig) { String basePeerConfigs = conf.get(HBASE_REPLICATION_PEER_BASE_CONFIG, ""); ReplicationPeerConfigBuilder copiedPeerConfigBuilder = ReplicationPeerConfig. newBuilder(receivedPeerConfig); Map<String,String> receivedPeerConfigMap = receivedPeerConfig.getConfiguration(); if (basePeerConfigs.length() != 0) { Map<String, String> basePeerConfigMap = Splitter.on(';').trimResults().omitEmptyStrings() .withKeyValueSeparator("=").split(basePeerConfigs); for (Map.Entry<String,String> entry : basePeerConfigMap.entrySet()) { String configName = entry.getKey(); String configValue = entry.getValue(); if (!receivedPeerConfigMap.containsKey(configName)) { copiedPeerConfigBuilder.putConfiguration(configName, configValue); } } } return copiedPeerConfigBuilder.build(); }
Source:
protected void checkNonPrivateConstructor(EnhancedAnnotatedType<T> type) { if (type.getEnhancedConstructors().stream().anyMatch(c -> !c.isPrivate())) { return; } else { throw BeanLogger.LOG.decoratedMustHaveNonPrivateConstructor(this); } }

Target:
protected void checkNonPrivateConstructor(EnhancedAnnotatedType<T> type) { for (EnhancedAnnotatedConstructor<T> eac : type.getEnhancedConstructors()) { if (!eac.isPrivate() && (eac.getParameters().size() == 0 || eac.isAnnotationPresent(Inject.class))) { return; } } throw BeanLogger.LOG.decoratedMustHaveNonPrivateConstructor(this); }
Source:
private DiffConfig(final Config rc) { noPrefix = rc.getBoolean("diff", "noprefix", false); final String renameString = rc.getString("diff", null, "renames"); if ("copy".equals(renameString) || "copies".equals(renameString)) renameDetectionType = RenameDetectionType.COPY; else { final Boolean renameBoolean = StringUtils .toBooleanOrNull(renameString); renameDetectionType = Boolean.TRUE.equals(renameBoolean) ? RenameDetectionType.TRUE : RenameDetectionType.FALSE; } renameLimit = rc.getInt("diff", "renamelimit", 200); }

Target:
private DiffConfig(final Config rc) { noPrefix = rc.getBoolean("diff", "noprefix", false); renameDetectionType = parseRenameDetectionType(rc.getString("diff", null, "renames")); renameLimit = rc.getInt("diff", "renamelimit", 200); }
Source:
public String browseMessage(String processorName) throws AxisFault { SynapseConfiguration configuration = getSynapseConfiguration(); MessageConsumer messageConsumer = getMessageConsumer(configuration,processorName); String message = null; try { message = getMessageAsString(messageConsumer); } catch (AxisFault e) { handleException(log, "Failed to get message from the queue :", e); } messageConsumer.cleanup(); return message; }

Target:
public String browseMessage(String processorName) throws AxisFault { SynapseConfiguration configuration = getSynapseConfiguration(); MessageConsumer messageConsumer = getMessageConsumer(configuration,processorName); String message = null; try { message = getMessageAsString(messageConsumer); } catch (AxisFault e) { handleException(log, "Failed to get message from the queue :", e); } finally { messageConsumer.cleanup(); } return message; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_playbar, container, false); songTitle = (TextView) view.findViewById(R.id.text_now_playing); playPause = ((ImageButton) view.findViewById(R.id.btn_play_pause)); if(boundToPlaylistService){ updateView(); } playPause.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { PlaylistService service = getPlaylistService(); long state; if (service != null) { if (service.isPlaying()) { service.pause(); state = 0; } else { service.play(); state = 1; } smartSetPlayPauseImage(service); ((CoreActivity)getActivity()).getTracker().sendEvent( "ui_action", "click", "play_pause", state); } } }); ((ImageButton) view.findViewById(R.id.btn_skip)) .setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { PlaylistService service = getPlaylistService(); if(service != null){ service.skip(); ((CoreActivity)getActivity()).getTracker().sendEvent( "ui_action", "click", "skip", 0L); } } }); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_playbar, container, false); songTitle = (TextView) view.findViewById(R.id.text_now_playing); playPause = ((ImageButton) view.findViewById(R.id.btn_play_pause)); skip = (ImageButton) view.findViewById(R.id.btn_skip); if(boundToPlaylistService){ updateView(); } playPause.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { PlaylistService service = getPlaylistService(); if (service != null) { boolean intended = !service.isPlaying(); if (intended) { service.play(); } else { service.pause(); } smartSetPlayPauseImage(service); tracker.trackPlayPauseEvent(intended); } } }); playPause.setContentDescription(ContentDescriptionUtils.PLAY_PAUSE); skip.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { PlaylistService service = getPlaylistService(); if (service != null) { service.skip(); tracker.trackSkipEvent(); } } }); skip.setContentDescription(ContentDescriptionUtils.SKIP); return view; }
Source:
public FileAppender(Configuration conf, TaskAttemptId taskAttemptId, Schema schema, TableMeta meta, Path workDir) { this.conf = conf; this.meta = meta; this.schema = schema; this.workDir = workDir; this.taskAttemptId = taskAttemptId; try { if (taskAttemptId != null) { if (!(conf instanceof TajoConf)) { throw new IllegalArgumentException("Configuration must be a TajoConf instance"); } this.path = ((FileStorageManager)StorageManager.getFileStorageManager((TajoConf) conf)) .getAppenderFilePath(taskAttemptId, workDir); } else { this.path = workDir; } } catch (IOException e) { LOG.error(e.getMessage(), e); throw new IllegalStateException("Error while opeining FileAppender: " + e.getMessage(), e); } }

Target:
public FileAppender(Configuration conf, TaskAttemptId taskAttemptId, Schema schema, TableMeta meta, Path workDir) { this.conf = conf; this.meta = meta; this.schema = schema; this.workDir = workDir; this.taskAttemptId = taskAttemptId; try { if (taskAttemptId != null) { if (!(conf instanceof TajoConf)) { throw new IllegalArgumentException("Configuration must be an instance of TajoConf"); } this.path = ((FileStorageManager)StorageManager.getFileStorageManager((TajoConf) conf)) .getAppenderFilePath(taskAttemptId, workDir); } else { this.path = workDir; } } catch (IOException e) { LOG.error(e.getMessage(), e); throw new IllegalStateException("Error while opeining FileAppender: " + e.getMessage(), e); } }
Source:
EntityId(Change change) { this.prefix = change.entityId().substring(0, 1); int parsedId; try { parsedId = Integer.parseInt(change.entityId().substring(1)); } catch (NumberFormatException ignored) { parsedId = -1; } this.id = parsedId; }

Target:
EntityId(Change change) { this.prefix = change.entityId().charAt(0); Integer parsedId = Ints.tryParse(change.entityId().substring(1)); this.id = parsedId == null ? -1 : parsedId; }
Source:
public void resolveSuppressedMessagingExceptionLoggingCause() { ErrorType expected = DISPATCH; Throwable exception = new DispatchException(createStaticMessage("DISPATCH PROBLEM"), new ValidateResponse(), suppressIfPresent(new MessagingException(createStaticMessage("CONNECTION PROBLEM"), event), MessagingException.class, true)); MessagingException me = newMessagingException(exception, event, processor); MessagingExceptionResolver anotherResolver = new MessagingExceptionResolver(new TestProcessor()); MessagingException resolved = anotherResolver.resolve(me, locator, emptyList()); assertExceptionErrorType(resolved, expected); assertExceptionMessage(resolved.getMessage(), "DISPATCH PROBLEM"); assertExceptionMessage(resolved.getInfo().get(MuleExceptionInfo.INFO_CAUSED_BY_KEY).toString(), "CONNECTION PROBLEM"); }

Target:
public void resolveSuppressedMessagingExceptionLoggingCause() { ErrorType expected = DISPATCH; Throwable exception = new DispatchException(createStaticMessage("DISPATCH PROBLEM"), new ValidateResponse(), suppressIfPresent(new MessagingException(createStaticMessage("CONNECTION PROBLEM"), event), MessagingException.class)); MessagingException me = newMessagingException(exception, event, processor); MessagingExceptionResolver anotherResolver = new MessagingExceptionResolver(new TestProcessor()); MessagingException resolved = anotherResolver.resolve(me, locator, emptyList()); assertExceptionErrorType(resolved, expected); assertExceptionMessage(resolved.getMessage(), "DISPATCH PROBLEM"); assertExceptionMessage(resolved.getInfo().get(INFO_CAUSED_BY_KEY).toString(), "CONNECTION PROBLEM"); }
Source:
private Map<String, VdsNetworkInterface> getNicsToConfigureByNameWithoutLabelsUpdates() { Map<String, Bond> bondsByName = Entities.entitiesByName(getParameters().getBonds()); Map<String, VdsNetworkInterface> removedBondsByName = Entities.entitiesByName(getRemovedBonds()); List<VdsNetworkInterface> allHostNics = interfaceDao.getAllInterfacesForVds(getVdsId()); Map<String, VdsNetworkInterface> nicsByName = Entities.entitiesByName(allHostNics); for (Bond bond : getParameters().getBonds()) { if (bond.getId() == null) { Bond newBond = new Bond(bond.getName()); nicsByName.put(bond.getName(), newBond); } } nicsByName.putAll(bondsByName); nicsByName.putAll(removedBondsByName); return nicsByName; }

Target:
private Map<String, VdsNetworkInterface> getNicsToConfigureByNameWithoutLabelsUpdates() { Map<String, VdsNetworkInterface> removedBondsByName = Entities.entitiesByName(getRemovedBonds()); List<VdsNetworkInterface> allHostNics = interfaceDao.getAllInterfacesForVds(getVdsId()); Map<String, VdsNetworkInterface> nicsByName = Entities.entitiesByName(allHostNics); for (Bond bond : getParameters().getBonds()) { if (bond.getId() == null) { Bond newBond = new Bond(bond.getName()); nicsByName.put(bond.getName(), newBond); } } nicsByName.putAll(removedBondsByName); return nicsByName; }
Source:
public void edit(GlusterStorageModel object) { final GlusterStorageModel glusterStorageModel = object; driver.edit(object); glusterVolumesEditor.asEditor().setValue(object.getGlusterVolumes().getSelectedItem()); pathExampleLabel.setVisible(object.getPath().getIsAvailable() && object.getPath().getIsChangable()); glusterStorageModel.getLinkGlusterVolume().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { pathEditorRow.setVisible(!glusterStorageModel.getLinkGlusterVolume().getEntity()); pathExampleLabel.setVisible(!glusterStorageModel.getLinkGlusterVolume().getEntity()); glusterVolumesRow.setVisible(glusterStorageModel.getLinkGlusterVolume().getEntity()); } }); }

Target:
public void edit(GlusterStorageModel object) { final GlusterStorageModel glusterStorageModel = object; driver.edit(object); glusterVolumesEditor.asEditor().setValue(object.getGlusterVolumes().getSelectedItem()); pathExampleLabel.setVisible(object.getPath().getIsAvailable() && object.getPath().getIsChangable()); glusterStorageModel.getLinkGlusterVolume().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { boolean showEditor = !glusterStorageModel.getLinkGlusterVolume().getEntity(); pathEditorRow.setVisible(showEditor); pathExampleLabel.setVisible(showEditor); glusterVolumesRow.setVisible(!showEditor); } }); }
Source:
void onRenderTaskPostExecute() { mIsRendering = false; mTileRenderHandler.post( new Runnable() { @Override public void run() { if ( !mTransitionsEnabled ) { cleanup(); } if( mTileRenderListener != null ) { mTileRenderListener.onRenderComplete(); } invalidate(); requestRender(); } } ); }

Target:
void onRenderTaskPostExecute() { mIsRendering = false; mTileRenderHandler.post( mRenderPostExecuteRunnable ); }
Source:
protected Layout getLayout() { VStack root = new VStack(); root.setWidth100(); label = new Label("No job selected"); label.setWidth100(); label.setAlign(Alignment.CENTER); root.addMember(label); genericInformationGrid = new KeyValueGrid(GENERIC_INFORMATION_LABEL_TEXT); genericInformationGrid.showTopMargin(); genericInformationGrid.setWidth100(); genericInformationGrid.hide(); root.addMember(genericInformationGrid); variablesGrid = new KeyValueGrid(JOB_VARIABLES_LABEL_TEXT); variablesGrid.showTopMargin(); variablesGrid.setWidth100(); variablesGrid.hide(); root.addMember(variablesGrid); return root; }

Target:
protected Layout getLayout() { VStack root = new VStack(); root.setWidth100(); label = new Label("No job selected"); label.setWidth100(); label.setAlign(Alignment.CENTER); root.addMember(label); variablesGrid = new KeyValueGrid(JOB_VARIABLES_LABEL_TEXT); variablesGrid.showTopMargin(); variablesGrid.setWidth100(); variablesGrid.hide(); root.addMember(variablesGrid); genericInformationGrid = new KeyValueGrid(GENERIC_INFORMATION_LABEL_TEXT); genericInformationGrid.showTopMargin(); genericInformationGrid.setWidth100(); genericInformationGrid.hide(); root.addMember(genericInformationGrid); return root; }
Source:
protected void validateDemographics(PendingCertifiedProductDTO product) { super.validateDemographics(product); for(PendingCertificationResultDTO cert : product.getCertificationCriterion()) { if(cert.getMeetsCriteria() != null && cert.getMeetsCriteria() == Boolean.TRUE) { boolean gapEligibleAndTrue = false; if(certRules.hasCertOption(cert.getNumber(), CertificationResultRules.GAP) && cert.getGap() == Boolean.TRUE) { gapEligibleAndTrue = true; } if(!gapEligibleAndTrue && certRules.hasCertOption(cert.getNumber(), CertificationResultRules.TEST_TOOLS_USED) && !cert.getNumber().equals("170.314 (g)(1)") && !cert.getNumber().equals("170.314 (g)(2)") && !cert.getNumber().equals("170.314 (f)(3)") && (cert.getTestTools() == null || cert.getTestTools().size() == 0)) { product.getErrorMessages().add("Test Tools are required for certification " + cert.getNumber() + "."); } if(cert.getTestTools() != null && cert.getTestTools().size() > 0) { for(PendingCertificationResultTestToolDTO testTool : cert.getTestTools()) { if(testTool.getTestToolId() == null) { product.getErrorMessages().add("There was no test tool found matching '" + testTool.getName() + "' for certification " + cert.getNumber() + "."); } else { TestToolDTO tt = ttDao.getById(testTool.getTestToolId()); if(tt != null && tt.isRetired() && product.getIcs() == false) { product.getErrorMessages().add("Test Tool '" + testTool.getName() + "' for Certification Result '" + cert.getNumber() + "' has been retired for product with ICS=false."); } } } } } } }

Target:
protected void validateDemographics(PendingCertifiedProductDTO product) { super.validateDemographics(product); for(PendingCertificationResultDTO cert : product.getCertificationCriterion()) { if(cert.getMeetsCriteria() != null && cert.getMeetsCriteria() == Boolean.TRUE) { boolean gapEligibleAndTrue = false; if(certRules.hasCertOption(cert.getNumber(), CertificationResultRules.GAP) && cert.getGap() == Boolean.TRUE) { gapEligibleAndTrue = true; } if(!gapEligibleAndTrue && certRules.hasCertOption(cert.getNumber(), CertificationResultRules.TEST_TOOLS_USED) && !cert.getNumber().equals("170.314 (g)(1)") && !cert.getNumber().equals("170.314 (g)(2)") && !cert.getNumber().equals("170.314 (f)(3)") && (cert.getTestTools() == null || cert.getTestTools().size() == 0)) { product.getErrorMessages().add("Test Tools are required for certification " + cert.getNumber() + "."); } if(cert.getTestTools() != null && cert.getTestTools().size() > 0) { for(PendingCertificationResultTestToolDTO testTool : cert.getTestTools()) { if(testTool.getTestToolId() == null) { product.getErrorMessages().add("There was no test tool found matching '" + testTool.getName() + "' for certification " + cert.getNumber() + "."); } } } } } }
Source:
LogicalType convertToLogicalType(LogicalTypeAnnotation logicalTypeAnnotation) { return logicalTypeAnnotation.accept(new LogicalTypeConverterVisitor()).get(); }

Target:
LogicalType convertToLogicalType(LogicalTypeAnnotation logicalTypeAnnotation) { return logicalTypeAnnotation.accept(LOGICAL_TYPE_ANNOTATION_VISITOR).get(); }
Source:
public void setup() { qos = mock(HostNetworkQos.class); validator = new HostNetworkQosValidator(qos); nullValidator = new HostNetworkQosValidator(null); }

Target:
public void setup() { validator = new HostNetworkQosValidator(qos); nullValidator = new HostNetworkQosValidator(null); }
Source:
private Object proceedAndLog(final ProceedingJoinPoint point) throws Throwable { final String methodCallDetail = methodCallDetail(point); final String securityContextDetail = securityContextDetail(); final long startTime = System.currentTimeMillis(); try { logger.debug("Enter;[{}] {}", methodCallDetail, securityContextDetail); final Object result = point.proceed(); logger.debug("Return;[{}] ms:[{}] {}", result, System.currentTimeMillis() - startTime, securityContextDetail); return result; } catch (final Throwable e) { logger.debug("Exception;[{}] exception:[{}] ms:[{}] {}", methodCallDetail, e, System.currentTimeMillis() - startTime, securityContextDetail); throw e; } }

Target:
private Object proceedAndLog(final ProceedingJoinPoint point) throws Throwable { final String methodCallDetail = methodCallDetail(point); final String securityContextDetail = securityContextDetail(); final long startTime = System.currentTimeMillis(); try { logger.debug("Enter;[{}] {}", methodCallDetail, securityContextDetail); final Object result = point.proceed(); logger.debug("Return;[{}] ms:[{}]", result, System.currentTimeMillis() - startTime); return result; } catch (final Throwable e) { logger.debug("Exception;[{}] ms:[{}]", e, System.currentTimeMillis() - startTime); throw e; } }
Source:
public void testAutoPauseOnSendError() throws Exception { String[] cookieTopics = new String[] { "MacadamiaWhiteChocolateCookie", "AlmondCookie", "ChocolateChipCookie", "SaltyCaramelCookie" }; for (String topic: cookieTopics) { createTopic(_zkUtils, topic); } Datastream datastream = KafkaMirrorMakerConnectorTestUtils.createDatastream("cookieStream", _broker, "\\w+Cookie"); DatastreamTaskImpl task = new DatastreamTaskImpl(Collections.singletonList(datastream)); MockDatastreamEventProducer datastreamProducer = new MockDatastreamEventProducer((r) -> true); task.setEventProducer(datastreamProducer); KafkaMirrorMakerConnectorTask connectorTask = KafkaMirrorMakerConnectorTestUtils.createFlushlessKafkaMirrorMakerConnectorTask(task, true, 50, 100, Duration.ofDays(1)); KafkaMirrorMakerConnectorTestUtils.runKafkaMirrorMakerConnectorTask(connectorTask); for (String topic: cookieTopics) { KafkaMirrorMakerConnectorTestUtils.produceEvents(topic, 1, _kafkaCluster); } Assert.assertTrue(PollUtils.poll(() -> connectorTask.getAutoPausedSourcePartitions().size() == cookieTopics.length, POLL_PERIOD_MS, POLL_TIMEOUT_MS), "All topics should have had auto-paused partitions"); connectorTask.stop(); Assert.assertTrue(connectorTask.awaitStop(CONNECTOR_AWAIT_STOP_TIMEOUT_MS, TimeUnit.MILLISECONDS), "did not shut down on time"); }

Target:
public void testAutoPauseOnSendError() throws Exception { String[] cookieTopics = new String[] { "MacadamiaWhiteChocolateCookie", "AlmondCookie", "ChocolateChipCookie", "SaltyCaramelCookie" }; for (String topic : cookieTopics) { createTopic(_zkUtils, topic); } Datastream datastream = KafkaMirrorMakerConnectorTestUtils.createDatastream("cookieStream", _broker, "\\w+Cookie"); DatastreamTaskImpl task = new DatastreamTaskImpl(Collections.singletonList(datastream)); MockDatastreamEventProducer datastreamProducer = new MockDatastreamEventProducer((r) -> true); task.setEventProducer(datastreamProducer); KafkaMirrorMakerConnectorTask connectorTask = KafkaMirrorMakerConnectorTestUtils.createFlushlessKafkaMirrorMakerConnectorTask(task, true, 50, 100, Duration.ofDays(1)); KafkaMirrorMakerConnectorTestUtils.runKafkaMirrorMakerConnectorTask(connectorTask); for (String topic : cookieTopics) { KafkaMirrorMakerConnectorTestUtils.produceEvents(topic, 1, _kafkaCluster); } Assert.assertTrue(PollUtils.poll(() -> connectorTask.getAutoPausedSourcePartitions().size() == cookieTopics.length, POLL_PERIOD_MS, POLL_TIMEOUT_MS), "All topics should have had auto-paused partitions"); Assert.assertTrue(datastreamProducer.getEvents().isEmpty(), "No events should have been successfully sent"); connectorTask.stop(); Assert.assertTrue(connectorTask.awaitStop(CONNECTOR_AWAIT_STOP_TIMEOUT_MS, TimeUnit.MILLISECONDS), "did not shut down on time"); }
Source:
public String read(Record record) { UserIdReader userIdReader = new UserIdReader(); ClientSummaryReader clientReader = new ClientSummaryReader(); String timestamp = record.getTimestamp().toString(); String userId = userIdReader.read(record); String client = clientReader.read(record); return timestamp + ":" + userId + ":" + client; }

Target:
public String read(Record record) { Long timestamp = record.getTimestamp(); String userId = (new UserIdReader()).read(record); String client = (new ClientSummaryReader()).read(record); return Long.toString(timestamp) + ":" + userId + ":" + client; }
Source:
private void waitListIsRenderedAndClickOnItem(String nameOfCommand, Actions action) { testWebElementRenderChecker.waitElementIsRendered( String.format( " nameOfCommand)); action.release(); loadPageWait .until( ExpectedConditions.visibilityOfElementLocated( By.xpath(String.format(Locators.COMMAND_DROPDAWN, nameOfCommand)))) .click(); }

Target:
private void waitListIsRenderedAndClickOnItem(String nameOfCommand, Actions action) { testWebElementRenderChecker.waitElementIsRendered(By.id("commandsPopup")); action.release(); loadPageWait .until( ExpectedConditions.visibilityOfElementLocated( By.xpath(String.format(Locators.COMMAND_DROPDAWN, nameOfCommand)))) .click(); }
Source:
public void testCleartextTrafficPolicyWithFtpURLConnection() throws Exception { NetworkSecurityPolicy.setCleartextTrafficPermitted(true); byte[] serverReplyOnConnect = "220\r\n".getBytes("US-ASCII"); try (CapturingServerSocket server = new CapturingServerSocket(serverReplyOnConnect)) { URL url = new URL("ftp://localhost:" + server.getPort() + "/test.txt"); try { url.openConnection().getContent(); } catch (IOException expected) { } assertDataTransmittedByClient(server); } NetworkSecurityPolicy.setCleartextTrafficPermitted(false); try (CapturingServerSocket server = new CapturingServerSocket(serverReplyOnConnect)) { URL url = new URL("ftp://localhost:" + server.getPort() + "/test.txt"); try { url.openConnection().getContent(); fail(); } catch (IOException expected) { } assertNoDataTransmittedByClient(server); } }

Target:
public void testCleartextTrafficPolicyWithFtpURLConnection() throws Exception { NetworkSecurityPolicy.setCleartextTrafficPermitted(true); byte[] serverReplyOnConnect = "220\r\n".getBytes("US-ASCII"); try (CapturingServerSocket server = new CapturingServerSocket(serverReplyOnConnect)) { URL url = new URL("ftp://localhost:" + server.getPort() + "/test.txt"); try { url.openConnection().getContent(); fail(); } catch (IOException expected) { } server.assertDataTransmittedByClient(); } NetworkSecurityPolicy.setCleartextTrafficPermitted(false); try (CapturingServerSocket server = new CapturingServerSocket(serverReplyOnConnect)) { URL url = new URL("ftp://localhost:" + server.getPort() + "/test.txt"); try { url.openConnection().getContent(); fail(); } catch (IOException expected) { } server.assertNoDataTransmittedByClient(); } }
Source:
private void onAddedOrUpdated() { Object newValue = inMemoryFormat == OBJECT ? entry.getValue() : entry.getByPrioritizingDataValue(); if (backup) { recordStore.putBackup(dataKey, newValue, NOT_WAN); } else { recordStore.setWithUncountedAccess(dataKey, newValue, entry.getNewTtl(), UNSET); if (mapOperation.isPostProcessing(recordStore)) { Record record = recordStore.getRecord(dataKey); newValue = record == null ? null : record.getValue(); entry.setValueByInMemoryFormat(inMemoryFormat, newValue); } mapServiceContext.interceptAfterPut(mapContainer.getInterceptorRegistry(), newValue); stats.incrementPutLatencyNanos(getLatencyNanos(startTimeNanos)); } }

Target:
private void onAddedOrUpdated() { Object newValue = inMemoryFormat == OBJECT ? entry.getValue() : entry.getByPrioritizingDataValue(); if (backup) { recordStore.putBackup(dataKey, newValue, entry.getNewTtl(), UNSET, NOT_WAN); } else { recordStore.setWithUncountedAccess(dataKey, newValue, entry.getNewTtl(), UNSET); if (mapOperation.isPostProcessing(recordStore)) { Record record = recordStore.getRecord(dataKey); newValue = record == null ? null : record.getValue(); entry.setValueByInMemoryFormat(inMemoryFormat, newValue); } mapServiceContext.interceptAfterPut(mapContainer.getInterceptorRegistry(), newValue); stats.incrementPutLatencyNanos(getLatencyNanos(startTimeNanos)); } }
Source:
public void onServerStarting(SpongeServerStartingEvent event) { event.game.getLogger().info("Hey...my implementation's server is starting?"); event.game.getCommandManager().registerCommand(new HelloWorldCommand()); public void onServerStarting(ServerStartingEvent event) { event.getGame().getLogger().info("Hey...my implementation's server is starting?"); } }

Target:
public void onServerStarting(SpongeServerStartingEvent event) { event.game.getLogger().info("Hey...my implementation's server is starting?"); event.game.getCommandManager().registerCommand(new HelloWorldCommand()); }
Source:
private void handleConnection(final Socket client) { logger.debug("Client connected", client.getRemoteSocketAddress()); try { LanguageServerImpl languageServer = Guice.createInjector(new RuntimeServerModule()) .getInstance(LanguageServerImpl.class); Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(languageServer, client.getInputStream(), client.getOutputStream()); languageServer.connect(launcher.getRemoteProxy()); Future<?> future = launcher.startListening(); future.get(); } catch (IOException e) { logger.error("Error communicating with the LSP client", e); } catch (InterruptedException e) { } catch (ExecutionException e) { logger.error("Error running the Language Server", e); } logger.debug("Client disconnected", client.getRemoteSocketAddress()); }

Target:
private void handleConnection(final Socket client) { logger.debug("Client connected", client.getRemoteSocketAddress()); try { LanguageServerImpl languageServer = Guice.createInjector(new RuntimeServerModule()) .getInstance(LanguageServerImpl.class); Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(languageServer, client.getInputStream(), client.getOutputStream()); languageServer.connect(launcher.getRemoteProxy()); Future<?> future = launcher.startListening(); future.get(); } catch (IOException e) { logger.warn("Error communicating with LSP client {}", client.getRemoteSocketAddress()); } catch (InterruptedException e) { } catch (ExecutionException e) { logger.error("Error running the Language Server", e); } logger.debug("Client disconnected", client.getRemoteSocketAddress()); }
Source:
public void awaitCompletion() { if (getQueue() == null) return; while (!getQueue().isEmpty()) { processInput(); } }

Target:
public void awaitCompletion() { try { if (getQueue() == null) return; while (getQueue() != null && !getQueue().isEmpty()) { processInput(); } getCallerThreadPoolExecutor().awaitTermination(); } catch (Throwable throwable) { throw new RuntimeException("Error occurred while awaiting termination "+throwable.getMessage()); } }
Source:
public void deactivate() { getDiagramEventBroker().removeNotificationListener(hostView.eContainer(), this); super.deactivate(); }

Target:
public void deactivate() { unsubscribe(hostView.eContainer()); super.deactivate(); }
Source:
private Json getTags(CreateFreeIpaRequest source, Stack stack, String userCrn, String userName) { try { Map<String, String> userDefined = source.getTags(); if (userDefined == null) { userDefined = new HashMap<>(); } return new Json(new StackTags(userDefined, new HashMap<>(), getDefaultTags(stack, userCrn, userName))); } catch (Exception ignored) { throw new BadRequestException("Failed to convert dynamic tags." + ignored.getMessage()); } }

Target:
private Json getTags(CreateFreeIpaRequest source, Stack stack, String userCrn, String userName) { try { Map<String, String> userDefined = source.getTags(); if (userDefined == null) { userDefined = new HashMap<>(); } return new Json(new StackTags(userDefined, new HashMap<>(), getDefaultTags(stack, userCrn, userName))); } catch (Exception ignored) { throw new BadRequestException("Failed to convert dynamic tags: " + ignored.getMessage(), ignored); } }
Source:
@Override protected boolean onDone(@Nullable Boolean res, @Nullable Throwable err, boolean cancel) { lock.lock(); try { if (!super.onDone(res, err, cancel)) return false; if (!(cctx.database() instanceof GridCacheDatabaseSharedManager)) return true; ((GridCacheDatabaseSharedManager)cctx.database()).removeCheckpointListener(checkpointLsnr); if (!isCancelled() && !isFailed()) return true; if (log.isInfoEnabled()) log.info("Cancelling File preloading [topVer=" + topVer + "]"); if (snapshotFut != null && !snapshotFut.isDone()) { if (log.isDebugEnabled()) log.debug("Cancelling snapshot creation [fut=" + snapshotFut + "]"); snapshotFut.cancel(); } for (GridFutureAdapter fut : futAssigns.values()) fut.onDone(); if (isFailed()) log.error("File preloading failed [topVer=" + topVer + "]", err); return true; } catch (IgniteCheckedException e) { if (err != null) e.addSuppressed(err); log.error("Failed to cancel File preloading.", e); } finally { lock.unlock(); } return false; }

Target:
@Override protected boolean onDone(@Nullable Boolean res, @Nullable Throwable err, boolean cancel) { lock.lock(); try { if (!super.onDone(res, err, cancel)) return false; if (!(cctx.database() instanceof GridCacheDatabaseSharedManager)) return true; restoreHnd.stop(); if (!isCancelled() && !isFailed()) return true; if (log.isInfoEnabled()) log.info("Cancelling File preloading [topVer=" + topVer + "]"); if (snapshotFut != null && !snapshotFut.isDone()) { if (log.isDebugEnabled()) log.debug("Cancelling snapshot creation [fut=" + snapshotFut + "]"); snapshotFut.cancel(); } for (GridFutureAdapter fut : futAssigns.values()) fut.onDone(); if (isFailed()) log.error("File preloading failed [topVer=" + topVer + "]", err); return true; } catch (IgniteCheckedException e) { if (err != null) e.addSuppressed(err); log.error("Failed to cancel File preloading.", e); } finally { lock.unlock(); } return false; }
Source:
protected void onMethodInvocationFound(MethodInvocationTree mit) { reportIssue(mit, "Validate argument is not coming from a user input. Sanitize it if this is the case."); }

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { reportIssue(mit, "Validate that properties are not set by user input. Sanitize it if this is the case."); }
Source:
private MenuItem updateChangeMilestoneMenuItem() { Optional<GuiElement> item = listView.getSelectedItem(); if (item.isPresent()) { changeMilestoneMenuItem.setDisable(false); } else { changeMilestoneMenuItem.setDisable(true); } return changeMilestoneMenuItem; }

Target:
private MenuItem updateChangeMilestoneMenuItem() { Optional<GuiElement> selectedItem = listView.getSelectedItem(); changeMilestoneMenuItem.setDisable(!selectedItem.isPresent()); return changeMilestoneMenuItem; }
Source:
public void onPlayerDeath(PlayerDeathEvent e) { Player player = e.getEntity().getPlayer(); DamageCause dmgCause = player.getLastDamageCause().getCause(); if (dmgCause != DamageCause.VOID || !Talisman.checkFor(e, SlimefunItems.TALISMAN_RESURRECTED)) return; Location loc = e.getEntity().getPlayer().getBedSpawnLocation(); if (loc == null) loc = player.getLocation().getWorld().getSpawnLocation(); final Location respawnLocation = loc; Bukkit.getScheduler().runTaskLater(SlimefunPlugin.instance(), () -> { player.teleport(respawnLocation); }, 2); }

Target:
public void onPlayerDeath(PlayerDeathEvent e) { Player player = e.getEntity(); DamageCause dmgCause = player.getLastDamageCause().getCause(); ItemStack talisman = Talisman.tryActivateAndGet(e, SlimefunItems.TALISMAN_RESURRECTED); if (dmgCause == DamageCause.VOID && talisman != null) { SlimefunPlugin.runSync(() -> PaperLib.teleportAsync(player, getSafeRespawnLocation(talisman, player)), 2); } }
Source:
private static TempFile createSingleColumnMapFileWithNullValues(Type mapType, int rows) throws IOException, ReflectiveOperationException, SerDeException { @SuppressWarnings("deprecation") Serializer serde = new OrcSerde(); TempFile tempFile = new TempFile(); FileSinkOperator.RecordWriter writer = createOrcRecordWriter(tempFile.getFile(), ORC_12, CompressionKind.NONE, mapType); SettableStructObjectInspector objectInspector = createSettableStructObjectInspector("test", mapType); Object row = objectInspector.create(); StructField field = objectInspector.getAllStructFieldRefs().get(0); for (int i = 1; i <= rows; i++) { HashMap<Long, Long> map = new HashMap<Long, Long>(); for (int j = 1; j <= 8; j++) { Long value = Long.valueOf(j); map.put(value, value); } map.put(null, Long.valueOf(0)); map.put(Long.valueOf(0), null); objectInspector.setStructFieldData(row, field, map); Writable record = serde.serialize(row, objectInspector); writer.write(record); } writer.close(false); return tempFile; }

Target:
private static TempFile createSingleColumnMapFileWithNullValues(Type mapType, int rows) throws IOException, ReflectiveOperationException, SerDeException { Serializer serde = new OrcSerde(); TempFile tempFile = new TempFile(); FileSinkOperator.RecordWriter writer = createOrcRecordWriter(tempFile.getFile(), ORC_12, CompressionKind.NONE, mapType); SettableStructObjectInspector objectInspector = createSettableStructObjectInspector("test", mapType); Object row = objectInspector.create(); StructField field = objectInspector.getAllStructFieldRefs().get(0); for (int i = 1; i <= rows; i++) { HashMap<Long, Long> map = new HashMap<>(); for (int j = 1; j <= 8; j++) { Long value = (long) j; map.put(value, value); } map.put(null, 0L); map.put(0L, null); objectInspector.setStructFieldData(row, field, map); Writable record = serde.serialize(row, objectInspector); writer.write(record); } writer.close(false); return tempFile; }
Source:
private Object[] ensureCapacity(int capacity) { Object[] array = (Object[]) holder; if (capacity > array.length) { array = Arrays.copyOf(array, Math.max(capacity, array.length * 2)); holder = array; } return array; }

Target:
private Object[] ensureCapacity(int capacity) { Object[] array = (Object[]) holder; if (capacity > array.length) { int newCapacity = array.length << 1; if (newCapacity < 0) newCapacity = MAX_ARRAY_SIZE; if (capacity < 0 || capacity > newCapacity) { throw new OutOfMemoryError(); } array = Arrays.copyOf(array, Math.max(capacity, newCapacity)); holder = array; } return array; }
Source:
public void update() { if (screenGrabber.isTakingScreenshot()) { fullScale.set(renderingConfig.getScreenshotSize().getWidth(Display.getWidth()), renderingConfig.getScreenshotSize().getHeight(Display.getHeight())); regenerateFbos(); wasTakingScreenshotLastFrame = true; } else { if (wasTakingScreenshotLastFrame) { updateFullScale(); regenerateFbos(); wasTakingScreenshotLastFrame = false; } } }

Target:
public void update() { if (!screenGrabber.isTakingScreenshot()) { if (wasTakingScreenshotLastFrame) { updateFullScale(); regenerateFbos(); wasTakingScreenshotLastFrame = false; } } else { ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize(); fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()), screenshotSize.getHeight(Display.getHeight())); regenerateFbos(); wasTakingScreenshotLastFrame = true; } }
Source:
public int anyUpdateQuery(QueryBuilder query) { try (Connection c = ds.getConnection()) { LOGGER.log(Level.FINEST, query.toString()); PreparedStatement stmt = query.toStatement(c); try { return stmt.executeUpdate(); } finally { stmt.close(); } } catch (SQLException ex) { throw new IllegalStateException("UpdateQuery Failed",ex); } }

Target:
public int anyUpdateQuery(QueryBuilder query) { LOGGER.log(Level.FINEST, query.toString()); try (Connection c = ds.getConnection()) { try (PreparedStatement stmt = query.toStatement(c)) { return stmt.executeUpdate(); } } catch (SQLException ex) { throw new IllegalStateException("UpdateQuery Failed",ex); } }
Source:
public void testNewTempDir() { int CREATE_CNT = 2000; Collection<File> folders = new ArrayList<File>(CREATE_CNT); try { for (int i = 0; i < CREATE_CNT; i++) { try { folders.add(Os.newTempDir(OsTest.class)); } catch (IllegalStateException e) { log.warn("testNewTempDir failed at " + i + " iteration."); Exceptions.propagate(e); } } } finally { for (File folder : folders) { folder.delete(); } } }

Target:
public void testNewTempDir() { int CREATE_CNT = 5000; Collection<File> folders = new ArrayList<File>(CREATE_CNT); try { for (int i = 0; i < CREATE_CNT; i++) { try { folders.add(Os.newTempDir(OsTest.class)); } catch (IllegalStateException e) { log.warn("testNewTempDir failed at " + i + " iteration."); Exceptions.propagate(e); } } } finally { for (File folder : folders) { folder.delete(); } } }
Source:
public static boolean isValidFile(IFile file) { String fileExtension = file.getFileExtension(); if (!fileExtension.equals(JS_EXT)) { return false; } if (file.exists() && file.isAccessible()) { String filePath = file.getFullPath().toOSString(); if (filePath != null && !filePath.contains(NODE_MODULES_FOLDER) && !filePath.contains(BOWER_COMPONENTS_FOLDER)) { return true; } } return false; }

Target:
private boolean isValidFile(IFile file) { String fileExtension = file.getFileExtension(); if (!fileExtension.equals(JS_EXT)) { return false; } if (file.exists() && file.isAccessible()) { String filePath = file.getFullPath().toOSString(); if (filePath != null && !filePath.contains(NODE_MODULES_FOLDER) && !filePath.contains(BOWER_COMPONENTS_FOLDER)) { return true; } } return false; }
Source:
private void setParagraphConfig(InterpreterContext context) { String replName = context.getReplName(); if (StringUtils.equals(currentReplName, replName)) { currentReplName = context.getReplName(); needUpdateConfig = true; } if (needUpdateConfig) { needUpdateConfig = false; if (currentReplName.equals("submarine") || currentReplName.isEmpty()) { context.getConfig().put("editorHide", true); context.getConfig().put("title", false); } else { context.getConfig().put("editorHide", false); context.getConfig().put("title", true); } } }

Target:
private void setParagraphConfig(InterpreterContext context) { context.getConfig().put("editorHide", true); context.getConfig().put("title", false); }
Source:
protected IStatus run(IProgressMonitor monitor) { final List<EventSet> sets; synchronized (fQueue) { sets = new ArrayList<>(fQueue); fQueue.clear(); } for (EventSet set : sets) { if (!requiresExpressionEvaluation(set)) { dispatch(set); } else { Job job = new AbstractDispatchJob("JDI Expression Evaluation Event Dispatch") { @Override protected IStatus run(IProgressMonitor monitor) { dispatch(set); return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); } } return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { final List<EventSet> sets; synchronized (fQueue) { sets = new ArrayList<>(fQueue); fQueue.clear(); } for (EventSet set : sets) { if (isShutdown()) { return Status.CANCEL_STATUS; } if (!requiresExpressionEvaluation(set)) { dispatch(set); } else { Job job = new AbstractDispatchJob("JDI Expression Evaluation Event Dispatch") { @Override protected IStatus run(IProgressMonitor monitor) { dispatch(set); return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); } } return Status.OK_STATUS; }
Source:
public JdbcSecurityRealm(List<QueryConfiguration> queryConfiguration) { this.queryConfiguration = queryConfiguration; }

Target:
JdbcSecurityRealm(List<QueryConfiguration> queryConfiguration) { this.queryConfiguration = queryConfiguration; }
Source:
public String generateName(Sample t) { if (!LimsUtils.isDetailedSample(t)) { throw new IllegalArgumentException("Can only generate an alias for detailed samples"); } SampleAdditionalInfo detailed = (SampleAdditionalInfo) t; for (SampleAdditionalInfo parent = detailed.getParent(); parent != null; parent = parent.getParent()) { if (isAliquotSample(parent) || isStockSample(parent)) { return parent.getAlias() + getSiblingTag(detailed); } if (isTissueSample(parent)) { return parent.getAlias() + getSiblingTag(detailed); } if (isIdentitySample(parent)) { if (!isTissueSample(detailed)) throw new IllegalArgumentException("Missing parent tissue"); return generateTissueAlias((SampleTissue) detailed, (Identity) parent); } } throw new IllegalArgumentException("Cannot generate alias for Identities"); }

Target:
public String generateName(Sample t) { if (!LimsUtils.isDetailedSample(t)) { throw new IllegalArgumentException("Can only generate an alias for detailed samples"); } SampleAdditionalInfo detailed = (SampleAdditionalInfo) t; for (SampleAdditionalInfo parent = (SampleAdditionalInfo) detailed.getParent(); parent != null; parent = (SampleAdditionalInfo) parent.getParent()) { if (isAliquotSample(parent)) { return parent.getAlias() + getSiblingTag(detailed); } if (isTissueSample(parent)) { return parent.getAlias() + getSiblingTag(detailed); } if (isIdentitySample(parent)) { if (!isTissueSample(detailed)) throw new IllegalArgumentException("Missing parent tissue"); return generateTissueAlias((SampleTissue) detailed, (Identity) parent); } } throw new IllegalArgumentException("Cannot generate alias for Identities"); }
Source:
private JobContext prepareJobContext(String instance) { Set<Integer> _taskPartitionSet; Map<Integer, TaskPartitionState> _taskPartitionStateMap; Map<Integer, String> _partitionToTaskIDMap; Map<Integer, String> _taskToInstanceMap; _taskPartitionSet = new HashSet<>(); _taskPartitionStateMap = new HashMap<>(); _partitionToTaskIDMap = new HashMap<>(); _taskToInstanceMap = new HashMap<>(); _taskPartitionSet.add(0); _taskPartitionStateMap.put(0, TaskPartitionState.RUNNING); _partitionToTaskIDMap.put(0, "0"); String someInstance = INSTANCE_PREFIX + 0; _taskToInstanceMap.put(0, someInstance); ZNRecord record = new ZNRecord(JOB_NAME); JobContext jobContext = new JobContext(record); jobContext.setStartTime(0L); jobContext.setName(JOB_NAME); jobContext.setStartTime(0L); jobContext.setPartitionState(0, TaskPartitionState.RUNNING); jobContext.setPartitionTarget(0, instance); jobContext.setPartitionTarget(0, TARGET_RESOURCES + "_0"); return jobContext; }

Target:
private JobContext prepareJobContext(String instance) { ZNRecord record = new ZNRecord(JOB_NAME); JobContext jobContext = new JobContext(record); jobContext.setStartTime(0L); jobContext.setName(JOB_NAME); jobContext.setStartTime(0L); jobContext.setPartitionState(0, TaskPartitionState.RUNNING); jobContext.setPartitionTarget(0, instance); jobContext.setPartitionTarget(0, TARGET_RESOURCES + "_0"); return jobContext; }
Source:
public void onDeviceOnLine() { this.logger.info("ISY is now online"); UDProxyDevice device = getDevice(); if (device == null) { return; } if (this.logger.isDebugEnabled()) { this.logger.debug("Supported controls:"); try { for (UDControl control : getControls().values()) { this.logger.debug(String.format(" %s, %s %s", control.name, control.desc, control.isNumeric && control.numericUnit != null ? control.numericUnit : "")); if (control.actions != null && !control.actions.isEmpty()) { for (UDAction action : control.actions.values()) { this.logger.debug(String.format(" %s %s %s", action.name, action.label, action.desc != null ? action.desc : "")); } } } } catch (NoDeviceException e) { this.logger.warn("Failed to get device", e); } } if (device.isSecurityEnabled() || device.securityLevel > UPnPSecurity.NO_SECURITY) { if (device.isAuthenticated && device.isOnline) { return; } try { this.logger.info("Authenticating..."); if (!authenticate(this.user, this.password)) { this.logger.warn("Authentication failed"); return; } else { this.logger.info("Authenticated"); } } catch (NoDeviceException ne) { this.logger.error("No device", ne); } } else { device.subscribeToEvents(true); } }

Target:
public void onDeviceOnLine() { this.logger.info("ISY is now online"); UDProxyDevice device = getDevice(); if (device == null) { return; } if (this.logger.isDebugEnabled()) { this.logger.debug("Supported controls:"); try { for (UDControl control : getControls().values()) { this.logger.debug(String.format(" %s, %s %s", control.name, control.desc, control.isNumeric && control.numericUnit != null ? control.numericUnit : "")); if (control.actions != null && !control.actions.isEmpty()) { for (UDAction action : control.actions.values()) { this.logger.debug(String.format(" %s %s %s", action.name, action.label, action.desc != null ? action.desc : "")); } } } } catch (NoDeviceException e) { this.logger.warn("Failed to get device", e); } } if (device.isSecurityEnabled() || device.securityLevel > UPnPSecurity.NO_SECURITY) { if (device.isAuthenticated && device.isOnline) { return; } try { this.logger.info("Authenticating..."); if (!authenticate(this.user, this.password)) { this.logger.warn("Authentication failed"); return; } else { this.logger.info("Authenticated"); } } catch (NoDeviceException ne) { this.logger.warn("No device", ne); } } else { device.subscribeToEvents(true); } }