auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AttemptResult transitionInto(WalkStateGraphContext walkStateGraphContext) throws IOException, SmackException, InterruptedException, XMPPException { connectionAttemptState = new WebsocketConnectionAttemptState( connectionInternal, discoveredWebsocketEndpoints, this); StateTransitionResult.Failure failure = connectionAttemptState.establishWebsocketConnection(); if (failure != null) { return failure; } connectionInternal.setTransport(websocketTransport); connectionInternal.newStreamOpenWaitForFeaturesSequence("stream features after initial connection", new OpenElement(connectionInternal.connection.getXMPPServiceDomain())); return new WebsocketConnectedResult(); }

Target:
public AttemptResult transitionInto(WalkStateGraphContext walkStateGraphContext) throws IOException, SmackException, InterruptedException, XMPPException { WebsocketConnectionAttemptState connectionAttemptState = new WebsocketConnectionAttemptState( connectionInternal, discoveredWebsocketEndpoints, this); try { websocket = connectionAttemptState.establishWebsocketConnection(); } catch (InterruptedException | WebsocketException e) { StateTransitionResult.Failure failure = new StateTransitionResult.FailureCausedByException<Exception>(e); return failure; } connectionInternal.setTransport(websocketTransport); WebsocketRemoteConnectionEndpoint connectedEndpoint = connectionAttemptState.getConnectedEndpoint(); return new WebsocketConnectedResult(connectedEndpoint); }
Source:
public ListenableFuture<Map<Cell, Value>> getAsync(TableReference tableRef, Map<Cell, Long> timestampByCell) { Executable<ListenableFuture<Map<Cell, Value>>> job = executor -> { CqlQuerySpec<Optional<Value>> querySpec = ImmutableCqlQuerySpec.<Optional<Value>>builder() .rowStreamAccumulator(RowStreamAccumulators.GetQueryAccumulator::new) .supportedQuery(SupportedQuery.GET) .keySpace(config.getKeyspaceOrThrow()) .tableReference(tableRef) .build(); return Futures.transform( Futures.allAsList( KeyedStream.stream(timestampByCell).map((cell, timestamp) -> cqlClient.execute(cqlClient.<Optional<Value>>asyncQueryBuilder() .setQuerySpec(querySpec) .setArg("row", ByteBuffer.wrap(cell.getRowName())) .setArg("column", ByteBuffer.wrap(cell.getColumnName())) .setArg("timestamp", ~timestamp) .build())) .entries() .map(entry -> Futures.transform(entry.getValue(), val -> new AbstractMap.SimpleEntry<>(entry.getKey(), val), executor)) .collect(Collectors.toList())), resultList -> resultList.stream() .filter(entry -> entry.getValue().isPresent()) .collect(Collectors.toMap( AbstractMap.SimpleEntry::getKey, entry -> entry.getValue().get())), executor); }; return cqlClient.execute(job); }

Target:
public ListenableFuture<Map<Cell, Value>> getAsync(TableReference tableRef, Map<Cell, Long> timestampByCell) { if (timestampByCell.isEmpty()) { log.info("Attempted get with no specified cells", LoggingArgs.tableRef(tableRef)); return Futures.immediateFuture(ImmutableMap.of()); } return asyncCellLoader.loadAllWithTimestamp(tableRef, timestampByCell); }
Source:
private CloseableIterator<Record> compressedIterator(BufferSupplier bufferSupplier, boolean skipKeyValue) { final ByteBuffer buffer = this.buffer.duplicate(); buffer.position(RECORDS_OFFSET); final DataInputStream inputStream = new DataInputStream(compressionType().wrapForInput(buffer, magic(), bufferSupplier)); if (skipKeyValue) { byte[] array = new byte[MAX_SKIP_BUFFER_SIZE]; ByteBuffer skipBuffer = ByteBuffer.wrap(array); skipBuffer.limit(0); return new StreamRecordIterator(inputStream) { @Override protected Record readNext(long baseOffset, long firstTimestamp, int baseSequence, Long logAppendTime) { try { return DefaultRecord.readPartiallyFrom(inputStream, skipBuffer, baseOffset, firstTimestamp, baseSequence, logAppendTime); } catch (EOFException e) { throw new InvalidRecordException("Incorrect declared batch size, premature EOF reached"); } catch (IOException e) { throw new KafkaException("Failed to decompress record stream", e); } } }; } else { return new StreamRecordIterator(inputStream) { @Override protected Record readNext(long baseOffset, long firstTimestamp, int baseSequence, Long logAppendTime) { try { return DefaultRecord.readFrom(inputStream, baseOffset, firstTimestamp, baseSequence, logAppendTime); } catch (EOFException e) { throw new InvalidRecordException("Incorrect declared batch size, premature EOF reached"); } catch (IOException e) { throw new KafkaException("Failed to decompress record stream", e); } } }; } }

Target:
private CloseableIterator<Record> compressedIterator(BufferSupplier bufferSupplier, boolean skipKeyValue) { final ByteBuffer buffer = this.buffer.duplicate(); buffer.position(RECORDS_OFFSET); final DataInputStream inputStream = new DataInputStream(compressionType().wrapForInput(buffer, magic(), bufferSupplier)); if (skipKeyValue) { byte[] skipArray = new byte[MAX_SKIP_BUFFER_SIZE]; return new StreamRecordIterator(inputStream) { @Override protected Record doReadRecord(long baseOffset, long firstTimestamp, int baseSequence, Long logAppendTime) throws IOException { return DefaultRecord.readPartiallyFrom(inputStream, skipArray, baseOffset, firstTimestamp, baseSequence, logAppendTime); } }; } else { return new StreamRecordIterator(inputStream) { @Override protected Record doReadRecord(long baseOffset, long firstTimestamp, int baseSequence, Long logAppendTime) throws IOException { return DefaultRecord.readFrom(inputStream, baseOffset, firstTimestamp, baseSequence, logAppendTime); } }; } }
Source:
public void increaseBombRange(){ factory.increaseBlastRange(); }

Target:
private void increaseBombRange(){ factory.increaseBlastRange(); }
Source:
private static Block serializeStruct(Type type, BlockBuilder builder, Object object) { if (object == null) { requireNonNull(builder, "builder is null"); builder.appendNull(); return null; } if (builder == null) { builder = type.createBlockBuilder(null, 1); } BlockBuilder currentBuilder = builder.beginBlockEntry(); List<Type> typeParameters = type.getTypeParameters(); for (int i = 0; i < typeParameters.size(); i++) { Optional<String> fieldName = type.getTypeSignature().getParameters().get(i).getNamedTypeSignature().getName(); String name = ""; if (fieldName.isPresent()) { name = fieldName.get().toLowerCase(ENGLISH); } Object value = ((Map) object).get(name); serializeObject(typeParameters.get(i), currentBuilder, value); } builder.closeEntry(); return (Block) type.getObject(builder, 0); }

Target:
private static Block serializeStruct(Type type, BlockBuilder builder, Object object) { if (object == null) { requireNonNull(builder, "builder is null"); builder.appendNull(); return builder.build(); } if (builder == null) { builder = type.createBlockBuilder(null, 1); } BlockBuilder currentBuilder = builder.beginBlockEntry(); List<Type> typeParameters = type.getTypeParameters(); for (int i = 0; i < typeParameters.size(); i++) { Optional<String> fieldName = type.getTypeSignature().getParameters().get(i).getNamedTypeSignature().getName(); String name = ""; if (fieldName.isPresent()) { name = fieldName.get().toLowerCase(ENGLISH); } Object value = ((Map) object).get(name); serializeObject(typeParameters.get(i), currentBuilder, value); } builder.closeEntry(); return (Block) type.getObject(builder, 0); }
Source:
private boolean isDelemiter(char ch) { for (String d : TextUtilities.DELIMITERS) { if (d.length() == 1 && ch == d.charAt(0)) { return true; } } return false; }

Target:
private boolean isDelemiter(char ch) { for (String delim : TextUtilities.DELIMITERS) { if (delim.length() == 1 && ch == delim.charAt(0)) { return true; } } return false; }
Source:
private VariantSourceEntity doRead() throws IOException { if (variantReader == null) { throw new IllegalStateException("The method VcfHeaderReader.open() should be called before reading"); } variantReader.pre(); source.addMetadata(VARIANT_FILE_HEADER_KEY, variantReader.getHeader()); List<String> sampleNames = variantReader.getSampleNames(); Set<String> uniformSamples = new HashSet<String>(); for (String sample : sampleNames) { if ((uniformSamples.contains(sample))) { throw new IOException("Duplicate sample name given: " + sample); } uniformSamples.add(sample); } return new VariantSourceEntity(source); }

Target:
private VariantSourceEntity doRead() throws DuplicateSamplesFoundException { if (variantReader == null) { throw new IllegalStateException("The method VcfHeaderReader.open() should be called before reading"); } variantReader.pre(); source.addMetadata(VARIANT_FILE_HEADER_KEY, variantReader.getHeader()); List<String> sampleNames = new ArrayList<String>(variantReader.getSampleNames()); HashSet<String> uniqueSampleNames = new HashSet<String>(sampleNames.size()); List<String> duplicateSampleNames = new ArrayList<String>(); for (String sample : sampleNames) { boolean isDuplicate = !uniqueSampleNames.add(sample); if (isDuplicate) { duplicateSampleNames.add(sample); } } if (!duplicateSampleNames.isEmpty()) { throw new DuplicateSamplesFoundException(duplicateSampleNames); } return new VariantSourceEntity(source); }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { Iterable<CreateSubscriptionRequest> createSubscriptionRequests = (Iterable<CreateSubscriptionRequest>) input; JsonArray subscriptionsJsonArray = new JsonArray(); for(CreateSubscriptionRequest createSubscriptionRequest : createSubscriptionRequests){ JsonObject sunbscriptionRequestObject = subscriptionRequestJsonObjectFunction.apply(createSubscriptionRequest); subscriptionsJsonArray.add(sunbscriptionRequestObject); } JsonObject json = new JsonObject(); json.add("objects", subscriptionsJsonArray); request.setPayload(json.toString()); request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON); return request; }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(input instanceof List, "this binder is only valid for List<CreateSubscriptionRequest>!"); List list = List.class.cast(input); for(Object o : list){ checkArgument(o instanceof CreateSubscriptionRequest, "this binder is only valid for List<CreateSubscriptionRequest>!"); } List<CreateSubscriptionRequest> createSubscriptionRequests = (List<CreateSubscriptionRequest>) input; JsonArray subscriptionsJsonArray = new JsonArray(); for(CreateSubscriptionRequest createSubscriptionRequest : createSubscriptionRequests){ JsonObject sunbscriptionRequestObject = subscriptionRequestJsonObjectFunction.apply(createSubscriptionRequest); subscriptionsJsonArray.add(sunbscriptionRequestObject); } JsonObject json = new JsonObject(); json.add("objects", subscriptionsJsonArray); request.setPayload(json.toString()); request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON); return request; }
Source:
private void checkIfInvalidRowsExpired(Context context, Map<String, Pair<Long, List<Object>>> targetPkToSourceValues) throws SQLException, IOException { long ttl = getTableTtl(); Set<Map.Entry<String, Pair<Long, List<Object>>>> entrySet = targetPkToSourceValues.entrySet(); Iterator<Map.Entry<String, Pair<Long, List<Object>>>> itr = entrySet.iterator(); while(itr.hasNext()) { Map.Entry<String, Pair<Long, List<Object>>> entry = itr.next(); Pair<Long, List<Object>> sourceValues = entry.getValue(); Long sourceTS = sourceValues.getFirst(); if (hasRowExpiredOnSource(sourceTS, ttl)) { context.getCounter(PhoenixScrutinyJobCounters.EXPIRED_ROW_COUNT).increment(1); itr.remove(); } } }

Target:
protected void checkIfInvalidRowsExpired(Context context, Map<String, Pair<Long, List<Object>>> targetPkToSourceValues) { Set<Map.Entry<String, Pair<Long, List<Object>>>> entrySet = targetPkToSourceValues.entrySet(); Iterator<Map.Entry<String, Pair<Long, List<Object>>>> itr = entrySet.iterator(); while(itr.hasNext()) { Map.Entry<String, Pair<Long, List<Object>>> entry = itr.next(); Pair<Long, List<Object>> sourceValues = entry.getValue(); Long sourceTS = sourceValues.getFirst(); if (hasRowExpiredOnSource(sourceTS, ttl)) { context.getCounter(PhoenixScrutinyJobCounters.EXPIRED_ROW_COUNT).increment(1); itr.remove(); } } }
Source:
MountVolumeInfo(Configuration conf) { storageTypeVolumeMap = new ConcurrentHashMap<>(); reservedForArchiveDefault = conf.getDouble( DFSConfigKeys.DFS_DATANODE_RESERVE_FOR_ARCHIVE_DEFAULT_PERCENTAGE, DFSConfigKeys .DFS_DATANODE_RESERVE_FOR_ARCHIVE_DEFAULT_PERCENTAGE_DEFAULT); if (reservedForArchiveDefault > 1) { FsDatasetImpl.LOG.warn("Value of reserve-for-archival is > 100%." + " Setting it to 100%."); reservedForArchiveDefault = 1; } }

Target:
MountVolumeInfo(Configuration conf) { storageTypeVolumeMap = new ConcurrentHashMap<>(); reservedForArchiveDefault = conf.getDouble( DFSConfigKeys.DFS_DATANODE_RESERVE_FOR_ARCHIVE_DEFAULT_PERCENTAGE, DFSConfigKeys .DFS_DATANODE_RESERVE_FOR_ARCHIVE_DEFAULT_PERCENTAGE_DEFAULT); if (reservedForArchiveDefault > 1) { FsDatasetImpl.LOG.warn("Value of reserve-for-archival is > 100%." + " Setting it to 100%."); reservedForArchiveDefault = 1; } if (reservedForArchiveDefault < 0) { FsDatasetImpl.LOG.warn("Value of reserve-for-archival is < 0." + " Setting it to 0.0"); reservedForArchiveDefault = 0; } }
Source:
public void testDump() { ZMsg msg = new ZMsg() .add(new byte[0]) .add(new byte[] { (byte) 0xAA }) .dump(); StringBuilder out = new StringBuilder(); msg.dump(out); System.out.println(msg.toString()); assertThat(out.toString(), endsWith("[000] \n[001] AA\n")); }

Target:
public void testDump() { ZMsg msg = new ZMsg() .add(new byte[0]) .add(new byte[] { (byte) 0xAA }); msg.dump(); StringBuilder out = new StringBuilder(); msg.dump(out); System.out.println(msg.toString()); assertThat(out.toString(), endsWith("[000] \n[001] AA\n")); }
Source:
public void waitForDependencies(DatastreamTaskImpl task, Duration timeout) { task.getDependencies().stream().forEach(previousTask -> { String lockPath = KeyBuilder.datastreamTaskLock(_cluster, task.getConnectorType(), previousTask); if (_zkclient.exists(lockPath)) { waitForTaskRelease(task, timeout.toMillis(), lockPath); } }); }

Target:
public void waitForDependencies(DatastreamTaskImpl task, Duration timeout) { task.getDependencies().forEach(previousTask -> { String lockPath = KeyBuilder.datastreamTaskLock(_cluster, task.getConnectorType(), previousTask); if (_zkclient.exists(lockPath)) { waitForTaskRelease(task, timeout.toMillis(), lockPath); } }); }
Source:
public void configuredInterpreter() throws Exception { setGlobalInterpreter("/bin/bash"); Controller c = new BourneShellScript("echo $SHELL").launch(new EnvVars(), ws, launcher, listener); awaitCompletion(c); ByteArrayOutputStream baos = new ByteArrayOutputStream(); c.writeLog(ws, new TeeOutputStream(baos, System.out)); assertEquals(0, c.exitStatus(ws, launcher, listener).intValue()); assertThat(baos.toString(), containsString("echo")); assertThat(baos.toString(), containsString("/bash")); c.cleanup(ws); setGlobalInterpreter("bash"); c = new BourneShellScript("echo $SHELL").launch(new EnvVars(), ws, launcher, listener); awaitCompletion(c); baos = new ByteArrayOutputStream(); c.writeLog(ws, new TeeOutputStream(baos, System.out)); assertEquals(0, c.exitStatus(ws, launcher, listener).intValue()); assertThat(baos.toString(), containsString("echo")); assertThat(baos.toString(), containsString("/bash")); c.cleanup(ws); setGlobalInterpreter("no_such_shell"); c = new BourneShellScript("echo $SHELL").launch(new EnvVars(), ws, launcher, listener); awaitCompletion(c); baos = new ByteArrayOutputStream(); c.writeLog(ws, new TeeOutputStream(baos, System.out)); assertNotEquals(0, c.exitStatus(ws, launcher, listener).intValue()); assertThat(baos.toString(), containsString("no_such_shell")); c.cleanup(ws); }

Target:
@Test public void configuredInterpreter() throws Exception { DumbSlave node = createDockerSlave(dockerSlim.get()); j.jenkins.addNode(node); j.waitOnline(node); launcher = node.createLauncher(listener); ws = node.getWorkspaceRoot().child("configuredInterpreter"); ws.mkdirs(); setGlobalInterpreter("/bin/bash"); String script = "if [ ! -z \"$BASH_VERSION\" ]; then echo 'this is bash'; else echo 'this is not'; fi"; Controller c = new BourneShellScript(script).launch(new EnvVars(), ws, launcher, listener); awaitCompletion(c); ByteArrayOutputStream baos = new ByteArrayOutputStream(); c.writeLog(ws, new TeeOutputStream(baos, System.out)); assertEquals(0, c.exitStatus(ws, launcher, listener).intValue()); assertThat(baos.toString(), containsString("this is bash")); c.cleanup(ws); setGlobalInterpreter("bash"); c = new BourneShellScript(script).launch(new EnvVars(), ws, launcher, listener); awaitCompletion(c); baos = new ByteArrayOutputStream(); c.writeLog(ws, new TeeOutputStream(baos, System.out)); assertEquals(0, c.exitStatus(ws, launcher, listener).intValue()); assertThat(baos.toString(), containsString("this is bash")); c.cleanup(ws); setGlobalInterpreter("no_such_shell"); c = new BourneShellScript(script).launch(new EnvVars(), ws, launcher, listener); awaitCompletion(c); baos = new ByteArrayOutputStream(); c.writeLog(ws, new TeeOutputStream(baos, System.out)); assertNotEquals(0, c.exitStatus(ws, launcher, listener).intValue()); assertThat(baos.toString(), containsString("no_such_shell")); c.cleanup(ws); }
Source:
public Map<String, String> getEnv(URI uri) throws CoreException { IRemoteServices services = RemoteServices.getRemoteServices(uri); IRemoteConnection connection = services.getConnectionManager().getConnection(uri); if(!connection.isOpen()) try { connection.open(null); } catch (RemoteConnectionException e) { Status status = new Status(IStatus.ERROR, e.getMessage(), Activator.PLUGIN_ID); Activator.getDefault().getLog().log(status); return Collections.emptyMap(); } return connection.getEnv(); }

Target:
public Map<String, String> getEnv(URI uri) throws CoreException { IRemoteServices services = RemoteServices.getRemoteServices(uri); IRemoteConnection connection = services.getConnectionManager().getConnection(uri); if(!connection.isOpen()) { try { connection.open(null); } catch (RemoteConnectionException e) { Status status = new Status(IStatus.ERROR, e.getMessage(), Activator.PLUGIN_ID); Activator.getDefault().getLog().log(status); return Collections.emptyMap(); } } return connection.getEnv(); }
Source:
public Builder client(@NonNull OkHttpClient client) { if (client == null) { throw new NullPointerException("client == null"); } if (downloader != null) { throw new IllegalArgumentException("Downloader already set."); } downloader = new OkHttp3Downloader(client, client.cache(), true); return this; }

Target:
public Builder client(@NonNull OkHttpClient client) { if (client == null) { throw new NullPointerException("client == null"); } downloader = new OkHttp3Downloader(client, client.cache(), true); return this; }
Source:
static void sleep(long ms) throws IOException { if (ms < 0) { return; } try { Thread.sleep(ms); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException(e); } }

Target:
static void sleep(long ms) throws InterruptedIOException { if (ms <= 0) { return; } try { Thread.sleep(ms); } catch (InterruptedException e) { InterruptedIOException ie = new InterruptedIOException(); ie.initCause(e); throw ie; } }
Source:
protected void performQueryingIntegrityCheck(Ignite ig, int key) throws Exception { IgniteCache<Object, Object> cache = ig.cache(POI_CACHE_NAME).withKeepBinary(); List<List<?>> res = cache.query(new SqlFieldsQuery( String.format("DELETE FROM %s WHERE %s = %d", POI_TABLE_NAME, ID_FIELD_NAME, key)) .setSchema(POI_SCHEMA_NAME)).getAll(); assertEquals(1, res.size()); assertNull(cache.get(key)); res = cache.query(new SqlFieldsQuery( String.format( "INSERT INTO %s(%s) VALUES (%s)", POI_TABLE_NAME, String.join(",", ID_FIELD_NAME, NAME_FIELD_NAME), String.join(",", String.valueOf(key),"'test'")) ).setSchema(POI_SCHEMA_NAME)).getAll(); assertEquals(1, res.size()); assertNotNull(cache.get(key)); res = cache.query(new SqlFieldsQuery(String.format("UPDATE %s SET %s = '%s' WHERE ID = %d", POI_TABLE_NAME, NAME_FIELD_NAME, "POI_" + key, key)).setSchema(POI_SCHEMA_NAME)).getAll(); assertEquals(1, res.size()); assertEquals("POI_" + key, ((BinaryObject)cache.get(key)).field(NAME_FIELD_NAME)); assertIndexUsed(cache, "SELECT * FROM " + POI_TABLE_NAME + " WHERE ID = " + key, KEY_PK_IDX_NAME); }

Target:
protected void performQueryingIntegrityCheck(Ignite ig, int key) throws Exception { IgniteCache<Object, Object> cache = ig.cache(POI_CACHE_NAME).withKeepBinary(); String sql = String.format("DELETE FROM %s WHERE %s = %d", POI_TABLE_NAME, ID_FIELD_NAME, key); List<List<?>> res = cache.query(new SqlFieldsQuery(sql).setSchema(POI_SCHEMA_NAME)).getAll(); assertEquals(1, res.size()); assertNull(cache.get(key)); sql = String.format("INSERT INTO %s(%s) VALUES (%s)", POI_TABLE_NAME, String.join(",", ID_FIELD_NAME, NAME_FIELD_NAME), String.join(",", String.valueOf(key), "'test'")); res = cache.query(new SqlFieldsQuery(sql).setSchema(POI_SCHEMA_NAME)).getAll(); assertEquals(1, res.size()); assertNotNull(cache.get(key)); sql = String.format("UPDATE %s SET %s = '%s' WHERE ID = %d", POI_TABLE_NAME, NAME_FIELD_NAME, "POI_" + key, key); res = cache.query(new SqlFieldsQuery(sql).setSchema(POI_SCHEMA_NAME)).getAll(); assertEquals(1, res.size()); assertEquals("POI_" + key, ((BinaryObject)cache.get(key)).field(NAME_FIELD_NAME)); assertIndexUsed(cache, "SELECT * FROM " + POI_TABLE_NAME + " WHERE ID = " + key, KEY_PK_IDX_NAME); }
Source:
public String toString() { return componentName + " " + taskId + " " + componentIndex; }

Target:
public String toString() { return String.format("Component Name: %s, Task Id: %d, Component Index: %d", componentName, taskId, componentIndex); }
Source:
@Override public Set<BlockMatrixKey> getAllKeys() { int maxRowIndex = rows - 1; int maxColIndex = cols - 1; IgnitePair<Long> maxBlockId = getBlockId(maxRowIndex, maxColIndex); Set<BlockMatrixKey> keyset = new HashSet<>(); for(int i = 0; i <= maxBlockId.get1(); i++) for(int j = 0; j <= maxBlockId.get2(); j++) keyset.add(getCacheKey(i,j)); return keyset; }

Target:
@Override public Set<BlockMatrixKey> getAllKeys() { int maxRowIdx = rows - 1; int maxColIdx = cols - 1; IgnitePair<Long> maxBlockId = getBlockId(maxRowIdx, maxColIdx); Set<BlockMatrixKey> keyset = new HashSet<>(); for(int i = 0; i <= maxBlockId.get1(); i++) for(int j = 0; j <= maxBlockId.get2(); j++) keyset.add(getCacheKey(i,j)); return keyset; }
Source:
private static List<List<ColumnEncoding>> toColumnEncoding(List<OrcType> types, List<DwrfProto.ColumnEncoding> columnEncodings) { Map<Integer, List<DwrfProto.ColumnEncoding>> columnEncodingsByColumn = new HashMap<>(columnEncodings.size()); for (int i = 0; i < columnEncodings.size(); i++) { DwrfProto.ColumnEncoding columnEncoding = columnEncodings.get(i); int column = columnEncoding.getColumn(); if (column == 0) { column = i; } List<DwrfProto.ColumnEncoding> columnEncodingsForColumn = columnEncodingsByColumn.getOrDefault(column, new ArrayList<>()); columnEncodingsForColumn.add(columnEncoding); columnEncodingsByColumn.put(column, columnEncodingsForColumn); } ImmutableList.Builder<List<ColumnEncoding>> resultBuilder = ImmutableList.builder(); for (Map.Entry<Integer, List<DwrfProto.ColumnEncoding>> entry : columnEncodingsByColumn.entrySet()) { OrcType type = types.get(entry.getKey()); List<ColumnEncoding> columnEncoding = entry.getValue().stream() .map(encoding -> toColumnEncoding(type, encoding)) .collect(toImmutableList()); resultBuilder.add(columnEncoding); } return resultBuilder.build(); }

Target:
private static List<ColumnEncoding> toColumnEncoding(List<OrcType> types, List<DwrfProto.ColumnEncoding> columnEncodings) { Map<Integer, List<DwrfProto.ColumnEncoding>> columnEncodingsByColumn = new HashMap<>(columnEncodings.size()); for (int i = 0; i < columnEncodings.size(); i++) { DwrfProto.ColumnEncoding columnEncoding = columnEncodings.get(i); int column = columnEncoding.getColumn(); if (!columnEncoding.hasColumn()) { column = i; } columnEncodingsByColumn.computeIfAbsent(column, key -> new ArrayList<>()).add(columnEncoding); } ImmutableList.Builder<ColumnEncoding> resultBuilder = ImmutableList.builder(); for (Map.Entry<Integer, List<DwrfProto.ColumnEncoding>> entry : columnEncodingsByColumn.entrySet()) { OrcType type = types.get(entry.getKey()); DwrfProto.ColumnEncoding columnEncoding = entry.getValue().get(0); resultBuilder.add( new ColumnEncoding( toColumnEncodingKind(type.getOrcTypeKind(), columnEncoding.getKind()), columnEncoding.getDictionarySize(), toAdditionalSequenceEncodings(entry.getValue(), type))); } return resultBuilder.build(); }
Source:
private static IdentifierFactory locateFactories(ClassLoader classLoader, String classLoaderName) { logger.debug("Looking for IdentifierFactory implementation using the class loader", classLoaderName); IdentifierFactory found = null; Iterator<IdentifierFactory> services = ServiceLoader.load(IdentifierFactory.class, classLoader).iterator(); if (services.hasNext()) { try { found = services.next(); logger.debug("Found IdentifierFactory implementation using the class Loader", classLoaderName); } catch (ServiceConfigurationError error) { logger.warn("A service configuration error occurred for the provided IdentifierFactory: {}", error.getMessage()); } if (services.hasNext()) { logger.warn("More than one IdentifierFactory implementation was found using the " + "Class Loader. This may result in different selections being made after " + "restart of the application.", classLoaderName); } } return found; }

Target:
private static IdentifierFactory locateFactories(ClassLoader classLoader, String classLoaderName) { IdentifierFactory found = null; Iterator<IdentifierFactory> services = ServiceLoader.load(IdentifierFactory.class, classLoader).iterator(); if (services.hasNext()) { logger.debug("Found IdentifierFactory implementation using the Class Loader", classLoaderName); found = services.next(); if (services.hasNext()) { logger.warn("More than one IdentifierFactory implementation was found using the " + "Class Loader. This may result in different selections being made after " + "restart of the application.", classLoaderName); } } return found; }
Source:
public ICompletableFuture<Void> putAllAsync(@Nonnull Map<? extends K, ? extends V> m) { SimpleCompletableFuture<Void> future = new SimpleCompletableFuture<>(ForkJoinPool.commonPool(), getClient().getLoggingService().getLogger(ClientMapProxy.class)); putAllInternal(m, future); return future; }

Target:
public ICompletableFuture<Void> putAllAsync(@Nonnull Map<? extends K, ? extends V> m) { SimpleCompletableFuture<Void> future = new SimpleCompletableFuture<>( getClient().getClientExecutionService().getUserExecutor(), getClient().getLoggingService().getLogger(ClientMapProxy.class)); putAllInternal(m, future); return future; }
Source:
public void run() { started = true; if(!prepared) { logger.error("The StageRunner was not prepared prior to being started. Aborting!"); return; } if(stageGroup.getStages().size()<1) { logger.info("Stage group "+stageGroup.getName() + " has no stages, and can not be started."); return; } do { logger.info("Starting stage group " + stageGroup.getName() + ". Times started so far: " + timesStarted); timesStarted++; boolean cleanShutdown = runGroup(); if (cleanShutdown) { return; } if (!hasQueried()) { logger.error("The stage group " + stageGroup.getName() + " did not start. It will not be restarted until configuration changes."); return; } } while ((timesToRetry == -1 || timesToRetry >= timesStarted) && !Main.isShuttingDown()); logger.error("Stage group " + stageGroup.getName() + " has failed and cannot be restarted. "); }

Target:
public void run() { started = true; if(!prepared) { logger.error("The StageRunner was not prepared prior to being started. Aborting!"); return; } if(stageGroup.getStages().size()<1) { logger.info("Stage group "+stageGroup.getName() + " has no stages, and can not be started."); return; } do { logger.info("Starting stage group " + stageGroup.getName() + ". Times started so far: " + timesStarted); timesStarted++; boolean cleanShutdown = runGroup(); if (cleanShutdown) { return; } if (!hasQueried()) { logger.error("The stage group " + stageGroup.getName() + " did not start. It will not be restarted until configuration changes."); return; } } while ((timesToRetry == -1 || timesToRetry >= timesStarted) && !terminationHandler.isTerminating()); logger.error("Stage group " + stageGroup.getName() + " has failed and cannot be restarted. "); }
Source:
static long addExact(long usedBytes, long bytes) { try { return Math.addExact(usedBytes, bytes); } catch (ArithmeticException e) { throw new RuntimeException(String.format("Overflow detected. usedBytes: %d, bytes: %d", usedBytes, bytes), e); } }

Target:
static long addExact(long usedBytes, long bytes) { try { return Math.addExact(usedBytes, bytes); } catch (ArithmeticException e) { throw new RuntimeException(format("Overflow detected. usedBytes: %d, bytes: %d", usedBytes, bytes), e); } }
Source:
private static Node processNodeWithoutAttributes(Node node, Document doc) { Node localNode = node; Element elem = null; String URI = localNode.getNamespaceURI(); URI = (URI == null) ? "" : URI; String name = localNode.getNodeName().toLowerCase(); if (name.equals("#text")) { localNode = processTextNode(node, doc); } else if (name.length() == 1) { switch (name.charAt(0)) { case 'b': try { localNode = doc.renameNode(localNode, URI, "strong"); } catch (DOMException ex) { } break; case 'i': try { localNode = doc.renameNode(localNode, URI, "em"); } catch (DOMException ex) { } break; case 'u': if (localNode instanceof Element) { try { localNode = doc.renameNode(localNode, URI, "span"); elem = (Element) localNode; elem.setAttribute("style", "text-decoration: underline;"); } catch (DOMException ex) { } } break; } } else if (name.equals("strike")) { if (localNode instanceof Element) { try { localNode = doc.renameNode(localNode, URI, "span"); elem = (Element) localNode; elem.setAttribute("style", "text-decoration: line-through;"); } catch (DOMException ex) { } } } return localNode; }

Target:
private Node processNodeWithoutAttributes(Node node, Document doc) { Element elem = null; String URI = Strings.nullToEmpty(node.getNamespaceURI()); String name = node.getNodeName().toLowerCase(); if (name.equals("#text")) { node = processTextNode(node, doc); } else if (name.length() == 1) { switch (name.charAt(0)) { case 'b': try { node = doc.renameNode(node, URI, "strong"); } catch (DOMException ex) { } break; case 'i': try { node = doc.renameNode(node, URI, "em"); } catch (DOMException ex) { } break; case 'u': if (node instanceof Element) { try { node = doc.renameNode(node, URI, "span"); elem = (Element) node; elem.setAttribute("style", "text-decoration: underline;"); } catch (DOMException ex) { } } break; } } else if (name.equals("strike")) { if (node instanceof Element) { try { node = doc.renameNode(node, URI, "span"); elem = (Element) node; elem.setAttribute("style", "text-decoration: line-through;"); } catch (DOMException ex) { } } } return node; }
Source:
public ProjectState next() { ProjectState n = next; if (n == null) { throw new NoSuchElementException(); } next = null; Project.NameKey parentName = n.getProject().getParent(); if (parentName != null && seen.add(parentName)) { ProjectState p = cache.get(parentName); if (p != null) { next = p; return n; } } if (seen.add(allProjectsName)) { next = cache.get(allProjectsName); } return n; }

Target:
public ProjectState next() { ProjectState n = next; if (n == null) { throw new NoSuchElementException(); } next = computeNext(n); return n; }
Source:
private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = asyncTaskDao.getAll(); Set<Guid> asyncTaskManagerManagedCommands = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getCommandId()).collect(Collectors.toSet())); getCommands(false).stream() .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.setReacquireLocks(x.getId(), true)); ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled()) .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); }

Target:
private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = asyncTaskDao.getAll(); Set<Guid> asyncTaskManagerManagedCommands = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getCommandId()).collect(Collectors.toSet())); getCommands(false).stream() .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> retrieveCommand(x.getId()).reacquireLocks()); ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled()) .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); }
Source:
protected void examineStorageSubSystemCommandFullCloneFlagForVmware(CopyCommand cmd, EnumMap<VmwareStorageProcessorConfigurableFields,Object> params) { HypervisorType hypervisor = cmd.getDestTO().getHypervisorType(); if (hypervisor == null || (hypervisor != null && ! hypervisor.equals(HypervisorType.VMware))) return; DataStoreTO destDataStore = cmd.getDestTO().getDataStore(); if (destDataStore instanceof PrimaryDataStoreTO){ PrimaryDataStoreTO dest = (PrimaryDataStoreTO) destDataStore; if (dest.isFullCloneFlag() != null){ params.put(VmwareStorageProcessorConfigurableFields.FULL_CLONE_FLAG, dest.isFullCloneFlag().booleanValue()); } } }

Target:
protected EnumMap<VmwareStorageProcessorConfigurableFields,Object> examineStorageSubSystemCommandFullCloneFlagForVmware(CopyCommand cmd, EnumMap<VmwareStorageProcessorConfigurableFields,Object> params) { EnumMap<VmwareStorageProcessorConfigurableFields, Object> paramsCopy = new EnumMap<VmwareStorageProcessorConfigurableFields, Object>(params); HypervisorType hypervisor = cmd.getDestTO().getHypervisorType(); if (hypervisor != null && hypervisor.equals(HypervisorType.VMware)){ DataStoreTO destDataStore = cmd.getDestTO().getDataStore(); if (destDataStore instanceof PrimaryDataStoreTO){ PrimaryDataStoreTO dest = (PrimaryDataStoreTO) destDataStore; if (dest.isFullCloneFlag() != null){ paramsCopy.put(VmwareStorageProcessorConfigurableFields.FULL_CLONE_FLAG, dest.isFullCloneFlag().booleanValue()); } } } return paramsCopy; }
Source:
private void fillBuffer() { if (remaining > 0 || endOfFile) { return; } int next; while (true) { if (trunk == null) { trunk = trunkIterator.next(); trunkIndex = 0; logKey++; if (trunk == null || trunk.getLogKey() != logKey) { endOfFile = true; return; } } else { next = trunk.getPageData(trunkIndex++); if (next == -1) { trunk = null; } else if (dataPage == -1 || dataPage == next) { break; } } } if (trace.isDebugEnabled()) { trace.debug("pageIn.readPage " + next); } dataPage = -1; data = null; Page p = store.getPage(next); if (p instanceof PageStreamData) { data = (PageStreamData) p; } if (data == null || data.getLogKey() != logKey) { endOfFile = true; return; } dataPos = PageStreamData.getReadStart(); remaining = store.getPageSize() - dataPos; }

Target:
private void fillBuffer() { if (remaining > 0 || endOfFile) { return; } int next; while (true) { if (trunk == null) { trunk = trunkIterator.next(); trunkIndex = 0; logKey++; if (trunk == null || trunk.getLogKey() != logKey) { endOfFile = true; return; } } if (trunk != null) { next = trunk.getPageData(trunkIndex++); if (next == -1) { trunk = null; } else if (dataPage == -1 || dataPage == next) { break; } } } if (trace.isDebugEnabled()) { trace.debug("pageIn.readPage " + next); } dataPage = -1; data = null; Page p = store.getPage(next); if (p instanceof PageStreamData) { data = (PageStreamData) p; } if (data == null || data.getLogKey() != logKey) { endOfFile = true; return; } dataPos = PageStreamData.getReadStart(); remaining = store.getPageSize() - dataPos; }
Source:
protected SubtaskAllExecutionAttemptsDetailsInfo createSubtaskExecutionAttemptsDetailsInfo( AccessExecutionVertex executionVertex, JobID jobID, JobVertexID jobVertexID) { List<SubtaskExecutionAttemptDetailsInfo> allAttempts = new ArrayList<>(); executionVertex.getPriorExecutionAttempts().forEach(execution -> { if (execution != null) { allAttempts.add(SubtaskExecutionAttemptDetailsInfo.create(execution, metricFetcher, jobID, jobVertexID)); } }); allAttempts.add(SubtaskExecutionAttemptDetailsInfo.create(executionVertex.getCurrentExecutionAttempt(), metricFetcher, jobID, jobVertexID)); return new SubtaskAllExecutionAttemptsDetailsInfo(allAttempts); }

Target:
protected SubtaskAllExecutionAttemptsDetailsInfo createSubtaskExecutionAttemptsDetailsInfo( AccessExecutionVertex executionVertex, JobID jobID, JobVertexID jobVertexID) { List<SubtaskExecutionAttemptDetailsInfo> allAttempts = new ArrayList<>(); executionVertex .getPriorExecutionAttempts() .forEach(execution -> allAttempts.add(SubtaskExecutionAttemptDetailsInfo.create(execution, metricFetcher, jobID, jobVertexID))); allAttempts.add(SubtaskExecutionAttemptDetailsInfo.create(executionVertex.getCurrentExecutionAttempt(), metricFetcher, jobID, jobVertexID)); return new SubtaskAllExecutionAttemptsDetailsInfo(allAttempts); }
Source:
protected void process(List<Integer> chunks) { myUiFacade.setDownloadProgress(chunks.get(chunks.size() - 1)); }

Target:
protected void process(List<Integer> chunks) { String statusText = ""; int chunk = chunks.get(chunks.size() - 1); if (chunk > -1) { statusText = GanttLanguage.getInstance().formatText("downloadProgress", chunk); } myUiFacade.setStatusText(statusText); }
Source:
private JsonElement serializeModule(ProjectConfig moduleConfig, JsonSerializationContext context) { JsonObject object = new JsonObject(); object.addProperty("name", moduleConfig.getName()); object.addProperty("path", moduleConfig.getPath()); object.addProperty("type", moduleConfig.getType()); object.addProperty("description", moduleConfig.getDescription()); object.addProperty("content_root", moduleConfig.getContentRoot()); object.add("mixins", context.serialize(moduleConfig.getMixins())); object.add("attributes", context.serialize(moduleConfig.getAttributes())); object.add("modules", serializeModules(moduleConfig, context)); object.add("links", context.serialize(moduleConfig.getLinks())); object.add("problems", context.serialize(moduleConfig.getProblems())); object.add("source", context.serialize(moduleConfig.getSource())); return object; }

Target:
private JsonElement serializeModule(ProjectConfig moduleConfig, JsonSerializationContext context) { JsonObject object = new JsonObject(); object.addProperty("name", moduleConfig.getName()); object.addProperty("path", moduleConfig.getPath()); object.addProperty("type", moduleConfig.getType()); object.addProperty("content_root", moduleConfig.getContentRoot()); object.add("attributes", context.serialize(moduleConfig.getAttributes())); object.add("modules", serializeModules(moduleConfig, context)); object.add("source", context.serialize(moduleConfig.getSource())); return object; }
Source:
public AzureEnvironment environment() { if (this.environment == null) { this.environment = AzureEnvironment.AZURE; } return environment; }

Target:
public AzureEnvironment environment() { return environment; }
Source:
public void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystemBuilder ss = fProvider.getAssignedStateSystem(); int increment = 0; ITmfStateValue incrementValue = getValue(event); if (incrementValue.getType() == ITmfStateValue.Type.INTEGER) { increment = incrementValue.unboxInt(); } else if (incrementValue.getType() == ITmfStateValue.Type.LONG) { increment = (int) incrementValue.unboxLong(); } else { Activator.logWarning(String.format("TmfXmlStateValue: The event field increment %s is not a number type but a %s", fFieldName, incrementValue.getType())); } int currentValue = ss.queryOngoingState(quark).unboxInt(); ITmfStateValue value = TmfStateValue.newValueInt(increment + currentValue); processValue(quark, timestamp, value); }

Target:
public void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystemBuilder ss = fProvider.getAssignedStateSystem(); ITmfStateValue incrementValue = getValue(event); switch (incrementValue.getType()) { case INTEGER: { int increment = incrementValue.unboxInt(); int currentValue = ss.queryOngoingState(quark).unboxInt(); ITmfStateValue value = TmfStateValue.newValueInt(increment + currentValue); processValue(quark, timestamp, value); break; } case LONG: { long incrementLong = incrementValue.unboxLong(); long currentValue = ss.queryOngoingState(quark).unboxLong(); ITmfStateValue value = TmfStateValue.newValueLong(incrementLong + currentValue); processValue(quark, timestamp, value); break; } case DOUBLE: case NULL: case STRING: default: Activator.logWarning(String.format("TmfXmlStateValue: The event field increment %s is not a number type but a %s", fFieldName, incrementValue.getType())); break; } }
Source:
protected void playMedia(String mediaType) { Intent i = new Intent("android.intent.action.VIEW"); File mediaFile = new File(mInstanceFolder + mBinaryName); Uri mediaUri = FileUtil.getUriForExternalFile(getContext(), mediaFile); i.setDataAndType(mediaUri, mediaType); UriToFilePath.grantPermissionForUri(getContext(), i, mediaUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); try { getContext().startActivity(i); } catch (ActivityNotFoundException e) { Toast.makeText(getContext(), StringUtils.getStringSpannableRobust(getContext(), R.string.activity_not_found, "play media"), Toast.LENGTH_SHORT).show(); } }

Target:
protected void playMedia(String mediaType) { Intent i = new Intent("android.intent.action.VIEW"); File mediaFile = new File(mInstanceFolder + mBinaryName); Uri mediaUri = FileUtil.getUriForExternalFile(getContext(), mediaFile); i.setDataAndType(mediaUri, mediaType); UriToFilePath.grantPermissionForUri(getContext(), i, mediaUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); try { getContext().startActivity(i); } catch (ActivityNotFoundException e) { Toast.makeText(getContext(), StringUtils.getStringSpannableRobust(getContext(), R.string.activity_not_found, "play " + mediaType.substring(0, mediaType.indexOf("/"))), Toast.LENGTH_SHORT).show(); } }
Source:
protected Pool assembleDevPool(Consumer consumer, String sku) { Set<Product> providedProducts = new HashSet<Product>(); Date now = new Date(); Product prod = getCdkInstalledProduct(consumer, sku); if (StringUtils.isEmpty(prod.getAttributeValue("support_level"))) { prod.setAttribute("support_level", this.DEFAULT_CDK_SLA); prod = productCurator.createOrUpdate(prod); } for (ConsumerInstalledProduct ip : consumer.getInstalledProducts()) { providedProducts.add(getCdkInstalledProduct(consumer, ip.getProductId())); } Date then = new Date(now.getTime() + getPoolInterval(prod)); Pool p = new Pool(consumer.getOwner(), prod, providedProducts, 1L, now, then, "", "", ""); p.setAttribute(Pool.DEVELOPMENT_POOL_ATTRIBUTE, "true"); p.setAttribute(Pool.REQUIRES_CONSUMER_ATTRIBUTE, consumer.getUuid()); return p; }

Target:
protected Pool assembleDevPool(Consumer consumer, String sku) { Set<Product> providedProducts = new HashSet<Product>(); Date now = new Date(); List<String> devProductIds = new ArrayList<String>(); Product skuProd = null; devProductIds.add(sku); for (ConsumerInstalledProduct ip : consumer.getInstalledProducts()) { devProductIds.add(ip.getProductId()); } List<Product> prods = productAdapter.getProductsByIds(consumer.getOwner(), devProductIds); verifyDevProducts(devProductIds, prods); for (Product prod : prods) { prod.setOwner(consumer.getOwner()); for (ProductContent pc : prod.getProductContent()) { pc.getContent().setOwner(consumer.getOwner()); } if (sku.equals(prod.getId())) { if (StringUtils.isEmpty(prod.getAttributeValue("support_level"))) { prod.setAttribute("support_level", this.DEFAULT_DEV_SLA); } skuProd = prod; } else { providedProducts.add(prod); } productCurator.createOrUpdate(prod); } Date then = new Date(now.getTime() + getPoolInterval(skuProd)); Pool p = new Pool(consumer.getOwner(), skuProd, providedProducts, 1L, now, then, "", "", ""); log.info("Created development pool with SKU " + skuProd.getId()); p.setAttribute(Pool.DEVELOPMENT_POOL_ATTRIBUTE, "true"); p.setAttribute(Pool.REQUIRES_CONSUMER_ATTRIBUTE, consumer.getUuid()); return p; }
Source:
public boolean isAssignedSeveralTimes() { if (Objects.nonNull(selectedLogicalNode) && selectedLogicalNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); if (Objects.nonNull(structureTreeNode.getDataObject()) && structureTreeNode.getDataObject() instanceof View) { View view = (View) structureTreeNode.getDataObject(); return view.getMediaUnit().getIncludedStructuralElements().size() > 1; } } return false; }

Target:
public boolean isAssignedSeveralTimes() { if (Objects.nonNull(selectedLogicalNode) && selectedLogicalNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); if (structureTreeNode.getDataObject() instanceof View) { View view = (View) structureTreeNode.getDataObject(); return view.getMediaUnit().getIncludedStructuralElements().size() > 1; } } return false; }
Source:
private void populateNodeParameters(PreparedStatement statement, int initialIndex, Node node) { int prmIndex = 0; if (node.getTimestamp() == null) { throw new OsmosisRuntimeException("Node " + node.getId() + " does not have a timestamp set."); } try { statement.setLong(++prmIndex, node.getId()); statement.setTimestamp(++prmIndex, new Timestamp(node.getTimestamp().getTime())); statement.setInt(++prmIndex, node.getVersion()); statement.setBoolean(++prmIndex, true); statement.setLong(++prmIndex, node.getChangesetId()); statement.setInt(++prmIndex, FixedPrecisionCoordinateConvertor.convertToFixed(node.getLatitude())); statement.setInt(++prmIndex, FixedPrecisionCoordinateConvertor.convertToFixed(node.getLongitude())); statement.setLong(++prmIndex, tileCalculator.calculateTile(node.getLatitude(), node.getLongitude())); } catch (SQLException e) { throw new OsmosisRuntimeException("Unable to set a prepared statement parameter for a node.", e); } }

Target:
private void populateNodeParameters(PreparedStatement statement, int initialIndex, Node node) { int prmIndex = initialIndex; if (node.getTimestamp() == null) { throw new OsmosisRuntimeException("Node " + node.getId() + " does not have a timestamp set."); } try { statement.setLong(++prmIndex, node.getId()); statement.setTimestamp(++prmIndex, new Timestamp(node.getTimestamp().getTime())); statement.setInt(++prmIndex, node.getVersion()); statement.setBoolean(++prmIndex, true); statement.setLong(++prmIndex, node.getChangesetId()); statement.setInt(++prmIndex, FixedPrecisionCoordinateConvertor.convertToFixed(node.getLatitude())); statement.setInt(++prmIndex, FixedPrecisionCoordinateConvertor.convertToFixed(node.getLongitude())); statement.setLong(++prmIndex, tileCalculator.calculateTile(node.getLatitude(), node.getLongitude())); } catch (SQLException e) { throw new OsmosisRuntimeException("Unable to set a prepared statement parameter for a node.", e); } }