auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void doInit() { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); ConversionService conversionService = this.getConversionService(); if (conversionService == null){ conversionService = new GenericConversionService(); } if (conversionService instanceof ConverterRegistry){ ConverterRegistry converterRegistry = (ConverterRegistry) conversionService; <START> if (!conversionService.canConvert(Class.class, String.class)) { <END> converterRegistry.addConverter(new ClassToStringConverter()); converterRegistry.addConverter(new ObjectToStringConverter()); } this.evaluationContext.setTypeConverter(new StandardTypeConverter(conversionService)); } else { logger.warn("ConversionService is not an instance of ConverterRegistry therefore" + "ClassToStringConverter and ObjectToStringConverter will not be registered"); } }</code><technical_language>I some concerns this - for back-porting. ConvertersForPair.add() - adds converters head of list, overriding existing converter canConvert(). I this behavior is correct, I backport this part. in 4.2, need add a boolean allow user converters priority this inbuilts</technical_language>

Target:
protected void doInit() { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); }
Source:
<code>List<RemoteReplicaInfo> getRemoteReplicaInfos(Host remoteHost, StoreEventListener listener) { List<? extends ReplicaId> replicaIds = clusterMap.getReplicaIds(dataNodeId); List<RemoteReplicaInfo> remoteReplicaInfos = new ArrayList<>(); for (ReplicaId replicaId : replicaIds) { for (ReplicaId peerReplicaId : replicaId.getPeerReplicaIds()) { if (peerReplicaId.getDataNodeId().equals(remoteHost.dataNodeId)) { PartitionId partitionId = replicaId.getPartitionId(); MockStore store = storesByPartition.computeIfAbsent(partitionId, partitionId1 -> new MockStore(partitionId, infosByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<MessageInfo>>) partitionId2 -> new ArrayList<>()), buffersByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<ByteBuffer>>) partitionId22 -> new ArrayList<>()), listener)); RemoteReplicaInfo remoteReplicaInfo = new RemoteReplicaInfo(peerReplicaId, replicaId, store, new MockFindToken(0, 0), Long.MAX_VALUE, SystemTime.getInstance(), new Port(peerReplicaId.getDataNodeId().getPort(), PortType.PLAINTEXT)); remoteReplicaInfos.add(remoteReplicaInfo); <START> break; <END> } } } return remoteReplicaInfos; }</code><technical_language>replicas(belong partition) host. assume is one, right</technical_language>

Target:
List<RemoteReplicaInfo> getRemoteReplicaInfos(Host remoteHost, StoreEventListener listener) { List<? extends ReplicaId> replicaIds = clusterMap.getReplicaIds(dataNodeId); List<RemoteReplicaInfo> remoteReplicaInfos = new ArrayList<>(); for (ReplicaId replicaId : replicaIds) { for (ReplicaId peerReplicaId : replicaId.getPeerReplicaIds()) { if (peerReplicaId.getDataNodeId().equals(remoteHost.dataNodeId)) { PartitionId partitionId = replicaId.getPartitionId(); MockStore store = storesByPartition.computeIfAbsent(partitionId, partitionId1 -> new MockStore(partitionId, infosByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<MessageInfo>>) partitionId2 -> new ArrayList<>()), buffersByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<ByteBuffer>>) partitionId22 -> new ArrayList<>()), listener)); RemoteReplicaInfo remoteReplicaInfo = new RemoteReplicaInfo(peerReplicaId, replicaId, store, new MockFindToken(0, 0), Long.MAX_VALUE, SystemTime.getInstance(), new Port(peerReplicaId.getDataNodeId().getPort(), PortType.PLAINTEXT)); remoteReplicaInfos.add(remoteReplicaInfo); } } } return remoteReplicaInfos; }
Source:
<code>private boolean tryRehash() { long newCapacityLong = hashCapacity * 2L; if (newCapacityLong > Integer.MAX_VALUE) { throw new PrestoException(GENERIC_INSUFFICIENT_RESOURCES, "Size of hash table cannot exceed 1 billion entries"); <START> } <END> int newCapacity = (int) newCapacityLong; if (!updateReservedMemory.apply(((long) (newCapacity - hashCapacity)) * (Long.BYTES + Integer.BYTES))) { } expectedHashCollisions += estimateNumberOfHashCollisions(getGroupCount(), hashCapacity); int newMask = newCapacity - 1; LongBigArray newValues = new LongBigArray(); newValues.ensureCapacity(newCapacity); IntBigArray newGroupIds = new IntBigArray(-1); newGroupIds.ensureCapacity(newCapacity); for (int groupId = 0; groupId < nextGroupId; groupId++) { if (groupId == nullGroupId) { continue; } long value = valuesByGroupId.get(groupId); long hashPosition = getHashPosition(value, newMask); while (newGroupIds.get(hashPosition) != -1) { hashPosition = (hashPosition + 1) & newMask; hashCollisions++; } newValues.set(hashPosition, value); newGroupIds.set(hashPosition, groupId); } mask = newMask; hashCapacity = newCapacity; maxFill = calculateMaxFill(hashCapacity); values = newValues; groupIds = newGroupIds; this.valuesByGroupId.ensureCapacity(maxFill); return true; }</code><technical_language>+ verify()</technical_language>

Target:
private boolean tryRehash() { long newCapacityLong = hashCapacity * 2L; if (newCapacityLong > Integer.MAX_VALUE) { throw new PrestoException(GENERIC_INSUFFICIENT_RESOURCES, "Size of hash table cannot exceed 1 billion entries"); } int newCapacity = toIntExact(newCapacityLong); preallocatedMemoryInBytes = (newCapacity - hashCapacity) * (long) (Long.BYTES + Integer.BYTES) + (calculateMaxFill(newCapacity) - maxFill) * Long.BYTES + currentPageSizeInBytes; if (!updateMemory.update()) { return false; } preallocatedMemoryInBytes = 0; expectedHashCollisions += estimateNumberOfHashCollisions(getGroupCount(), hashCapacity); int newMask = newCapacity - 1; LongBigArray newValues = new LongBigArray(); newValues.ensureCapacity(newCapacity); IntBigArray newGroupIds = new IntBigArray(-1); newGroupIds.ensureCapacity(newCapacity); for (int groupId = 0; groupId < nextGroupId; groupId++) { if (groupId == nullGroupId) { continue; } long value = valuesByGroupId.get(groupId); long hashPosition = getHashPosition(value, newMask); while (newGroupIds.get(hashPosition) != -1) { hashPosition = (hashPosition + 1) & newMask; hashCollisions++; } newValues.set(hashPosition, value); newGroupIds.set(hashPosition, groupId); } mask = newMask; hashCapacity = newCapacity; maxFill = calculateMaxFill(hashCapacity); values = newValues; groupIds = newGroupIds; this.valuesByGroupId.ensureCapacity(maxFill); return true; }
Source:
<code>public void fillPresentationAttributes(String name, String value) { logger.log(Level.FINE, ">>>> PROP " + name + " = " + value); if (value.startsWith("url(")) { <START> getTree().logErrorLine("Can't support url values as:" + value, getDocumentNode(), <END> SvgTree.SvgLogLevel.ERROR); return; } mVdAttributesMap.put(name, value); }</code><technical_language>grammatical. "Unsupported URL value: "? (note space ":")</technical_language>

Target:
public void fillPresentationAttributes(String name, String value) { logger.log(Level.FINE, ">>>> PROP " + name + " = " + value); if (value.startsWith("url(")) { getTree().logErrorLine("Unsupported URL value: " + value, getDocumentNode(), SvgTree.SvgLogLevel.ERROR); return; } mVdAttributesMap.put(name, value); }
Source:
<code>public Trace getFragment(String tenantId, String id) { if (log.isLoggable(Level.FINEST)) { log.finest("Get trace fragment: tenantId=[" + tenantId + "] id=[" + id + "]"); } try { URL url = new URL(getUri() + "hawkular/apm/traces/fragments/" + id); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.setDoInput(true); connection.setUseCaches(false); connection.setAllowUserInteraction(false); connection.setRequestProperty("Content-Type", "application/json"); addHeaders(connection, tenantId); java.io.InputStream is = connection.getInputStream(); byte[] b = new byte[is.available()]; int count = is.read(b); if (count != b.length) { log.warning("Incomplete data read"); } is.close(); if (connection.getResponseCode() == 200) { if (log.isLoggable(Level.FINEST)) { log.finest("Returned json=[" + new String(b) + "]"); } try { return mapper.readValue(b, Trace.class); <START> } catch (Throwable t) { <END> log.log(Level.SEVERE, "Failed to deserialize", t); } } else { if (log.isLoggable(Level.FINEST)) { log.finest("Failed to get trace fragment: status=[" + connection.getResponseCode() + "]:" + connection.getResponseMessage()); } } } catch (Exception e) { log.log(Level.SEVERE, "Failed to send 'get' trace fragment request", e); } return null; }</code><technical_language>catch more concrete ex</technical_language>

Target:
public Trace getFragment(String tenantId, String id) { if (log.isLoggable(Level.FINEST)) { log.finest("Get trace fragment: tenantId=[" + tenantId + "] id=[" + id + "]"); } try { URL url = new URL(getUri() + "hawkular/apm/traces/fragments/" + id); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.setDoInput(true); connection.setUseCaches(false); connection.setAllowUserInteraction(false); connection.setRequestProperty("Content-Type", "application/json"); addHeaders(connection, tenantId); java.io.InputStream is = connection.getInputStream(); byte[] b = new byte[is.available()]; int count = is.read(b); if (count != b.length) { log.warning("Incomplete data read"); } is.close(); if (connection.getResponseCode() == 200) { if (log.isLoggable(Level.FINEST)) { log.finest("Returned json=[" + new String(b) + "]"); } try { return mapper.readValue(b, Trace.class); } catch (JsonMappingException|JsonParseException t) { log.log(Level.SEVERE, "Failed to deserialize", t); } catch (IOException t) { log.log(Level.SEVERE, "Failed to deserialize", t); } } else { if (log.isLoggable(Level.FINEST)) { log.finest("Failed to get trace fragment: status=[" + connection.getResponseCode() + "]:" + connection.getResponseMessage()); } } } catch (IOException e) { log.log(Level.SEVERE, "Failed to send 'get' trace fragment request", e); } return null; }
Source:
<code>public void testByteBufferInputStreamNonZeroOffset2() throws Exception { <START> ByteBuffer byteBuffer = ByteBuffer.allocate(1000); <END> AvroKafkaSpoutTranslator.ByteBufferInputStream is = new AvroKafkaSpoutTranslator.ByteBufferInputStream(byteBuffer); byte[] dest = new byte[1000]; int res = is.read(dest, 600, 400); assertEquals(400, res); }</code><technical_language>A method extracted takes offset len, in tests above</technical_language>

Target:
public void testByteBufferInputStreamNonZeroOffset2() throws Exception { int res = read(1000, 1000, 600, 400); assertEquals(400, res); }
Source:
<code><START> protected void generateVisitMethodBody(BaseNodeMetaModel node, MethodDeclaration visitMethod, List<PropertyMetaModel> propertyMetaModels, CompilationUnit compilationUnit) { <END> BlockStmt body = visitMethod.getBody().get(); body.getStatements().clear(); if (propertyMetaModels.isEmpty()) { body.addStatement(parseStatement("return 0;")); } else { String bodyBuilder = "return"; String prefix = ""; for (PropertyMetaModel field : propertyMetaModels) { final String getter = field.getGetterMethodName() + "()"; if (field.getNodeReference().isPresent()) { if (field.isOptional()) { bodyBuilder += f("%s (n.%s.isPresent()? n.%s.get().accept(this, arg):0)", prefix, getter, getter); } else { bodyBuilder += f("%s (n.%s.accept(this, arg))", prefix, getter); } } else { Class<?> type = field.getType(); if (type.equals(boolean.class)) { bodyBuilder += f("%s (n.%s?1:0)", prefix, getter); } else if (type.equals(int.class)) { bodyBuilder += f("%s n.%s", prefix, getter); } else { bodyBuilder += f("%s (n.%s.hashCode())", prefix, getter); } } prefix = "* 31 +"; } Statement returnStatement = parseStatement(bodyBuilder + ";"); body.addStatement(returnStatement); } }</code><technical_language>This long method benefit extracting some functionality. if-else a candidate for extracting a new method speaking name :)</technical_language>

Target:
protected void generateVisitMethodBody(BaseNodeMetaModel node, MethodDeclaration visitMethod, List<PropertyMetaModel> propertyMetaModels, CompilationUnit compilationUnit) { BlockStmt body = visitMethod.getBody().get(); body.getStatements().clear(); SeparatedItemStringBuilder builder = new SeparatedItemStringBuilder("return ", "* 31 +", ";"); if (propertyMetaModels.isEmpty()) { builder.append("0"); } else { for (PropertyMetaModel field : propertyMetaModels) { final String getter = field.getGetterMethodName() + "()"; if (field.getNodeReference().isPresent()) { if (field.isOptional()) { builder.append("(n.%s.isPresent()? n.%s.get().accept(this, arg):0)", getter, getter); } else { builder.append("(n.%s.accept(this, arg))", getter); } } else { Class<?> type = field.getType(); if (type.equals(boolean.class)) { builder.append("(n.%s?1:0)", getter); } else if (type.equals(int.class)) { builder.append("n.%s", getter); } else { builder.append("(n.%s.hashCode())", getter); } } } } body.addStatement(parseStatement(builder.toString())); }
Source:
<code>public GraphicsConsoles list() { VM vm = getEntity(VM.class, VdcQueryType.GetVmByVmId, new IdQueryParameters(guid), guid.toString(), true); <START> return VmMapper.map(vm, new GraphicsConsoles()); <END> }</code><technical_language>This populate links, need call "addLinks" "populate" methods. "BackendStorageDomainImagesResource.mapCollection", for example</technical_language>

Target:
public GraphicsConsoles list() { VM vm = getEntity(VM.class, VdcQueryType.GetVmByVmId, new IdQueryParameters(guid), guid.toString(), true); GraphicsConsoles consoles = new GraphicsConsoles(); for (Map.Entry<GraphicsType, GraphicsInfo> graphicsInfo : vm.getGraphicsInfos().entrySet()) { consoles.getGraphicsConsoles().add(addLinks(populate(VmMapper.map(graphicsInfo, null), vm))); } return consoles; }
Source:
<code>private static void navigate(final Activity activity, final String destName, final String destCode, final Geopoint coords) { <START> Intent launchIntent = new Intent(INTENT_ACTION); <END> launchIntent.putExtra(Intents.EXTRA_NAME, destName); launchIntent.putExtra(Intents.EXTRA_GEOCODE, destCode); launchIntent.putExtra(Intents.EXTRA_LATITUDE, coords.getLatitude()); launchIntent.putExtra(Intents.EXTRA_LONGITUDE, coords.getLongitude()); activity.startService(launchIntent); }</code><technical_language>Missing final (was previous patch well)</technical_language>

Target:
private static void navigate(final Activity activity, final String destName, final String destCode, final Geopoint coords) { final Intent launchIntent = new Intent(INTENT_ACTION); launchIntent.putExtra(Intents.EXTRA_NAME, destName) .putExtra(Intents.EXTRA_GEOCODE, destCode) .putExtra(Intents.EXTRA_LATITUDE, coords.getLatitude()) .putExtra(Intents.EXTRA_LONGITUDE, coords.getLongitude()); activity.startService(launchIntent); }
Source:
<code>public void startScript(@PathVariable("name") String scriptName, @RequestParam Map<String, Object> parameters, HttpServletResponse response) throws IOException, URISyntaxException { ScriptJobExecution scriptJobExecution = scriptJobExecutionFactory.create(); scriptJobExecution.setName(scriptName); scriptJobExecution.setParameters(gson.toJson(parameters)); scriptJobExecution.setUser(userAccountService.getCurrentUser().getUsername()); dataService.add(scriptJobExecution.getEntityType().getId(), scriptJobExecution); executorService.submit(() -> jobExecutor.execute(scriptJobExecution)); String jobHref = concatEntityHref("/api/v2", scriptJobExecution.getEntityType().getId(), scriptJobExecution.getIdValue()); String jobControllerURL = menuReaderService.getMenu().findMenuItemPath(JobsController.ID); <START> response.sendRedirect(format("{0}/viewJob/?jobHref={1}&refreshTimeoutMillis=1000", jobControllerURL, jobHref)); <END> }</code><technical_language>some sort of utility shared string for creating this complicated url</technical_language>

Target:
public void startScript(@PathVariable("name") String scriptName, @RequestParam Map<String, Object> parameters, HttpServletResponse response) throws IOException { ScriptJobExecution scriptJobExecution = scriptJobExecutionFactory.create(); scriptJobExecution.setName(scriptName); scriptJobExecution.setParameters(gson.toJson(parameters)); scriptJobExecution.setUser(userAccountService.getCurrentUser().getUsername()); jobExecutor.submit(scriptJobExecution); response.sendRedirect(jobsController.createJobExecutionViewHref(scriptJobExecution, 1000)); }
Source:
<code>public void withClientRequests() throws Throwable { try (Cluster ignored = init(Cluster.create(3, config -> config.with(GOSSIP, NETWORK, NATIVE_PROTOCOL)))) { final com.datastax.driver.core.Cluster cluster = com.datastax.driver.core.Cluster.builder().addContactPoint("127.0.0.1").build(); Session session = cluster.connect(); session.execute("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v int, PRIMARY KEY (pk, ck));"); session.execute("INSERT INTO " + KEYSPACE + ".tbl (pk, ck, v) values (1,1,1);"); Statement select = new SimpleStatement("select * from " + KEYSPACE + ".tbl;").setConsistencyLevel(ConsistencyLevel.ALL); final ResultSet resultSet = session.execute(select); Iterator<Object[]> rows = RowUtil.toObjects(resultSet); <START> assertRows(rows, row(1, 1, 1)); <END> Assert.assertEquals(3, cluster.getMetadata().getAllHosts().size()); session.close(); cluster.close(); } }</code><technical_language>add assertRows receives a resultset</technical_language>

Target:
public void withClientRequests() throws Throwable { try (Cluster ignored = init(Cluster.create(3, config -> config.with(GOSSIP, NETWORK, NATIVE_PROTOCOL)))) { final com.datastax.driver.core.Cluster cluster = com.datastax.driver.core.Cluster.builder().addContactPoint("127.0.0.1").build(); Session session = cluster.connect(); session.execute("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v int, PRIMARY KEY (pk, ck));"); session.execute("INSERT INTO " + KEYSPACE + ".tbl (pk, ck, v) values (1,1,1);"); Statement select = new SimpleStatement("select * from " + KEYSPACE + ".tbl;").setConsistencyLevel(ConsistencyLevel.ALL); final ResultSet resultSet = session.execute(select); assertRows(resultSet, row(1, 1, 1)); Assert.assertEquals(3, cluster.getMetadata().getAllHosts().size()); session.close(); cluster.close(); } }
Source:
<code>public static void main(String[] args) { if (args.length != 0) { System.err.println("Usage: java -Dconfig=<secor_properties> " + "-Dlog4j.configuration=<log4j_properties> ConsumerMain"); return; } try { SecorConfig config = SecorConfig.load(); if (!config.getUploadOnShutdown()) { <START> Runtime.getRuntime().addShutdownHook(new Thread(new StagingCleaner(config.getLocalPath()))); <END> } OstrichAdminService ostrichService = new OstrichAdminService(config.getOstrichPort()); ostrichService.start(); FileUtil.configure(config); LogFileDeleter logFileDeleter = new LogFileDeleter(config); logFileDeleter.deleteOldLogs(); RateLimitUtil.configure(config); LOG.info("starting consumer threads", config.getConsumerThreads()); LinkedList<Consumer> consumers = new LinkedList<Consumer>(); for (int i = 0; i < config.getConsumerThreads(); ++i) { Consumer consumer = new Consumer(config); consumers.add(consumer); consumer.start(); } for (Consumer consumer : consumers) { consumer.join(); } } catch (Throwable t) { LOG.error("Consumer failed", t); System.exit(1); } }</code><technical_language>Please this path instead (Take a Upload.java): config.getLocalPath() is a shared folder other processes/threads running host. String localPrefix = mConfig.getLocalPath() + '/' + IdUtil.getLocalMessageDir();</technical_language>

Target:
public static void main(String[] args) { if (args.length != 0) { System.err.println("Usage: java -Dconfig=<secor_properties> " + "-Dlog4j.configuration=<log4j_properties> ConsumerMain"); return; } try { SecorConfig config = SecorConfig.load(); String stagingDirectoryPath = config.getLocalPath() + '/' + IdUtil.getLocalMessageDir(); ShutdownHookRegistry.registerHook(10, new StagingDirectoryCleaner(stagingDirectoryPath)); OstrichAdminService ostrichService = new OstrichAdminService(config.getOstrichPort()); ostrichService.start(); FileUtil.configure(config); LogFileDeleter logFileDeleter = new LogFileDeleter(config); logFileDeleter.deleteOldLogs(); RateLimitUtil.configure(config); LOG.info("starting consumer threads", config.getConsumerThreads()); LinkedList<Consumer> consumers = new LinkedList<Consumer>(); for (int i = 0; i < config.getConsumerThreads(); ++i) { Consumer consumer = new Consumer(config); consumers.add(consumer); consumer.start(); } for (Consumer consumer : consumers) { consumer.join(); } } catch (Throwable t) { LOG.error("Consumer failed", t); System.exit(1); } }
Source:
<code>public Migration update(Long id, MigrationDefinition definition) throws MigrationNotFoundException, ReScheduleException, InvalidMigrationException { validateDefinition(definition); Migration migration = get(id); if (migration == null) { <START> return null; <END> } if (!ExecutionStatus.SCHEDULED.equals(migration.getStatus())) { throw new ReScheduleException("The migration is not scheduled and cannot be re-scheduled"); } if (ExecutionType.SYNC.equals(definition.getExecution().getType())) { throw new ReScheduleException("The migration execution type MUST be ASYNC"); } migration.setDefinition(definition); em.persist(migration); schedulerService.reScheduleMigration(migration); return migration; }</code><technical_language>This throw MigrationNotFoundException need check for null</technical_language>

Target:
public Migration update(Long id, MigrationDefinition definition) throws MigrationNotFoundException, ReScheduleException, InvalidMigrationException { validateDefinition(definition); Migration migration = get(id); if (!ExecutionStatus.SCHEDULED.equals(migration.getStatus())) { throw new ReScheduleException("The migration is not scheduled and cannot be re-scheduled"); } if (ExecutionType.SYNC.equals(definition.getExecution().getType())) { throw new ReScheduleException("The migration execution type MUST be ASYNC"); } migration.setDefinition(definition); txHelper.withTransaction(() -> em.persist(migration)); schedulerService.reScheduleMigration(migration); return migration; }
Source:
<code>private void tracker$enterPhaseOnDeath(final LivingEntity livingEntity) { <START> if (!this.world.isRemote) { <END> try (final CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame(); final PhaseContext<?> context = EntityPhase.State.DEATH_UPDATE.createPhaseContext(PhaseTracker.SERVER).source(livingEntity)) { context.buildAndSwitch(); frame.pushCause(this); this.shadow$onDeathUpdate(); } } else { this.shadow$onDeathUpdate(); } }</code><technical_language>check if world is remote, a check: !((WorldBridge) this.world).bridge$isFake()</technical_language>

Target:
private void tracker$enterPhaseOnDeath(final LivingEntity livingEntity) { if (!((WorldBridge) this.world).bridge$isFake()) { try (final CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame(); final PhaseContext<?> context = EntityPhase.State.DEATH_UPDATE.createPhaseContext(PhaseTracker.SERVER).source(livingEntity)) { context.buildAndSwitch(); frame.pushCause(this); this.shadow$onDeathUpdate(); } } else { this.shadow$onDeathUpdate(); } }
Source:
<code>public void setRemotePlayersHeldItemMountPointTranslations(@CommandParam("x") float x, @CommandParam("y") float y, @CommandParam("z") float z) { for (EntityRef remotePlayer : entityManager.getEntitiesWith(RemotePersonHeldItemMountPointComponent.class)) { RemotePersonHeldItemMountPointComponent remoteMountPointComponent = remotePlayer.getComponent(RemotePersonHeldItemMountPointComponent.class); <START> if (remoteMountPointComponent != null) { <END> remoteMountPointComponent.translate.set(x, y, z); } } }</code><technical_language>minor is *technically* need this check. entityManager.getEntitiesWith ensures component need check if is null</technical_language>

Target:
public void setRemotePlayersHeldItemMountPointTranslations(@CommandParam("x") float x, @CommandParam("y") float y, @CommandParam("z") float z) { for (EntityRef remotePlayer : entityManager.getEntitiesWith(RemotePersonHeldItemMountPointComponent.class)) { RemotePersonHeldItemMountPointComponent remoteMountPointComponent = remotePlayer.getComponent(RemotePersonHeldItemMountPointComponent.class); remoteMountPointComponent.translate.set(x, y, z); } }
Source:
<code>private void finalizeConsumer() { RabbitUtils.setPhysicalCloseRequired(true); RabbitUtils.closeChannel(getChannel()); if (!(getChannel() instanceof ChannelProxy)) { <START> RabbitUtils.isPhysicalCloseRequired(); <END> } RabbitUtils.closeConnection(this.connection); DirectMessageListenerContainer.this.cancellationLock.release(this); consumerRemoved(this); }</code><technical_language>here: do call setPhysicalCloseRequired() instead if ChannelProxy</technical_language>

Target:
private void finalizeConsumer() { RabbitUtils.setPhysicalCloseRequired(getChannel(), true); RabbitUtils.closeChannel(getChannel()); RabbitUtils.closeConnection(this.connection); DirectMessageListenerContainer.this.cancellationLock.release(this); consumerRemoved(this); }
Source:
<code>public void edit(final ImportExportRepoImageBaseModel model) { driver.edit(model); importAsTemplateEditor.setVisible(model.isImportModel()); clusterEditor.setVisible(model.isImportModel()); <START> templateNameEditor.setVisible(model.isImportModel()); <END> model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if ("ImportExportEntities".equals(args.propertyName) && model.getEntities() != null) { imageList.setRowData(model.getEntities()); } } }); initTable(model); }</code><technical_language>this is needed? binding model care of visibility 'isAvailable' changes iirc</technical_language>

Target:
public void edit(final ImportExportRepoImageBaseModel model) { driver.edit(model); importAsTemplateEditor.setVisible(model.isImportModel()); clusterEditor.setVisible(model.isImportModel()); model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if ("ImportExportEntities".equals(args.propertyName) && model.getEntities() != null) { imageList.setRowData(model.getEntities()); } } }); initTable(model); }
Source:
<code>public void testDescribeTable() { MaterializedResult actualColumns = this.computeActual("DESC orders").toTestTypes(); MaterializedResult.Builder builder = MaterializedResult.resultBuilder(this.getQueryRunner().getDefaultSession(), VarcharType.VARCHAR, VarcharType.VARCHAR, VarcharType.VARCHAR, VarcharType.VARCHAR); for (MaterializedRow row : actualColumns.getMaterializedRows()) { builder.row(row.getField(0), row.getField(1), "", ""); } MaterializedResult filteredActual = builder.build(); <START> builder = MaterializedResult.resultBuilder(this.getQueryRunner().getDefaultSession(), VarcharType.VARCHAR, VarcharType.VARCHAR, VarcharType.VARCHAR, VarcharType.VARCHAR); <END> MaterializedResult expectedColumns = builder .row("orderkey", "bigint", "", "") .row("custkey", "bigint", "", "") .row("orderstatus", "varchar", "", "") .row("totalprice", "double", "", "") .row("orderdate", "varchar", "", "") .row("orderpriority", "varchar", "", "") .row("clerk", "varchar", "", "") .row("shippriority", "bigint", "", "") .row("comment", "varchar", "", "").build(); assertEquals(filteredActual, expectedColumns, String.format("%s != %s", filteredActual, expectedColumns)); }</code><technical_language>static import VARCHAR resultBuilder</technical_language>

Target:
public void testDescribeTable() { MaterializedResult actualColumns = this.computeActual("DESC orders").toTestTypes(); MaterializedResult.Builder builder = resultBuilder(this.getQueryRunner().getDefaultSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR); for (MaterializedRow row : actualColumns.getMaterializedRows()) { builder.row(row.getField(0), row.getField(1), "", ""); } MaterializedResult filteredActual = builder.build(); builder = resultBuilder(this.getQueryRunner().getDefaultSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR); MaterializedResult expectedColumns = builder .row("orderkey", "bigint", "", "") .row("custkey", "bigint", "", "") .row("orderstatus", "varchar", "", "") .row("totalprice", "double", "", "") .row("orderdate", "varchar", "", "") .row("orderpriority", "varchar", "", "") .row("clerk", "varchar", "", "") .row("shippriority", "bigint", "", "") .row("comment", "varchar", "", "").build(); assertEquals(filteredActual, expectedColumns, String.format("%s != %s", filteredActual, expectedColumns)); }
Source:
<code>public static boolean getDeviceListWithoutStatusSupported(Version version) { <START> return supportedInConfig(ConfigValues.NetworkExclusivenessPermissiveValidation, version); <END> }</code><technical_language>Copy-paste bug - "getDeviceListWithoutStatusSupported"</technical_language>

Target:
public static boolean getDeviceListWithoutStatusSupported(Version version) { return supportedInConfig(ConfigValues.getDeviceListWithoutStatusSupported, version); }
Source:
<code><START> public void testNotExistsColumn() throws Exception { <END> String inputFile = createParquetFile(); String outputFile = getParquetFileName(); String cargs[] = {inputFile, outputFile, "no_exist"}; executeCommandLine(cargs); }</code><technical_language>check scenario. User wants prune columns a, b c parquet files. schema of files evolved (e.g. column c is added some files created column a is for partitioning files do it). If previous scenario is valid tool throw exception in case a column pruned is in file. Meanwhile, user mistyped column name notify. So, is choice handle this case. :)</technical_language>

Target:
public void testNotExistsColumn() throws Exception { String inputFile = createParquetFile("input"); String outputFile = createTempFile("output"); String cargs[] = {inputFile, outputFile, "no_exist"}; executeCommandLine(cargs); }
Source:
<code>public MessageBatch createBatch(Subscription subscription) { try { ByteBuffer buffer = bufferPool.allocate(subscription.getBatchSubscriptionPolicy().getBatchVolume()); switch (subscription.getContentType()) { case JSON: return new JsonMessageBatch(randomUUID().toString(), buffer, subscription, clock); <START> case AVRO: <END> default: throw new UnsupportedOperationException(format("Batching is not supported yet for contentType=%s", subscription.getContentType())); } } catch (InterruptedException e) { throw new InternalProcessingException(e); } }</code><technical_language>do idea support AVRO in future</technical_language>

Target:
public MessageBatch createBatch(Subscription subscription) { try { ByteBuffer buffer = bufferPool.allocate(subscription.getBatchSubscriptionPolicy().getBatchVolume()); switch (subscription.getContentType()) { case JSON: return new JsonMessageBatch(randomUUID().toString(), buffer, subscription, clock); case AVRO: default: throw new UnsupportedOperationException("Batching is not supported yet for contentType " + subscription.getContentType()); } } catch (InterruptedException e) { throw new InternalProcessingException(e); } }
Source:
<code><START> private String getAbbreviation(String name, String token) { <END> StringBuilder abbrev = new StringBuilder(); for (String t : name.split(token)) { abbrev.append(t.substring(0, 1).toUpperCase()); } return abbrev.toString(); }</code><technical_language>token " ", depends ldap.accountFullName</technical_language>

Target:
private static String getAbbreviation(String name, String token) { StringBuilder abbrev = new StringBuilder(); if (name != null) { for (String t : name.split(token)) { abbrev.append(t.substring(0, 1).toUpperCase()); } } return abbrev.toString(); }
Source:
<code>public static Object sendImportRequisitionEvent(EventForwarder eventForwarder, String type, List<String> parameters, String rescanExisting) { EventBuilder eventBuilder = new EventBuilder(EventConstants.RELOAD_IMPORT_UEI, EVENT_SOURCE); if((!Strings.isNullOrEmpty(type)) && !parameters.isEmpty()) { <START> String url = String.format("requisition://%s?%s", type, String.join("&", parameters)); <END> eventBuilder.addParam(EventConstants.PARM_URL, url); if (!Strings.isNullOrEmpty(rescanExisting)) { List<String> validValues = Arrays.asList("yes", "dbonly", "no"); if(validValues.contains(rescanExisting)) { eventBuilder.addParam(EventConstants.PARM_IMPORT_RESCAN_EXISTING, rescanExisting); } else { System.out.printf("Not a valid rescanExisting value, valid values are : 'yes', 'no', 'dbonly'\n"); return null; } } eventForwarder.sendNow(eventBuilder.getEvent()); System.out.printf("Requisition import triggered asynchronously for URL : %s\n", url); } else { System.out.printf("No valid requisition parameters specified\n"); } return null; }</code><technical_language>a URL builder handle URL encoding instead of joining strings</technical_language>

Target:
public static Object sendImportRequisitionEvent(EventForwarder eventForwarder, String type, List<String> parameters, String rescanExisting) throws URISyntaxException { EventBuilder eventBuilder = new EventBuilder(EventConstants.RELOAD_IMPORT_UEI, EVENT_SOURCE); if((!Strings.isNullOrEmpty(type)) && !parameters.isEmpty()) { URIBuilder builder = new URIBuilder().setScheme(URI_SCHEME).setHost(type); parse(parameters, builder); String url = builder.build().toString(); eventBuilder.addParam(EventConstants.PARM_URL, url); if (!Strings.isNullOrEmpty(rescanExisting)) { List<String> validValues = Arrays.asList("yes", "dbonly", "no"); if(validValues.contains(rescanExisting)) { eventBuilder.addParam(EventConstants.PARM_IMPORT_RESCAN_EXISTING, rescanExisting); } else { System.out.printf("Not a valid rescanExisting value, valid values are : %s \n", validValues); return null; } } eventForwarder.sendNow(eventBuilder.getEvent()); System.out.printf("Requisition import triggered asynchronously for URL : %s\n", url); } else { System.out.printf("No valid requisition parameters specified\n"); } return null; }
Source:
<code>public HColumnDescriptor adapt(String familyName, ColumnFamily columnFamily) { HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(familyName); String gcExpression = columnFamily.getGcExpression(); <START> if (gcExpression != null) { <END> } return hColumnDescriptor; }</code><technical_language>Re-introduce method above</technical_language>

Target:
public HColumnDescriptor adapt(String familyName, ColumnFamily columnFamily) { HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(familyName); String gcExpression = columnFamily.getGcExpression(); if (gcExpression != null) { convertGarbageCollectionExpression(gcExpression, hColumnDescriptor); } return hColumnDescriptor; }
Source:
<code>public Object loadObject(EntityProjection projection, Serializable id, RequestScope scope) { if (projection.getFilterExpression() == null || tx.supportsFiltering(projection.getType(), projection.getFilterExpression()) == FeatureSupport.FULL) { return tx.loadObject(projection, id, scope); } else { <START> return super.loadObject(projection, id, scope); <END> } }</code><technical_language>I this is wrong. This calling default method defined in interface. changed this call super class - is else - problems</technical_language>

Target:
public Object loadObject(EntityProjection projection, Serializable id, RequestScope scope) { if (projection.getFilterExpression() == null || tx.supportsFiltering(projection.getType(), projection.getFilterExpression()) == FeatureSupport.FULL) { return tx.loadObject(projection, id, scope); } else { return DataStoreTransaction.super.loadObject(projection, id, scope); } }
Source:
<code>private String[] toStringArray(Object content){ String[] valueArray = null; if(content instanceof List){ valueArray = from((List<String>)content).toArray(String.class); }else{ valueArray = new String[]{(String)content}; } <START> return valueArray; <END> }</code><technical_language>Try else. java if (content instanceof List) { return from((List<String>)content).toArray(String.class) } return new String[]{(String)content} BTW valueArray is a good name values is better</technical_language>

Target:
private String[] toStringArray(Object content){ if(content instanceof List){ return from((List<String>)content).toArray(String.class); } return new String[]{(String)content}; }
Source:
<code>private static P2ResolutionResult singleEnv(Map<TargetEnvironment, P2ResolutionResult> map) { assertEquals(1, map.size()); <START> for (P2ResolutionResult result : map.values()) { <END> return result; } throw new AssertionError("should never happen"); }</code><technical_language>map.entrySet().iterator().next() a bit more idiomatic a loop unconditional return</technical_language>

Target:
private static P2ResolutionResult singleEnv(Map<TargetEnvironment, P2ResolutionResult> map) { assertEquals(1, map.size()); return map.values().iterator().next(); }
Source:
<code>public List<Idea> findIdeasByTagId(final long tagId) { boolean isAnonymous = SecurityContextHolder.getContext().getAuthentication() instanceof AnonymousAuthenticationToken; final List<Idea> ideas = ideaRepository.findByTagId(tagId); ideas.forEach(idea -> { Hibernate.initialize(idea.getRelatedTags()); if (isAnonymous) { idea.setLiked(isCurrentUserLikedIdea(idea.getId())); } }); return ideas; <START> } <END></code><technical_language>be, sense move logic "boolean isAnonymous = Securi... if (isAnonymous) ...idea.setLiked(..." separate method</technical_language>

Target:
public List<Idea> findIdeasByTagId(final long tagId) { final List<Idea> ideas = ideaRepository.findByTagId(tagId); ideas.forEach(idea -> { Hibernate.initialize(idea.getRelatedTags()); idea.setLiked(isCurrentUserLikedIdea(idea.getId())); }); return ideas; }
Source:
<code>private StudentProfileAttributes extractProfileData() { StudentProfileAttributes editedProfile = StudentProfileAttributes.builder().build(); editedProfile.googleId = account.googleId; editedProfile.shortName = getRequestParamValue(Const.ParamsNames.STUDENT_SHORT_NAME); editedProfile.email = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_EMAIL); editedProfile.institute = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_INSTITUTION); editedProfile.nationality = getRequestParamValue(Const.ParamsNames.STUDENT_NATIONALITY); if ("".equals(editedProfile.nationality)) { editedProfile.nationality = getRequestParamValue("existingNationality"); } try { <START> editedProfile.gender = GenderType.valueOf(getRequestParamValue(Const.ParamsNames.STUDENT_GENDER)); <END> } catch (IllegalArgumentException iae) { setStatusForException(iae); } editedProfile.moreInfo = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_MOREINFO); editedProfile.pictureKey = ""; preprocessParameters(editedProfile); validatePostParameters(editedProfile); return editedProfile; }</code><technical_language>IllegalArgumentException is unchecked exception remove try catch block. good idea in previous review</technical_language>

Target:
private StudentProfileAttributes extractProfileData() { StudentProfileAttributes editedProfile = StudentProfileAttributes.builder().build(); editedProfile.googleId = account.googleId; editedProfile.shortName = getRequestParamValue(Const.ParamsNames.STUDENT_SHORT_NAME); editedProfile.email = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_EMAIL); editedProfile.institute = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_INSTITUTION); editedProfile.nationality = getRequestParamValue(Const.ParamsNames.STUDENT_NATIONALITY); if ("".equals(editedProfile.nationality)) { editedProfile.nationality = getRequestParamValue("existingNationality"); } editedProfile.gender = GenderType.valueOf(getRequestParamValue(Const.ParamsNames.STUDENT_GENDER)); editedProfile.moreInfo = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_MOREINFO); editedProfile.pictureKey = ""; preprocessParameters(editedProfile); validatePostParameters(editedProfile); return editedProfile; }
Source:
<code>public void launch() { List<String> commands = Lists.newLinkedList(); if (isPackageInstall()) { commands.add(addSbinPathCommand()); <START> commands.add(sudo(format("ulimit -n %s", getNumberOfOpenFiles()))); <END> commands.add(sudo("service riak start")); } else { commands.add("ulimit -n 65536 || true"); commands.add(format("%s start >/dev/null 2>&1 < /dev/null &", getRiakCmd())); } ScriptHelper launchScript = newScript(LAUNCHING) .body.append(commands); if (!isRiakOnPath()) { addRiakOnPath(launchScript); } launchScript.failOnNonZeroResultCode().execute(); String mainUri = String.format("http://%s:%s/admin", entity.getAttribute(Attributes.HOSTNAME), entity.getAttribute(RiakNode.RIAK_WEB_PORT)); entity.setAttribute(Attributes.MAIN_URI, URI.create(mainUri)); }</code><technical_language>This increase soft limit, hard limit? Distributions a hard limit < 65536 this fail</technical_language>

Target:
public void launch() { List<String> commands = Lists.newLinkedList(); if (isPackageInstall()) { commands.add(addSbinPathCommand()); commands.add(sudo(format("sh -c \"ulimit -n %s && service riak start\"", maxOpenFiles()))); } else { commands.add("ulimit -n 65536 || true"); commands.add(format("%s start >/dev/null 2>&1 < /dev/null &", getRiakCmd())); } ScriptHelper launchScript = newScript(LAUNCHING) .body.append(commands); if (!isRiakOnPath()) { addRiakOnPath(launchScript); } launchScript.failOnNonZeroResultCode().execute(); String mainUri = String.format("http://%s:%s/admin", entity.getAttribute(Attributes.HOSTNAME), entity.getAttribute(RiakNode.RIAK_WEB_PORT)); entity.setAttribute(Attributes.MAIN_URI, URI.create(mainUri)); }
Source:
<code>private void parseParticleEmitterSlots(JsonValue containerNode, HullConfig.Data configData) { Vector2 builderOrigin = new Vector2(configData.shipBuilderOrigin); for (JsonValue particleEmitterSlotNode : containerNode) { Vector2 position = readVector2(particleEmitterSlotNode, "position", null); <START> position.sub(builderOrigin) <END> .scl(configData.size); String particleName = particleEmitterSlotNode.getString("particleName", null); String trigger = particleEmitterSlotNode.getString("trigger", null); configData.particleEmitters.add(new ParticleEmitter(position, particleName, trigger)); } }</code><technical_language>Move scl line. long enough warrant a break</technical_language>

Target:
private void parseParticleEmitterSlots(JsonValue containerNode, HullConfig.Data configData) { Vector2 builderOrigin = new Vector2(configData.shipBuilderOrigin); for (JsonValue particleEmitterSlotNode : containerNode) { Vector2 position = readVector2(particleEmitterSlotNode, "position", null); position.sub(builderOrigin).scl(configData.size); String trigger = particleEmitterSlotNode.getString("trigger", null); float angleOffset = particleEmitterSlotNode.getFloat("angleOffset", 0f); boolean hasLight = particleEmitterSlotNode.getBoolean("hasLight", false); JsonValue particleNode = particleEmitterSlotNode.get("particle"); EffectConfig effectConfig = EffectConfig.load(particleNode, new EffectTypes(), new GameColors()); configData.particleEmitters.add(new DSParticleEmitter(position, trigger, angleOffset, hasLight, effectConfig)); } }
Source:
<code>public boolean removeIncomingChatMarkerMessageListener(ChatMarkersListener listener) { <START> synchronized (incomingListeners) { <END> return incomingListeners.remove(listener); } }</code><technical_language>synchronized removed</technical_language>

Target:
public boolean removeIncomingChatMarkerMessageListener(ChatMarkersListener listener) { return incomingListeners.remove(listener); }
Source:
<code><START> public FastForwardReporter(FastForward fastForward, MetricRegistry metricRegistry, <END> ScheduledExecutorService executor, String key, long interval, TimeUnit intervalTimeUnit) { this.fastForward = fastForward; this.metricRegistry = metricRegistry; this.executor = executor; this.key = key; this.interval = interval; this.intervalTimeUnit = intervalTimeUnit; }</code><technical_language>compiles for me. calls this constructor is test. MasterService AgentService public static ctor above</technical_language>

Target:
FastForwardReporter(FastForward fastForward, MetricRegistry metricRegistry, ScheduledExecutorService executor, String key, long interval, TimeUnit intervalTimeUnit) { this.fastForward = fastForward; this.metricRegistry = metricRegistry; this.executor = executor; this.key = key; this.interval = interval; this.intervalTimeUnit = intervalTimeUnit; }
Source:
<code>private static void moveClippedBasesToTag(final SAMRecord rec, final int clipFrom) { final byte[] bases = rec.getReadBases(); final byte[] baseQualities = rec.getBaseQualities(); final int readLength = rec.getReadLength(); <START> if(rec.getReadNegativeStrandFlag()) { <END> rec.setAttribute(HARD_CLIPPED_BASES_TAG, StringUtil.bytesToString(Arrays.copyOf(bases, bases.length - clipFrom + 1))); rec.setAttribute(HARD_CLIPPED_BASE_QUALITIES_TAG, SAMUtils.phredToFastq(Arrays.copyOf(baseQualities, baseQualities.length - clipFrom + 1))); } else { rec.setAttribute(HARD_CLIPPED_BASES_TAG, StringUtil.bytesToString(Arrays.copyOfRange(bases, clipFrom - 1, readLength))); rec.setAttribute(HARD_CLIPPED_BASE_QUALITIES_TAG, SAMUtils.phredToFastq(Arrays.copyOfRange(baseQualities,clipFrom - 1, readLength))); } }</code><technical_language>I bases stored in original read order, in order revert, need stick ends of reverted records</technical_language>

Target:
private static void moveClippedBasesToTag(final SAMRecord rec, final int clipFrom) { if (rec.getAttribute(HARD_CLIPPED_BASES_TAG) != null || rec.getAttribute(HARD_CLIPPED_BASE_QUALITIES_TAG) != null) { throw new PicardException("Record " + rec.getReadName() + " already contains tags for restoring hard-clipped bases. This operation will permanently erase information if it proceeds."); } final byte[] bases = rec.getReadBases(); final byte[] baseQualities = rec.getBaseQualities(); final int readLength = rec.getReadLength(); final int clipPositionFrom, clipPositionTo; if (rec.getReadNegativeStrandFlag()) { clipPositionFrom = 0; clipPositionTo = readLength - clipFrom + 1; } else { clipPositionFrom = clipFrom - 1; clipPositionTo = readLength; } String basesToKeepInTag = StringUtil.bytesToString(Arrays.copyOfRange(bases, clipPositionFrom, clipPositionTo)); String qualitiesToKeepInTag = SAMUtils.phredToFastq(Arrays.copyOfRange(baseQualities, clipPositionFrom, clipPositionTo)); if (rec.getReadNegativeStrandFlag()) { basesToKeepInTag = SequenceUtil.reverseComplement(basesToKeepInTag); qualitiesToKeepInTag = new StringBuilder(qualitiesToKeepInTag).reverse().toString(); } rec.setAttribute(HARD_CLIPPED_BASES_TAG, basesToKeepInTag); rec.setAttribute(HARD_CLIPPED_BASE_QUALITIES_TAG, qualitiesToKeepInTag); }
Source:
<code>protected void initializeInternal() throws Exception { if (kubeClient == null) { <START> kubeClient = KubeClientFactory.fromConfiguration(flinkConfig, getIoExecutor()); <END> } podsWatch = kubeClient.watchPodsAndDoCallback( KubernetesUtils.getTaskManagerLabels(clusterId), new PodCallbackHandlerImpl()); recoverWorkerNodesFromPreviousAttempts(); }</code><technical_language>Currently this line of code covered unit tests, due usage of a constructor</technical_language>

Target:
protected void initializeInternal() throws Exception { kubeClientOpt = Optional.of(kubeClientFactory.fromConfiguration(flinkConfig, getIoExecutor())); podsWatchOpt = Optional.of( getKubeClient().watchPodsAndDoCallback( KubernetesUtils.getTaskManagerLabels(clusterId), new PodCallbackHandlerImpl())); recoverWorkerNodesFromPreviousAttempts(); }
Source:
<code>public static DateDatum createDate(Datum datum) { switch (datum.type()) { case INT4: return new DateDatum(datum.asInt4()); case INT8: return new DateDatum(datum.asInt4()); case TEXT: return createDate(datum.asChars()); case DATE: return (DateDatum) datum; default: <START> throw new TajoRuntimeException(Errors.ResultCode.INVALID_CAST, datum.type().toString(), Type.DATE.name()); <END> } }</code><technical_language>new TajoRuntimeException(new InvalidCastException(...)</technical_language>

Target:
public static DateDatum createDate(Datum datum) { switch (datum.type()) { case INT4: return new DateDatum(datum.asInt4()); case INT8: return new DateDatum(datum.asInt4()); case TEXT: return createDate(datum.asChars()); case DATE: return (DateDatum) datum; default: throw new TajoRuntimeException(new InvalidCastException(datum.type(), Type.DATE)); } }