auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void sendTo(UnifiedMessage unifiedMessage) { StringBuilder sb = buildUrl("selected"); final Map<String, Object> selectedPayloadObject = new LinkedHashMap<String, Object>(); if (unifiedMessage.getAliases() != null && !unifiedMessage.getAliases().isEmpty()) { selectedPayloadObject.put("alias", unifiedMessage.getAliases()); } if(unifiedMessage.getCategory() != null) { selectedPayloadObject.put("category", unifiedMessage.getCategory()); } if(unifiedMessage.getDeviceType() != null && !unifiedMessage.getDeviceType().isEmpty()) { selectedPayloadObject.put("deviceType", unifiedMessage.getDeviceType()); } if(unifiedMessage.getVariants() != null && !unifiedMessage.getVariants().isEmpty()) { selectedPayloadObject.put("variants", unifiedMessage.getVariants()); } if(unifiedMessage.getSimplePushMap()!= null && !unifiedMessage.getSimplePushMap().isEmpty()) { selectedPayloadObject.put("simple-push", unifiedMessage.getSimplePushMap()); } selectedPayloadObject.put("message", unifiedMessage.getAttributes()); String payload = transformJSON(selectedPayloadObject); submitPayload(sb.toString(), payload, unifiedMessage.getPushApplicationId(), unifiedMessage.getMasterSecret()); }

Target:
public void sendTo(UnifiedMessage unifiedMessage) { StringBuilder sb = buildUrl("selected"); final Map<String, Object> selectedPayloadObject = new LinkedHashMap<String, Object>(); if (!isEmpty(unifiedMessage.getAliases())) { selectedPayloadObject.put("alias", unifiedMessage.getAliases()); } if (!isEmpty(unifiedMessage.getCategory())) { selectedPayloadObject.put("category", unifiedMessage.getCategory()); } if (!isEmpty(unifiedMessage.getDeviceType())) { selectedPayloadObject.put("deviceType", unifiedMessage.getDeviceType()); } if (!isEmpty(unifiedMessage.getVariants())) { selectedPayloadObject.put("variants", unifiedMessage.getVariants()); } if (!isEmpty(unifiedMessage.getSimplePushMap())) { selectedPayloadObject.put("simple-push", unifiedMessage.getSimplePushMap()); } if (!isEmpty(unifiedMessage.getAttributes())) { selectedPayloadObject.put("message", unifiedMessage.getAttributes()); } String payload = transformJSON(selectedPayloadObject); submitPayload(sb.toString(), payload, unifiedMessage.getPushApplicationId(), unifiedMessage.getMasterSecret()); }
Source:
public String retrieveStatusOfWorkflow(String uuid) throws InternalWorkflowException { Connection connection = null; PreparedStatement prepStmt = null; ResultSet rs = null; String query = SQLConstants.GET_WORKFLOW_REQUEST_QUERY; try { connection = IdentityDatabaseUtil.getDBConnection(); prepStmt = connection.prepareStatement(query); prepStmt.setString(1, uuid); rs = prepStmt.executeQuery(); if (rs.next()) { String status = rs.getString(SQLConstants.REQUEST_STATUS_COLUMN); return status; } } catch (IdentityException e) { throw new InternalWorkflowException("Error when connecting to the Identity Database.", e); } catch (SQLException e) { throw new InternalWorkflowException("Error when executing the sql query:" + query, e); } finally { IdentityDatabaseUtil.closeAllConnections(connection, null, prepStmt); } return ""; }

Target:
public String retrieveStatusOfWorkflow(String uuid) throws InternalWorkflowException { Connection connection = null; PreparedStatement prepStmt = null; ResultSet resultSet = null; String query = SQLConstants.GET_WORKFLOW_REQUEST_QUERY; try { connection = IdentityDatabaseUtil.getDBConnection(); prepStmt = connection.prepareStatement(query); prepStmt.setString(1, uuid); resultSet = prepStmt.executeQuery(); if (resultSet.next()) { String status = resultSet.getString(SQLConstants.REQUEST_STATUS_COLUMN); return status; } } catch (IdentityException e) { throw new InternalWorkflowException("Error when connecting to the Identity Database.", e); } catch (SQLException e) { throw new InternalWorkflowException("Error when executing the sql query:" + query, e); } finally { IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt); } return ""; }
Source:
public void oSType_SelectedItemChanged() { if (getModel().getOSType().getSelectedItem() != null) { EmulatedMachine em = AsyncDataProvider.getInstance().emulatedMachineByOs(getModel().getOSType().getSelectedItem()); if (getModel().getEmulatedMachine().getIsAvailable()) { getModel().getEmulatedMachine().setSelectedItem(em); } } }

Target:
public void oSType_SelectedItemChanged() { updateEmulatedMachines(); }
Source:
private RNASequence readGenbankRNAResource(final String resource) throws Exception { RNASequence sequence = null; InputStream inputStream = null; try { inputStream = getClass().getResourceAsStream(resource); GenbankReader<RNASequence, NucleotideCompound> genbankRNA = new GenbankReader<>( inputStream, new GenericGenbankHeaderParser<>(), new RNASequenceCreator(RNACompoundSet.getRNACompoundSet()) ); LinkedHashMap<String, RNASequence> rnaSequences = genbankRNA.process(); sequence = rnaSequences.values().iterator().next(); } finally { try { inputStream.close(); } catch (Exception e) { } } return sequence; }

Target:
private RNASequence readGenbankRNAResource(final String resource) throws IOException, CompoundNotFoundException { InputStream inputStream = getClass().getResourceAsStream(resource); GenbankReader<RNASequence, NucleotideCompound> genbankRNA = new GenbankReader<>( inputStream, new GenericGenbankHeaderParser<>(), new RNASequenceCreator(RNACompoundSet.getRNACompoundSet()) ); LinkedHashMap<String, RNASequence> rnaSequences = genbankRNA.process(); return rnaSequences.values().iterator().next(); }
Source:
public void lineBreak() { delegate.lineBreak(); }

Target:
public void lineBreak() { assertOpenBlock(); delegate.lineBreak(); }
Source:
private synchronized void flushWrittenBytesToServiceInternal(final long offset, final boolean retainUncommitedData, final boolean isClose) throws IOException { AbfsPerfTracker tracker = client.getAbfsPerfTracker(); try (AbfsPerfInfo perfInfo = new AbfsPerfInfo(tracker, "flushWrittenBytesToServiceInternal", "flush")) { AbfsRestOperation op = client.flush(path, offset, retainUncommitedData, isClose, this.authzStatus); perfInfo.registerResult(op.getResult()).registerSuccess(true); } catch (AzureBlobFileSystemException ex) { if (ex instanceof AbfsRestOperationException) { if (((AbfsRestOperationException) ex).getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { throw new FileNotFoundException(ex.getMessage()); } } if ((ex instanceof AbfsAuthorizationException) || (ex instanceof AbfsAuthorizerUnhandledException)) { throw ex; } throw new IOException(ex); } this.lastFlushOffset = offset; }

Target:
private synchronized void flushWrittenBytesToServiceInternal(final long offset, final boolean retainUncommitedData, final boolean isClose) throws IOException { AbfsPerfTracker tracker = client.getAbfsPerfTracker(); try (AbfsPerfInfo perfInfo = new AbfsPerfInfo(tracker, "flushWrittenBytesToServiceInternal", "flush")) { AbfsRestOperation op = client.flush(path, offset, retainUncommitedData, isClose); perfInfo.registerResult(op.getResult()).registerSuccess(true); } catch (AzureBlobFileSystemException ex) { if (ex instanceof AbfsRestOperationException) { if (((AbfsRestOperationException) ex).getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { throw new FileNotFoundException(ex.getMessage()); } } throw new IOException(ex); } this.lastFlushOffset = offset; }
Source:
private void migrateDiscoveryGroup(ModelNode newAddOp, List<String> warnings) { boolean mandatorySocketBinding = false; for (String property : asList(LOCAL_BIND_ADDRESS.getName(), GROUP_ADDRESS.getName(), GROUP_PORT.getName())) { if (newAddOp.has(property)) { newAddOp.remove(property); warnings.add(ROOT_LOGGER.couldNotMigrateDiscoveryGroupAttribute(property, pathAddress(newAddOp.get(OP_ADDR)))); mandatorySocketBinding = true; } } if (mandatorySocketBinding) newAddOp.get(SOCKET_BINDING.getName()).set("group-x-binding"); removePropertiesWithExpression(newAddOp, warnings, JGROUPS_CHANNEL.getName(), JGROUPS_STACK.getName()); }

Target:
private void migrateDiscoveryGroup(ModelNode newAddOp, List<String> warnings) { boolean mandatorySocketBinding = false; for (String property : asList(LOCAL_BIND_ADDRESS.getName(), GROUP_ADDRESS.getName(), GROUP_PORT.getName())) { if (newAddOp.has(property)) { newAddOp.remove(property); warnings.add(ROOT_LOGGER.couldNotMigrateDiscoveryGroupAttribute(property, pathAddress(newAddOp.get(OP_ADDR)))); mandatorySocketBinding = true; } } if (mandatorySocketBinding) { newAddOp.get(SOCKET_BINDING.getName()).set("group-s-binding"); } List<String> removed = removePropertiesWithExpression(newAddOp, warnings, JGROUPS_CHANNEL.getName(), JGROUPS_STACK.getName()); if (!removed.isEmpty() && !mandatorySocketBinding) { newAddOp.get(SOCKET_BINDING.getName()).set("group-s-binding"); } }
Source:
public JobCoordinator getJobCoordinator(String processorId, Config config, MetricsRegistry metricsRegistry) { String jobCoordinatorZkBasePath = getJobCoordinationZkPath(config); ZkUtils zkUtils = getZkUtils(config, metricsRegistry, jobCoordinatorZkBasePath); LOG.debug("Creating ZkJobCoordinator with config: {}.", config); ZkMetadataStore metadataStore = new ZkMetadataStore(zkUtils.getKeyBuilder().getRootPath(), config, metricsRegistry); metadataStore.init(); return new ZkJobCoordinator(processorId, config, metricsRegistry, zkUtils, metadataStore); }

Target:
public JobCoordinator getJobCoordinator(String processorId, Config config, MetricsRegistry metricsRegistry) { String jobCoordinatorZkBasePath = getJobCoordinationZkPath(config); ZkUtils zkUtils = getZkUtils(config, metricsRegistry, jobCoordinatorZkBasePath); LOG.debug("Creating ZkJobCoordinator with config: {}.", config); ZkMetadataStore metadataStore = new ZkMetadataStore(zkUtils.getKeyBuilder().getRootPath(), config, metricsRegistry); return new ZkJobCoordinator(processorId, config, metricsRegistry, zkUtils, metadataStore); }
Source:
public final void retrievesForks() throws Exception { final Iterable<Fork> forks = RtForksITCase.repo().forks() .iterate("newest"); MatcherAssert.assertThat(forks, Matchers.notNullValue()); int count = 0; for (final Fork fork : forks) { MatcherAssert.assertThat(fork, Matchers.notNullValue()); count += 1; } MatcherAssert.assertThat( "Test repo should have at leas 1 fork", count, Matchers.greaterThan(0) ); }

Target:
public final void retrievesForks() throws Exception { final String organization = System.getProperty( "failsafe.github.organization" ); Assume.assumeThat(organization, Matchers.notNullValue()); final Repo repo = RtForksITCase.repos().create( Json.createObjectBuilder().add( "name", RandomStringUtils.randomNumeric(5) ).build() ); try { final Fork fork = repo.forks().create(organization); MatcherAssert.assertThat(fork, Matchers.notNullValue()); final Iterable<Fork> forks = repo.forks().iterate("newest"); MatcherAssert.assertThat(forks, Matchers.notNullValue()); MatcherAssert.assertThat( forks, Matchers.not(Matchers.emptyIterable()) ); MatcherAssert.assertThat( forks, Matchers.contains(fork) ); } finally { RtForksITCase.repos().remove(repo.coordinates()); } }
Source:
public SSLContext createSSLContext(ZKConfig config) throws SSLContextException { if (config.getProperty(sslClientContextProperty) != null) { LOG.debug("Loading SSLContext from property '" + sslClientContextProperty + "'"); String sslClientContextClass = config.getProperty(sslClientContextProperty); try { Class<?> sslContextClass = Class.forName(sslClientContextClass); ZKClientSSLContext sslContext = (ZKClientSSLContext) sslContextClass.getConstructor().newInstance(); return sslContext.getSSLContext(); } catch (ClassNotFoundException | ClassCastException | NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) { throw new SSLContextException("Could not retrieve the SSLContext from source '" + sslClientContextClass + "' provided in the property '" + sslClientContextProperty + "'", e); } } else { return createSSLContextFromConfig(config); } }

Target:
public SSLContext createSSLContext(ZKConfig config) throws SSLContextException { return createSSLContextAndOptions(config).getSSLContext(); }
Source:
private Map executeCommand(String lines, InterpreterContext context, Map<String, Integer> userSessionMap) throws LivyException { String json; try { json = executeHTTP(property.get("zeppelin.livy.url") + "/sessions/" + userSessionMap.get(context.getAuthenticationInfo().getUser()) + "/statements", "POST", "{\"code\": \"" + StringEscapeUtils.escapeJson(lines) + "\"}", context.getParagraphId()); } catch (Exception e) { throw new LivyException("Error executing command in Livy", e); } if (json == null || json.matches("^(\")?Session (\'[0-9]\' )?not found(.?\"?)$")) { throw new LivyNoSessionException(); } try { Map jsonMap = gson.fromJson(json, new TypeToken<Map>() { }.getType()); return jsonMap; } catch (Exception e) { LOGGER.error("Error executeCommand", e); throw new LivyException("Error parsing Livy response", e); } }

Target:
private Map executeCommand(String lines, InterpreterContext context, Map<String, Integer> userSessionMap) throws LivyException { String json; try { json = executeHTTP(property.get("zeppelin.livy.url") + "/sessions/" + userSessionMap.get(context.getAuthenticationInfo().getUser()) + "/statements", "POST", "{\"code\": \"" + StringEscapeUtils.escapeJson(lines) + "\"}", context.getParagraphId()); } catch (Exception e) { throw new LivyException("Error executing command in Livy", e); } if (json == null || json.matches("^(\")?Session (\'[0-9]+\' )?not found(.?\"?)$")) { LOGGER.warn("Livy session has been lost!"); throw new LivyNoSessionException(); } try { Map jsonMap = gson.fromJson(json, new TypeToken<Map>() { }.getType()); return jsonMap; } catch (Exception e) { LOGGER.error("Error executeCommand", e); throw new LivyException("Error parsing Livy response", e); } }
Source:
public boolean checkThreadAccess() { return mEnforcer.checkThreadAccess(); }

Target:
public final boolean checkThreadAccess() { return mEnforcer.checkThreadAccess(); }
Source:
private void stopCommonServices() { if (leaderElection != null && leaderElection.isRunning()) { try { leaderElection.stopElectionThread(); } catch (InterruptedException e) { e.printStackTrace(); } } if (rpcServer != null) { rpcServer.stop(); } if (namesystem != null) { namesystem.close(); } if (pauseMonitor != null) { pauseMonitor.stop(); } if(mdCleaner != null){ mdCleaner.stopMDCleanerMonitor(); } if (plugins != null) { for (ServicePlugin p : plugins) { try { p.stop(); } catch (Throwable t) { LOG.warn("ServicePlugin " + p + " could not be stopped", t); } } } if (revocationListFetcherService != null) { try { revocationListFetcherService.serviceStop(); } catch (Exception ex) { LOG.warn("Exception while stopping CRL fetcher service, but we are shutting down anyway"); } } stopHttpServer(); }

Target:
private void stopCommonServices() { if (leaderElection != null && leaderElection.isRunning()) { try { leaderElection.stopElectionThread(); } catch (InterruptedException e) { LOG.warn("LeaderElection thread stopped",e); } } if (rpcServer != null) { rpcServer.stop(); } if (namesystem != null) { namesystem.close(); } if (pauseMonitor != null) { pauseMonitor.stop(); } if(mdCleaner != null){ mdCleaner.stopMDCleanerMonitor(); } if (plugins != null) { for (ServicePlugin p : plugins) { try { p.stop(); } catch (Throwable t) { LOG.warn("ServicePlugin " + p + " could not be stopped", t); } } } if (revocationListFetcherService != null) { try { revocationListFetcherService.serviceStop(); } catch (Exception ex) { LOG.warn("Exception while stopping CRL fetcher service, but we are shutting down anyway"); } } stopHttpServer(); }
Source:
private void acquireUnmanagedUsbController( VmBase vmBase, List<VmDevice> managedUsbControllers, List<VmDevice> unmanagedControllers) { if (unmanagedControllers.size() > 1) { throw new IllegalStateException(format("At most one unmanaged USB controller expected for VM=%s(%s), found=%s", vmBase.getName(), vmBase.getId(), unmanagedControllers)); } final UsbControllerModel controllerModel = getUsbControllerModel(vmBase); if (unmanagedControllers.size() != 1) { return; } removeVmDevices(managedUsbControllers); VmDevice device = unmanagedControllers.iterator().next(); device.setManaged(true); device.setPlugged(true); device.setReadOnly(false); device.setSpecParams(createUsbControllerSpecParams(controllerModel.libvirtName, 0)); vmDeviceDao.update(device); }

Target:
private void acquireUnmanagedUsbController( VmBase vmBase, List<VmDevice> managedUsbControllers, List<VmDevice> unmanagedControllers) { if (unmanagedControllers.size() > 1) { throw new IllegalStateException(format("At most one unmanaged USB controller expected for VM=%s(%s), found=%s", vmBase.getName(), vmBase.getId(), unmanagedControllers)); } final UsbControllerModel controllerModel = getUsbControllerModel(vmBase); if (unmanagedControllers.isEmpty()) { return; } removeVmDevices(managedUsbControllers); VmDevice device = unmanagedControllers.iterator().next(); device.setManaged(true); device.setPlugged(true); device.setReadOnly(false); device.setSpecParams(createUsbControllerSpecParams(controllerModel.libvirtName, 0)); vmDeviceDao.update(device); }
Source:
public SchemaGen( String dialect, String model, File outputPath, String delimiter) { this.dialect = dialectFor(dialect); if (this.dialect instanceof DB2Dialect) { System.err.println(JpaDdlGenI18n.dialectRequiresModification.text(this.dialect.getClass().getSimpleName())); } this.delimiter = delimiter; this.model = JpaSource.Models.getModel(model); if (this.model == null) { throw new RuntimeException(JpaDdlGenI18n.invalidModel.text()); } this.outputPath = outputPath; if (this.outputPath != null && !this.outputPath.exists()) { this.outputPath.mkdirs(); String logMsg = JpaDdlGenI18n.directoryLocationCreated.text(this.outputPath.getAbsolutePath()); logger.log(Level.INFO, logMsg); } }

Target:
public SchemaGen( String dialect, String model, File outputPath, String delimiter) { this.dialect = dialectFor(dialect); if ((this.dialect instanceof DB2Dialect) | (this.dialect instanceof DerbyDialect)) { System.err.println(JpaDdlGenI18n.dialectRequiresModification.text(this.dialect.getClass().getSimpleName())); } this.delimiter = delimiter; this.model = JpaSource.Models.getModel(model); if (this.model == null) { throw new RuntimeException(JpaDdlGenI18n.invalidModel.text()); } this.outputPath = outputPath; if (this.outputPath != null && !this.outputPath.exists()) { this.outputPath.mkdirs(); String logMsg = JpaDdlGenI18n.directoryLocationCreated.text(this.outputPath.getAbsolutePath()); logger.log(Level.INFO, logMsg); } }
Source:
public void close() throws IOException { if (closing) { return; } closing = true; sslEngine.closeOutbound(); try { if (!flush(netWriteBuffer)) { throw new IOException("Remaining data in the network buffer, can't send SSL close message."); } netWriteBuffer.clear(); SSLEngineResult handshake = sslEngine.wrap(emptyBuf, netWriteBuffer); if (handshake.getStatus() != SSLEngineResult.Status.CLOSED) { throw new IOException("Invalid close state, will not send network data."); } netWriteBuffer.flip(); flush(netWriteBuffer); socketChannel.socket().close(); socketChannel.close(); } catch (IOException ie) { log.warn("Failed to send SSL Close message ", ie); } key.attach(null); key.cancel(); }

Target:
public void close() throws IOException { if (closing) { return; } closing = true; sslEngine.closeOutbound(); try { if (!flush(netWriteBuffer)) { throw new IOException("Remaining data in the network buffer, can't send SSL close message."); } netWriteBuffer.clear(); SSLEngineResult handshake = sslEngine.wrap(emptyBuf, netWriteBuffer); if (handshake.getStatus() != SSLEngineResult.Status.CLOSED) { throw new IOException("Invalid close state, will not send network data."); } netWriteBuffer.flip(); flush(netWriteBuffer); socketChannel.socket().close(); socketChannel.close(); } catch (IOException ie) { logger.warn("Failed to send SSL close message ", ie); } key.attach(null); key.cancel(); }
Source:
public void setUpRefs() throws IOException { Set<String> existingRefs = new LinkedHashSet<String>( repository.getRefDatabase().getRefs( getPubSubRefFromLocal(remote, Constants.R_REFS)) .keySet()); Map<String, Ref> refs = getRemoteRefs(); for (Map.Entry<String, Ref> entry : refs.entrySet()) { String ref = entry.getKey(); String existingRef = ref.substring(Constants.R_REFS.length()); existingRefs.remove(existingRef); String pubsubRef = getPubSubRefFromLocal(remote, ref); if (repository.getRef(pubsubRef) != null) continue; RefUpdate ru = repository.updateRef(pubsubRef); ru.setExpectedOldObjectId(ObjectId.zeroId()); ru.setNewObjectId(entry.getValue().getObjectId()); ru.setRefLogMessage("pubsub setup", true); ru.update(); } for (String r : existingRefs) { String pubsubRef = getPubSubRefFromLocal( remote, Constants.R_REFS + r); if (repository.getRef(pubsubRef) == null) continue; RefUpdate ru = repository.updateRef(pubsubRef); ru.setForceUpdate(true); ru.delete(); } }

Target:
public void setUpRefs() throws IOException, URISyntaxException { remoteConfig = new RemoteConfig(repository.getConfig(), remoteName); Set<String> existingRefs = new LinkedHashSet<String>( repository.getRefDatabase().getRefs( getPubSubRefFromRemote(remoteName, Constants.R_REFS)) .keySet()); Map<String, Ref> refs = getRemoteRefs(); for (Map.Entry<String, Ref> entry : refs.entrySet()) { String ref = entry.getKey(); String existingRef = ref.substring(Constants.R_REFS.length()); existingRefs.remove(existingRef); } for (String r : existingRefs) { String pubsubRef = getPubSubRefFromRemote( remoteName, Constants.R_REFS + r); if (repository.getRef(pubsubRef) == null) continue; RefUpdate ru = repository.updateRef(pubsubRef); ru.setForceUpdate(true); ru.delete(); } for (Map.Entry<String, Ref> entry : refs.entrySet()) { String ref = entry.getKey(); String pubsubRef = getPubSubRefFromRemote(remoteName, ref); if (repository.getRef(pubsubRef) != null) continue; RefUpdate ru = repository.updateRef(pubsubRef); ru.setExpectedOldObjectId(ObjectId.zeroId()); ru.setNewObjectId(entry.getValue().getObjectId()); ru.setRefLogMessage("pubsub setup", false); ru.forceUpdate(); } }
Source:
private String getInstrumentCodeLine(String encodedParam, int lineNo, int colNo){ return "module$exports$instrument$code.instrumentCodeInstance.instrumentCode(\"" + encodedParam + "\", " + lineNo + ", " + colNo + ")"; }

Target:
private String getInstrumentCodeLine(String encodedParam, int lineNo, int colNo) { return Strings.lenientFormat( "%s(\"%s\", %s, %s)", "module$exports$instrument$code.instrumentCodeInstance.instrumentCode", encodedParam, lineNo, colNo); }
Source:
public void track(File file) throws IOException { DirCache dc = repository.lockDirCache(); try { String repoPath = getRepoRelativePath(new Path(file.getPath()) .toString()); FileInputStream fis = new FileInputStream(file); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buffer = new byte[100]; try { int size = fis.read(buffer); while (size > 0) { bos.write(buffer, 0, size); size = fis.read(buffer); } } finally { fis.close(); bos.close(); } final byte[] newContent = bos.toByteArray(); DirCacheEditor editor = dc.editor(); editor.add(new PathEdit(repoPath) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); ent.setAssumeValid(false); ObjectInserter inserter = repository.newObjectInserter(); ent.setLength(newContent.length); ent.setLastModified(System.currentTimeMillis()); InputStream in = new ByteArrayInputStream(newContent); try { ent.setObjectId(inserter.insert(Constants.OBJ_BLOB, newContent.length, in)); inserter.flush(); } catch (IOException ex) { throw new RuntimeException(ex); } finally { try { in.close(); } catch (IOException e) { } } } }); try { editor.commit(); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) throw (IOException) e.getCause(); else throw e; } } finally { dc.unlock(); } }

Target:
public void track(File file) throws IOException { String repoPath = getRepoRelativePath(new Path(file.getPath()) .toString()); try { new Git(repository).add().addFilepattern(repoPath).call(); } catch (NoFilepatternException e) { throw new IOException(e.getMessage()); } }
Source:
public static Double get(String key, double def) { String value = configuration.getProperty(key); return value == null ? def : ParseUtil.parseDoubleOrDefault(value, def); }

Target:
public static double get(String key, double def) { String value = configuration.getProperty(key); return value == null ? def : ParseUtil.parseDoubleOrDefault(value, def); }
Source:
public String intercept(ActionInvocation invocation) throws Exception { ActionContext context = invocation.getInvocationContext(); HttpServletRequest request = context.getServletRequest(); invocation.addPreResultListener(this); if (exemptedPaths.contains(request.getContextPath())) { return invocation.invoke(); } if (resourceIsolationPolicy.isRequestAllowed(request)) { return invocation.invoke(); } beforeResult(invocation, SC_FORBIDDEN); return SC_FORBIDDEN; }

Target:
public String intercept(ActionInvocation invocation) throws Exception { ActionContext context = invocation.getInvocationContext(); HttpServletRequest request = context.getServletRequest(); addVaryHeaders(invocation); String contextPath = request.getContextPath(); if (exemptedPaths.contains(contextPath)) { return invocation.invoke(); } if (resourceIsolationPolicy.isRequestAllowed(request)) { return invocation.invoke(); } logger.atDebug().log( "Fetch metadata rejected cross-origin request to %s", contextPath ); return SC_FORBIDDEN; }
Source:
public static void killCaches(boolean clear, Collection<Cache> caches) { for (Cache c : caches) { try { if (c != null && c.getStatus() == ComponentStatus.RUNNING) { TransactionManager tm = c.getAdvancedCache().getTransactionManager(); if (tm != null) { try { tm.rollback(); } catch (Exception e) { } } if (c.getAdvancedCache().getRpcManager() != null) { log.tracef("Local entries on %s before stopping: %d", c.getAdvancedCache().getRpcManager().getAddress(), c.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).size()); } else { log.tracef("Local entries before stopping: %d", c.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).size()); } if (clear) { try { c.clear(); } catch (Exception ignored) } c.stop(); } } catch (Throwable t) { } } }

Target:
public static void killCaches(boolean clear, Collection<Cache> caches) { for (Cache c : caches) { try { if (c != null && c.getStatus() == ComponentStatus.RUNNING) { TransactionManager tm = c.getAdvancedCache().getTransactionManager(); if (tm != null) { try { tm.rollback(); } catch (Exception e) { } } if (c.getAdvancedCache().getRpcManager() != null) { log.tracef("Local size on %s before stopping: %d", c.getAdvancedCache().getRpcManager().getAddress(), c.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).size()); } else { log.tracef("Local size before stopping: %d", c.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).size()); } if (clear) { try { c.clear(); } catch (Exception ignored) } c.stop(); } } catch (Throwable t) { } } }
Source:
long gtk_draw (long widget, long cairo) { if ((state & OBSCURED) != 0) return 0; if (!hooksPaint ()) return 0; GdkRectangle rect = new GdkRectangle (); OS.gdk_cairo_get_clip_rectangle (cairo, rect); Event event = new Event (); event.count = 1; Rectangle eventRect = new Rectangle (rect.x, rect.y, rect.width, rect.height); Rectangle eventBounds = DPIUtil.autoScaleDown (eventRect); if ((style & SWT.MIRRORED) != 0) eventBounds.x = DPIUtil.autoScaleDown (getClientWidth ()) - eventBounds.width - eventBounds.x; event.setBounds (eventBounds); GCData data = new GCData (); if (OS.GTK_VERSION <= OS.VERSION (3, 9, 0)) { data.cairo = cairo; } GC gc = event.gc = GC.gtk_new (this, data); gc.setClipping (eventBounds.x, eventBounds.y, eventBounds.width, eventBounds.height); drawWidget (gc); sendEvent (SWT.Paint, event); gc.dispose (); event.gc = null; return 0; }

Target:
long gtk_draw (long widget, long cairo) { if ((state & OBSCURED) != 0) return 0; if (!hooksPaint ()) return 0; GdkRectangle rect = new GdkRectangle (); OS.gdk_cairo_get_clip_rectangle (cairo, rect); Event event = new Event (); event.count = 1; Rectangle eventBounds = DPIUtil.autoScaleDown (new Rectangle (rect.x, rect.y, rect.width, rect.height)); if ((style & SWT.MIRRORED) != 0) eventBounds.x = DPIUtil.autoScaleDown (getClientWidth ()) - eventBounds.width - eventBounds.x; event.setBounds (eventBounds); GCData data = new GCData (); if (OS.GTK_VERSION <= OS.VERSION (3, 9, 0)) { data.cairo = cairo; } GC gc = event.gc = GC.gtk_new (this, data); gc.setClipping (eventBounds.x, eventBounds.y, eventBounds.width, eventBounds.height); drawWidget (gc); sendEvent (SWT.Paint, event); gc.dispose (); event.gc = null; return 0; }
Source:
public FormValidation doCheckURIEncoding(StaplerRequest request) { Jenkins.get().checkPermission(Jenkins.ADMINISTER); final String expected = "\u57f7\u4e8b"; final String value = fixEmpty(request.getParameter("value")); if (!expected.equals(value)) return FormValidation.warningWithMarkup(hudson.model.Messages.Hudson_NotUsesUTF8ToDecodeURL()); return FormValidation.ok(); }

Target:
public FormValidation doCheckURIEncoding(StaplerRequest request) throws IOException { Jenkins.get().checkPermission(Jenkins.ADMINISTER); final String expected = "\u57f7\u4e8b"; final String value = fixEmpty(request.getParameter("value")); if (!expected.equals(value)) return FormValidation.warningWithMarkup(hudson.model.Messages.Hudson_NotUsesUTF8ToDecodeURL()); return FormValidation.ok(); }
Source:
private static boolean isPreserveAuthorization(Request request) { return request.getAttributes().get(PRESERVE_AUTHORIZATION_KEY) == TRUE; }

Target:
private static boolean isPreserveAuthorization(Request request) { return TRUE.equals(request.getAttributes().get(PRESERVE_AUTHORIZATION_KEY)); }
Source:
public String showCommandLine(VMRunnerConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { CommandDetails cmd = getCommandLine(configuration, launch, monitor); if (monitor.isCanceled()) { return ""; } String[] cmdLine = cmd.getCommandLine(); cmdLine = quoteWindowsArgs(cmdLine); return getCmdLineAsString(cmdLine); }

Target:
public String showCommandLine(VMRunnerConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor); CommandDetails cmd = getCommandLine(configuration, launch, subMonitor); if (subMonitor.isCanceled()) { return ""; } String[] cmdLine = cmd.getCommandLine(); cmdLine = quoteWindowsArgs(cmdLine); return getCmdLineAsString(cmdLine); }
Source:
public VisualEditorPageObject clickApplyChanges() { for (int i=0; i<buttonsList.size(); i++) { if (buttonsList.get(i).getText().contentEquals("Apply changes")) { buttonsList.get(i).click(); } } return this; }

Target:
public VisualEditorPageObject clickApplyChanges() { wait.forElementVisible(applyChangesButton); applyChangesButton.click(); return this; }
Source:
public RoleData getRuntimeRole(String name) { Role role = authorizationConfigService.get() .getRoles() .stream() .filter(r -> r.getName().equals(name)) .findFirst() .orElseThrow(() -> new IllegalArgumentException(name)); if (SystemRole.ADMIN.name().equals(name)) { RuntimeRole adminRole = new RuntimeRole(role, (a) -> new AdminAccessModel(a)); return new RuntimeRole(adminRole, (a) -> new AuthorizedAccessModel(a)); } else if (SystemRole.ANONYMOUS.name().equals(name)) { return new RuntimeRole(role, (a) -> new AnonymousAccessModel(a)); } return new RuntimeRole(role, (a) -> new AuthorizedAccessModel(a)); }

Target:
public Role getRuntimeRole(String name) { RoleData role = authorizationConfigService.get() .getRoles() .stream() .filter(r -> r.getName().equals(name)) .findFirst() .orElseThrow(() -> new IllegalArgumentException(name)); if (SystemRole.ADMIN.name().equals(name)) { RuntimeRole adminRole = new RuntimeRole(role, (a) -> new AdminAccessModel()); return new RuntimeRole(adminRole, (a) -> new AuthenticatedAccessModel(a)); } else if (SystemRole.ANONYMOUS.name().equals(name)) { return new RuntimeRole(role, (a) -> new AnonymousAccessModel(a)); } return new RuntimeRole(role, (a) -> new AuthenticatedAccessModel(a)); }
Source:
private void processSplashElementIcon( IConfigurationElement configurationElement) { String iconImageFilePath = configurationElement.getAttribute(F_ELEMENT_ICON); if ((iconImageFilePath == null) || (iconImageFilePath.length() == 0)) { return; } ImageDescriptor descriptor = ResourceLocator.imageDescriptorFromBundle( configurationElement.getNamespaceIdentifier(), iconImageFilePath).orElse(null); if (descriptor == null) { return; } Image image = descriptor.createImage(); if (image == null) { return; } if ((image.getBounds().width != F_IMAGE_WIDTH) || (image.getBounds().height != F_IMAGE_HEIGHT)) { image.dispose(); return; } fImageList.add(image); }

Target:
private void processSplashElementIcon( IConfigurationElement configurationElement) { String iconImageFilePath = configurationElement.getAttribute(F_ELEMENT_ICON); if ((iconImageFilePath == null) || (iconImageFilePath.length() == 0)) { return; } ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin( configurationElement.getNamespaceIdentifier(), iconImageFilePath); if (descriptor == null) { return; } Image image = descriptor.createImage(); if (image == null) { return; } if ((image.getBounds().width != F_IMAGE_WIDTH) || (image.getBounds().height != F_IMAGE_HEIGHT)) { image.dispose(); return; } fImageList.add(image); }
Source:
public static String getCredential(@Nullable Pair<String, String> usernameAndPasswordToAuthWith) { String credential; if (usernameAndPasswordToAuthWith == null) { Pair<User, String> userAndDomain = getUserAndDomain(true); credential = ModernHttpRequester.getCredential(userAndDomain.first, userAndDomain.second); } else { credential = ModernHttpRequester.getCredential( buildDomainUser(usernameAndPasswordToAuthWith.first), buildAppPassword(usernameAndPasswordToAuthWith.second)); } return credential; }

Target:
public static String getCredential(@Nullable Pair<String, String> usernameAndPasswordToAuthWith) { String credential; if (usernameAndPasswordToAuthWith == null) { Pair<User, String> userAndDomain = getUserAndDomain(true); credential = getCredential(userAndDomain.first, userAndDomain.second); } else { credential = getCredential( buildDomainUser(usernameAndPasswordToAuthWith.first), buildAppPassword(usernameAndPasswordToAuthWith.second)); } return credential; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AuthenticationManager.setAuthenticationChallengeHandler(customAuthenticationChallengeHandler); mOAuthLoginDialog = new Dialog(this); mMapView = (MapView) findViewById(R.id.mapViewLayout); try { OAuthConfiguration config = new OAuthConfiguration(getString(R.string.portal_url), getString(R.string.client_id), getString(R.string.redirect_url)); AuthenticationManager.addOAuthConfiguration(config); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.getMessage(), e.getCause()); } Portal portal = new Portal(getString(R.string.portal_url)); portal.loadAsync(); PortalItem webMapItem = new PortalItem(portal, getString(R.string.webmap_id)); ArcGISMap map = new ArcGISMap(webMapItem); mMapView.setMap(map); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AuthenticationManager.setAuthenticationChallengeHandler(mCustomAuthenticationChallengeHandler); mOAuthLoginDialog = new Dialog(this); mMapView = findViewById(R.id.mapView); try { OAuthConfiguration config = new OAuthConfiguration(getString(R.string.portal_url), getString(R.string.client_id), getString(R.string.redirect_url)); AuthenticationManager.addOAuthConfiguration(config); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.getMessage(), e.getCause()); } Portal portal = new Portal(getString(R.string.portal_url), true); PortalItem webMapItem = new PortalItem(portal, getString(R.string.webmap_id)); ArcGISMap map = new ArcGISMap(webMapItem); mMapView.setMap(map); }
Source:
public void will_execute_a_void_based_on_strongly_typed_one_parameter_function() throws Exception { final IMethods target = mock(IMethods.class); given(iMethods.simpleMethod(anyString())) .will(answerVoid((VoidAnswer1<String>) target::simpleMethod)); iMethods.simpleMethod("string"); verify(target, times(1)).simpleMethod("string"); }

Target:
public void will_execute_a_void_based_on_strongly_typed_one_parameter_function() throws Exception { final IMethods target = mock(IMethods.class); given(iMethods.simpleMethod(anyString())) .will(answerVoid(new VoidAnswer1<String>() { public void answer(String s) { target.simpleMethod(s); } })); iMethods.simpleMethod("string"); verify(target, times(1)).simpleMethod("string"); }
Source:
public void setOldClusterVersionOfSnapshotWithMemory(VM vm) { if (!isVMWithMemoryCompatible(vm)) { Version originalClusterVersion = vm.getClusterCompatibilityVersionOrigin(); originalClusterVersion = (originalClusterVersion == null) ? Version.v3_6_compat : originalClusterVersion; oldClusterVersionOfSnapshotWithMemory = originalClusterVersion; } else { oldClusterVersionOfSnapshotWithMemory = null; } }

Target:
public void setOldClusterVersionOfSnapshotWithMemory(VM vm) { if (!isVMWithMemoryCompatible(vm)) { Version originalClusterVersion = vm.getClusterCompatibilityVersionOrigin(); originalClusterVersion = (originalClusterVersion == null) ? Version.v4_0 : originalClusterVersion; oldClusterVersionOfSnapshotWithMemory = originalClusterVersion; } else { oldClusterVersionOfSnapshotWithMemory = null; } }
Source:
public void testIsDataStall_EvaluationDnsWithDnsTimeoutCount() { WrappedNetworkMonitor wrappedMonitor = makeMeteredWrappedNetworkMonitor(); wrappedMonitor.setLastProbeTime(SystemClock.elapsedRealtime() - 1000); makeDnsTimeoutEvent(wrappedMonitor, 3); assertFalse(wrappedMonitor.isDataStall()); makeDnsTimeoutEvent(wrappedMonitor, 2); assertTrue(wrappedMonitor.isDataStall()); setConsecutiveDnsTimeoutThreshold(51); wrappedMonitor = makeMeteredWrappedNetworkMonitor(); wrappedMonitor.setLastProbeTime(SystemClock.elapsedRealtime() - 1000); makeDnsTimeoutEvent(wrappedMonitor, 50); assertFalse(wrappedMonitor.isDataStall()); makeDnsTimeoutEvent(wrappedMonitor, 1); assertTrue(wrappedMonitor.isDataStall()); }

Target:
public void testIsDataStall_EvaluationDnsWithDnsTimeoutCount() { WrappedNetworkMonitor wrappedMonitor = makeMeteredWrappedNetworkMonitor(); wrappedMonitor.setLastProbeTime(SystemClock.elapsedRealtime() - 1000); makeDnsTimeoutEvent(wrappedMonitor, 3); assertFalse(wrappedMonitor.isDataStall()); makeDnsSuccessEvent(wrappedMonitor, 1); makeDnsTimeoutEvent(wrappedMonitor, 2); assertFalse(wrappedMonitor.isDataStall()); makeDnsTimeoutEvent(wrappedMonitor, 3); assertTrue(wrappedMonitor.isDataStall()); setConsecutiveDnsTimeoutThreshold(51); wrappedMonitor = makeMeteredWrappedNetworkMonitor(); wrappedMonitor.setLastProbeTime(SystemClock.elapsedRealtime() - 1000); makeDnsTimeoutEvent(wrappedMonitor, 50); assertFalse(wrappedMonitor.isDataStall()); makeDnsTimeoutEvent(wrappedMonitor, 1); assertTrue(wrappedMonitor.isDataStall()); }
Source:
public boolean validate(IDocument document, int offset, DocumentEvent event) { if (!isOffsetValid(offset)) return fIsValidated= false; if (isSupportingRequiredProposals()) { CompletionProposal coreProposal= ((MemberProposalInfo) getProposalInfo()).fProposal; if (coreProposal.isSuffixProposal()) fIsValidated= isValidPrefix(getPrefix(document, offset)); else fIsValidated= CharOperation.camelCaseMatch(getPrefix(document, offset).toCharArray(), TextProcessor.deprocess(getDisplayString()).toCharArray()) || CharOperation.substringMatch(getPrefix(document, offset), TextProcessor.deprocess(getDisplayString())); } else fIsValidated= isValidPrefix(getPrefix(document, offset)); if (fIsValidated && event != null) { int delta= (event.fText == null ? 0 : event.fText.length()) - event.fLength; final int newLength= Math.max(getReplacementLength() + delta, 0); setReplacementLength(newLength); } return fIsValidated; }

Target:
public boolean validate(IDocument document, int offset, DocumentEvent event) { if (!isOffsetValid(offset)) return fIsValidated= false; if (isSupportingRequiredProposals() && !(((MemberProposalInfo) getProposalInfo()).fProposal).isSuffixProposal()) { fIsValidated= CharOperation.camelCaseMatch(getPrefix(document, offset).toCharArray(), TextProcessor.deprocess(getDisplayString()).toCharArray()) || CharOperation.substringMatch(getPrefix(document, offset), TextProcessor.deprocess(getDisplayString())); } else fIsValidated= isValidPrefix(getPrefix(document, offset)); if (fIsValidated && event != null) { int delta= (event.fText == null ? 0 : event.fText.length()) - event.fLength; final int newLength= Math.max(getReplacementLength() + delta, 0); setReplacementLength(newLength); } return fIsValidated; }
Source:
private void waitForOperation(String operationName, int maxSeconds) throws InterruptedException { GetOperationRequest request = GetOperationRequest.newBuilder().setName(operationName).build(); for (int i = 0; i < maxSeconds * 2; i++) { Thread.sleep(500); Operation response = client.getOperation(request); if (response.getDone()) { switch (response.getResultCase()) { case ERROR: throw new RuntimeException("Cluster could not be created: " + response.getError()); case RESPONSE: return; case RESULT_NOT_SET: throw new IllegalStateException( "System returned invalid response for Operation check: " + response); } } } throw new IllegalStateException( String.format("Waited %d seconds and operation was not complete", maxSeconds)); }

Target:
public void waitForOperation(String operationName, int maxSeconds) throws InterruptedException { long endTimeMillis = TimeUnit.SECONDS.toMillis(maxSeconds) + System.currentTimeMillis(); GetOperationRequest request = GetOperationRequest.newBuilder().setName(operationName).build(); do { Thread.sleep(500); Operation response = client.getOperation(request); if (response.getDone()) { switch (response.getResultCase()) { case RESPONSE: return; case ERROR: throw new RuntimeException("Cluster could not be resized: " + response.getError()); case RESULT_NOT_SET: throw new IllegalStateException( "System returned invalid response for Operation check: " + response); } } } while (System.currentTimeMillis() < endTimeMillis); throw new IllegalStateException( String.format("Waited %d seconds and cluster was not resized yet.", maxSeconds)); }
Source:
private <T> List<T> toListOfComplexType(DataTable dataTable, Class<T> itemType) { HierarchicalStreamReader reader = new ListOfComplexTypeReader(itemType, convertTopCellsToFieldNames(dataTable), dataTable.cells(1)); try { return Collections.unmodifiableList((List<T>) xStream.unmarshal(reader)); } catch (AbstractReflectionConverter.UnknownFieldException e) { throw new CucumberException(e.getShortMessage()); } catch (AbstractReflectionConverter.DuplicateFieldException e) { throw new CucumberException(e.getShortMessage()); } catch (ConversionException e) { if (e.getCause() instanceof NullPointerException) { throw new CucumberException(String.format("Can't assign null value to one of the primitive fields in %s. Please use boxed types.", e.get("class"))); } else { throw e; } } }

Target:
private <T> List<T> toListOfComplexType(DataTable dataTable, Class<T> itemType) { HierarchicalStreamReader reader = new ListOfComplexTypeReader(itemType, convertTopCellsToFieldNames(dataTable), dataTable.cells(1)); try { return Collections.unmodifiableList((List<T>) xStream.unmarshal(reader)); } catch (AbstractReflectionConverter.UnknownFieldException e) { throw new CucumberException(e.getShortMessage()); } catch (AbstractReflectionConverter.DuplicateFieldException e) { throw new CucumberException(e.getShortMessage()); } catch (ConversionException e) { if (e.getCause() instanceof NullPointerException) { throw new CucumberException(String.format("Can't assign null value to one of the primitive fields in %s. Please use boxed types.", e.get("class"))); } else { throw new CucumberException(e); } } }
Source:
public void setPrev(InternalResourceGroup prevNeighbour) { prev = Optional.of(prevNeighbour); }

Target:
public void setPrev(InternalResourceGroup prevNeighbour) { synchronized (root) { if (prevNeighbour == null) { prev = Optional.empty(); } else { prev = Optional.of(prevNeighbour); } } }
Source:
public ComparableTuple(final A a, final B b) { super(a, b); }

Target:
public ComparableTuple(final A a, final B b) { super(a, b); if (a == null || b == null) { throw new IllegalArgumentException("ComparableTuple's behavior is undefined when containing a null."); } }
Source:
public int getTotalRevenueTimeForTrips (Collection<Trip> trips) { TIntList times = new TIntArrayList(); for (Trip trip : trips) { StopTime first; StopTime last; Spliterator<StopTime> interpolated = null; try { interpolated = feed.getInterpolatedStopTimesForTrip(trip.trip_id).spliterator(); } catch (GTFSFeed.FirstAndLastStopsDoNotHaveTimes firstAndLastStopsDoNotHaveTimes) { return -1; } first = StreamSupport.stream(interpolated, false) .findFirst() .orElse(null); last = StreamSupport.stream(interpolated, false) .reduce((a, b) -> b) .orElse(null); int time = last.departure_time - first.arrival_time; times.add(time); } return times.sum(); }

Target:
public int getTotalRevenueTimeForTrips (Collection<Trip> trips) { TIntList times = new TIntArrayList(); for (Trip trip : trips) { StopTime first; StopTime last; Spliterator<StopTime> stopTimes = feed.getOrderedStopTimesForTrip(trip.trip_id).spliterator();; first = StreamSupport.stream(stopTimes, false) .findFirst() .orElse(null); last = StreamSupport.stream(stopTimes, false) .reduce((a, b) -> b) .orElse(null); int time = last.arrival_time - first.departure_time; times.add(time); } return times.sum(); }
Source:
public void onLayoutEditorElementSelectEvent(@Observes LayoutEditorElementSelectEvent event) { LayoutEditorElement element = event.getElement(); if (element instanceof ComponentColumn) { ComponentColumn componentColumn = (ComponentColumn) element; LayoutComponent layoutComponent = componentColumn.getLayoutComponent(); LayoutDragComponent layoutDragComponent = componentColumn.getLayoutDragComponent(); if (layoutDragComponent instanceof EditorFieldLayoutComponent) { ((EditorFieldLayoutComponent) layoutDragComponent).addComponentParts(layoutComponent); } componentColumn.setupParts(); } }

Target:
public void onLayoutEditorElementSelectEvent(@Observes LayoutEditorElementSelectEvent event) { LayoutEditorElement element = event.getElement(); if (element instanceof ComponentColumn) { ComponentColumn componentColumn = (ComponentColumn) element; LayoutComponent layoutComponent = componentColumn.getLayoutComponent(); LayoutDragComponent layoutDragComponent = componentColumn.getLayoutDragComponent(); boolean containsElement = getFormDefinition().getLayoutTemplate().contains(layoutComponent); if (layoutDragComponent instanceof EditorFieldLayoutComponent && containsElement) { ((EditorFieldLayoutComponent) layoutDragComponent).addComponentParts(layoutComponent); } componentColumn.setupParts(); } }
Source:
public static synchronized void reset(UserAccount account) { if (account == null) { account = SmartStoreSDKManager.getInstance().getUserAccountManager().getCurrentUser(); } if (account != null) { Set<String> keysToRemove = new HashSet<>(); for (String key : INSTANCES.keySet()) { if (key.startsWith(account.getUserId())) { keysToRemove.add(key); SyncManager syncManager = INSTANCES.get(key); syncManager.threadPool.shutdownNow(); } } INSTANCES.keySet().removeAll(keysToRemove); } }

Target:
public static synchronized void reset(UserAccount account) { if (account != null) { Set<String> keysToRemove = new HashSet<>(); for (String key : INSTANCES.keySet()) { if (key.startsWith(account.getUserId())) { keysToRemove.add(key); SyncManager syncManager = INSTANCES.get(key); syncManager.threadPool.shutdownNow(); } } INSTANCES.keySet().removeAll(keysToRemove); } }