auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public BlockShapeData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { BlockShapeData shape = new BlockShapeData(); JsonObject shapeObj = json.getAsJsonObject(); if (shapeObj.has(DISPLAY_NAME)) { shape.setDisplayName(shapeObj.getAsJsonPrimitive(DISPLAY_NAME).getAsString()); } for (BlockPart part : BlockPart.values()) { if (shapeObj.has(part.toString().toLowerCase(Locale.ENGLISH))) { JsonObject meshObj = shapeObj.getAsJsonObject(part.toString().toLowerCase(Locale.ENGLISH)); shape.setMeshPart(part, (BlockMeshPart) context.deserialize(meshObj, BlockMeshPart.class)); if (part.isSide() && meshObj.has(FULL_SIDE)) { shape.setBlockingSide(part.getSide(), meshObj.get(FULL_SIDE).getAsBoolean()); } } } if (shapeObj.has(COLLISION) && shapeObj.get(COLLISION).isJsonObject()) { JsonObject collisionInfo = shapeObj.get(COLLISION).getAsJsonObject(); processCollision(context, shape, collisionInfo); } else { shape.setCollisionShape(PhysicsEngineManager.COLLISION_SHAPE_FACTORY.unitCube()); shape.setCollisionSymmetric(true); } return shape; }

Target:
public BlockShapeData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { BlockShapeData shape = new BlockShapeData(); JsonObject shapeObj = json.getAsJsonObject(); if (shapeObj.has(DISPLAY_NAME)) { shape.setDisplayName(shapeObj.getAsJsonPrimitive(DISPLAY_NAME).getAsString()); } for (BlockPart part : BlockPart.values()) { if (shapeObj.has(part.toString().toLowerCase(Locale.ENGLISH))) { JsonObject meshObj = shapeObj.getAsJsonObject(part.toString().toLowerCase(Locale.ENGLISH)); shape.setMeshPart(part, (BlockMeshPart) context.deserialize(meshObj, BlockMeshPart.class)); if (part.isSide() && meshObj.has(FULL_SIDE)) { shape.setBlockingSide(part.getSide(), meshObj.get(FULL_SIDE).getAsBoolean()); } } } if (shapeObj.has(COLLISION) && shapeObj.get(COLLISION).isJsonObject()) { JsonObject collisionInfo = shapeObj.get(COLLISION).getAsJsonObject(); processCollision(context, shape, collisionInfo); } else { shape.setCollisionShape(COLLISION_SHAPE_FACTORY.getNewUnitCube()); shape.setCollisionSymmetric(true); } return shape; }
Source:
public void postHandle( ServletRequest request, ServletResponse response ) throws Exception { if ( request.getAttribute( ANONYMOUS_LOGIN ) != null ) { try { getSubject( request, response ).logout(); } catch ( SessionException e ) { getLogger().trace( "Failed to find session for anonymous user.", e ); } if ( HttpServletRequest.class.isAssignableFrom( request.getClass() ) ) { HttpSession session = ( (HttpServletRequest) request ).getSession( false ); if ( session != null ) { session.invalidate(); } } } if ( request.getAttribute( NexusJSecurityFilter.REQUEST_IS_AUTHZ_REJECTED ) != null ) { if ( request.getAttribute( ANONYMOUS_LOGIN ) != null ) { sendChallenge( request, response ); } else { if ( getLogger().isDebugEnabled() ) { final Subject subject = getSubject( request, response ); String username; if ( subject != null && subject.isAuthenticated() ) { username = subject.getPrincipal().toString(); } else { username = getNexusConfiguration().getAnonymousUsername(); } getLogger().debug( "Request processing is rejected because user \"" + username + "\" lacks permissions." ); } sendForbidden( request, response ); } } }

Target:
public void postHandle( ServletRequest request, ServletResponse response ) throws Exception { if ( request.getAttribute( ANONYMOUS_LOGIN ) != null ) { try { getSubject( request, response ).logout(); } catch ( SessionException e ) { getLogger().trace( "Failed to find session for anonymous user.", e ); } if ( HttpServletRequest.class.isAssignableFrom( request.getClass() ) ) { HttpSession session = ( (HttpServletRequest) request ).getSession( false ); if ( session != null ) { session.invalidate(); } } } if ( request.getAttribute( NexusJSecurityFilter.REQUEST_IS_AUTHZ_REJECTED ) != null ) { if ( request.getAttribute( ANONYMOUS_LOGIN ) != null ) { sendChallenge( request, response ); } else { if ( getLogger().isDebugEnabled() ) { final Subject subject = getSubject( request, response ); String username; if ( subject != null && subject.isAuthenticated() && subject.getPrincipal() != null ) { username = subject.getPrincipal().toString(); } else { username = getNexusConfiguration().getAnonymousUsername(); } getLogger().debug( "Request processing is rejected because user \"" + username + "\" lacks permissions." ); } sendForbidden( request, response ); } } }
Source:
private JSONObject getEntitiesStatus(List<String> entities, EntityType type) throws JSONException, FalconException { JSONObject entityObject = new JSONObject(); for (String entity : entities) { try { EntityUtil.getEntity(type, entity); } catch (EntityNotRegisteredException e) { entityObject.put(entity, ENTITY_NOT_EXISTS_STATUS); } entityObject.put(entity, ENTITY_EXISTS_STATUS); } return entityObject; }

Target:
private JSONObject getEntitiesStatus(List<String> entities, EntityType type) throws JSONException, FalconException { JSONObject entityObject = new JSONObject(); for (String entity : entities) { try { entityObject.put(NAME, entity); EntityUtil.getEntity(type, entity); entityObject.put(STATUS, ENTITY_EXISTS_STATUS); } catch (EntityNotRegisteredException e) { entityObject.put(STATUS, ENTITY_NOT_EXISTS_STATUS); } } return entityObject; }
Source:
private void installScript(ScriptDTO script) { final StringBuilder executeBuilder = new StringBuilder(); executeBuilder.append(String.format("TYPE_ID=\"%s\";\n", script.getTypeId())); executeBuilder.append(String.format("CATEGORY_ID=\"%s\";\n", script.getCategoryId())); executeBuilder.append(String.format("APPLICATION_ID=\"%s\";\n", script.getApplicationId())); executeBuilder.append(String.format("SCRIPT_ID=\"%s\";\n", script.getId())); executeBuilder.append(script.getScript()); executeBuilder.append("\n"); executeBuilder.append("new Installer().run();"); getControl().getScriptInterpreter().runScript(executeBuilder.toString(), e -> Platform.runLater(() -> { if (!(e.getCause() instanceof InterruptedException)) { new ErrorMessage(tr("The script ended unexpectedly"), e); } })); }

Target:
private void installScript(ScriptDTO script) { final StringBuilder executeBuilder = new StringBuilder(); executeBuilder.append(String.format("TYPE_ID=\"%s\";\n", script.getTypeId())); executeBuilder.append(String.format("CATEGORY_ID=\"%s\";\n", script.getCategoryId())); executeBuilder.append(String.format("APPLICATION_ID=\"%s\";\n", script.getApplicationId())); executeBuilder.append(String.format("SCRIPT_ID=\"%s\";\n", script.getId())); executeBuilder.append(script.getScript()); executeBuilder.append("\n"); executeBuilder.append("new Installer().run();"); getControl().getScriptInterpreter().runScript(executeBuilder.toString(), e -> Platform.runLater(() -> { if (!(e.getCause() instanceof InterruptedException)) { final ErrorDialog errorDialog = ErrorDialog.builder() .withMessage(tr("The script ended unexpectedly")) .withException(e) .build(); errorDialog.showAndWait(); } })); }
Source:
public void addToMetricsFile(final MetricsFile<WgsMetrics, Integer> file, final boolean includeBQHistogram, final CountingFilter dupeFilter, final CountingFilter mapqFilter, final CountingPairedFilter pairFilter) { final WgsMetrics metrics = getMetrics(dupeFilter, mapqFilter, pairFilter); file.addMetric(metrics); file.addHistogram(getHighQualityDepthHistogram()); if (includeBQHistogram) { addBaseQHistogram(file); } }

Target:
public void addToMetricsFile(final MetricsFile<WgsMetrics, Integer> file, final boolean includeBQHistogram, final CountingFilter dupeFilter, final CountingFilter mapqFilter, final CountingPairedFilter pairFilter) { final WgsMetrics metrics = getMetrics(dupeFilter, mapqFilter, pairFilter); file.addMetric(metrics); file.addHistogram(getHighQualityDepthHistogram()); if (includeBQHistogram) addBaseQHistogram(file); }
Source:
@Override boolean isAdmin(User user) { if (user == null) { return false; } if( inner != null && inner.isAdmin(user)) { return true; } else if (outer != null && outer.isAdmin(user)) { return true; } return false; }

Target:
@Override boolean isAdmin(User user) { if (user == null) { return false; } return (inner != null && inner.isAdmin(user)) || (outer != null && outer.isAdmin(user)); }
Source:
public synchronized int read() throws IOException { throw new IOException("read without parameter not supported"); }

Target:
public synchronized int read() { int bytes = read(singleByte); if (bytes == -1) { return -1; } return singleByte[0] & 0xFF; }
Source:
private void setBulkOptions(BulkRequestBuilder bulkRequest, BulkOptions bulkOptions) { if (bulkOptions != null) { if (bulkOptions.getTimeout() != null) { bulkRequest.setTimeout(bulkOptions.getTimeout()); } if (bulkOptions.getRefreshPolicy() != null) { bulkRequest.setRefreshPolicy(bulkOptions.getRefreshPolicy()); } if (bulkOptions.getWaitForActiveShards() != null) { bulkRequest.setWaitForActiveShards(bulkOptions.getWaitForActiveShards()); } if (bulkOptions.getPipeline() != null) { bulkRequest.pipeline(bulkOptions.getPipeline()); } if (bulkOptions.getRoutingId() != null) { bulkRequest.routing(bulkOptions.getRoutingId()); } } }

Target:
private void setBulkOptions(BulkRequestBuilder bulkRequest, BulkOptions bulkOptions) { if (bulkOptions.getTimeout() != null) { bulkRequest.setTimeout(bulkOptions.getTimeout()); } if (bulkOptions.getRefreshPolicy() != null) { bulkRequest.setRefreshPolicy(bulkOptions.getRefreshPolicy()); } if (bulkOptions.getWaitForActiveShards() != null) { bulkRequest.setWaitForActiveShards(bulkOptions.getWaitForActiveShards()); } if (bulkOptions.getPipeline() != null) { bulkRequest.pipeline(bulkOptions.getPipeline()); } if (bulkOptions.getRoutingId() != null) { bulkRequest.routing(bulkOptions.getRoutingId()); } }
Source:
public KeyMaterial materialize() throws IOException, InterruptedException { FilePath dockerConfig = createSecretsDirectory(); FilePath configJsonPath = FilePath.getHomeDirectory(this.launcher.getChannel()).child(".docker").child(DOCKER_CONFIG_FILENAME); dockerConfig = UpdateDockerConfigFromSource(dockerConfig, configJsonPath, BLACKLISTED_PROPERTIES); String existingDockerSecretConfigPath = this.env.get("DOCKER_CONFIG"); if (StringUtils.isNotBlank(existingDockerSecretConfigPath)) { FilePath baseDir = getContext().getBaseDir(); String existingTmpConfigDir = existingDockerSecretConfigPath.substring(baseDir.getRemote().length() + 1); FilePath existingDockerConfigPath = baseDir.child(existingTmpConfigDir).child(DOCKER_CONFIG_FILENAME); dockerConfig = UpdateDockerConfigFromSource(dockerConfig, existingDockerConfigPath, BLACKLISTED_NESTED_PROPERTIES); } try { EnvVars envWithConfig = new EnvVars(env); envWithConfig.put("DOCKER_CONFIG", dockerConfig.getRemote()); if (launcher.launch().cmds(new ArgumentListBuilder(dockerExecutable, "login", "-u", username, "-p").add(password, true).add(endpoint)).envs(envWithConfig).stdout(listener).join() != 0) { throw new AbortException("docker login failed"); } } catch (IOException | InterruptedException x) { try { dockerConfig.deleteRecursive(); } catch (Exception x2) { x.addSuppressed(x2); } throw x; } return new RegistryKeyMaterial(dockerConfig, new EnvVars("DOCKER_CONFIG", dockerConfig.getRemote())); }

Target:
public KeyMaterial materialize() throws IOException, InterruptedException { FilePath dockerConfig = createSecretsDirectory(); FilePath configJsonPath = FilePath.getHomeDirectory(this.launcher.getChannel()).child(".docker").child(DOCKER_CONFIG_FILENAME); FilePath existingDockerConfigPath = new FilePath(this.launcher.getChannel(), Paths.get(this.env.get("DOCKER_CONFIG"), DOCKER_CONFIG_FILENAME).toString()); String dockerConfigJson = ""; if (existingDockerConfigPath.exists()) { this.launcher.getListener().getLogger().print("Reading the existing DOCKER_CONFIG '" + existingDockerConfigPath + "' docker config file.\n"); dockerConfigJson = existingDockerConfigPath.readToString(); } else if (configJsonPath.exists()) { this.launcher.getListener().getLogger().print("Reading the existing user's home '" + configJsonPath + "' docker config file.\n"); dockerConfigJson = removeBlacklistedProperties(configJsonPath.readToString(), BLACKLISTED_PROPERTIES); } if (StringUtils.isNotBlank(dockerConfigJson)) { dockerConfig.child(DOCKER_CONFIG_FILENAME).write(dockerConfigJson, StandardCharsets.UTF_8.name()); } try { EnvVars envWithConfig = new EnvVars(env); envWithConfig.put("DOCKER_CONFIG", dockerConfig.getRemote()); if (launcher.launch().cmds(new ArgumentListBuilder(dockerExecutable, "login", "-u", username, "-p").add(password, true).add(endpoint)).envs(envWithConfig).stdout(listener).join() != 0) { throw new AbortException("docker login failed"); } } catch (IOException | InterruptedException x) { try { dockerConfig.deleteRecursive(); } catch (Exception x2) { x.addSuppressed(x2); } throw x; } return new RegistryKeyMaterial(dockerConfig, new EnvVars("DOCKER_CONFIG", dockerConfig.getRemote())); }
Source:
public MappedRoleMapper() { this.reverseRoleMap = new LinkedHashMap<>(); this.removeMapped = true; this.removeNonMapped = true; this.keyRoles = Roles.NONE; }

Target:
public MappedRoleMapper()
Source:
public void copyToBuffer(final Buffer destinationBuffer) throws IOException { if (this.writeMode.get()) { throw new IllegalStateException("Cannot copy buffer that is still in write mode"); } if (size() > destinationBuffer.size()) { throw new IllegalArgumentException("Destination buffer is too small to store content of source buffer: " + size() + " vs. " + destinationBuffer.size()); } final MemoryBuffer target = (MemoryBuffer) destinationBuffer; System.arraycopy(this.getMemorySegment().getBackingArray(), 0, target.getMemorySegment().getBackingArray(),target.position(), limit()- position() ); target.position(limit()-position()); destinationBuffer.finishWritePhase(); }

Target:
public void copyToBuffer(final Buffer destinationBuffer) throws IOException { if (size() > destinationBuffer.size()) { throw new IllegalArgumentException("Destination buffer is too small to store content of source buffer: " + size() + " vs. " + destinationBuffer.size()); } final MemoryBuffer target = (MemoryBuffer) destinationBuffer; this.internalMemorySegment.copyTo(this.position(), target.getMemorySegment(), destinationBuffer.position(), limit()-position()); target.position(limit()-position()); destinationBuffer.flip(); }
Source:
public void beforeClass() throws IOException { config = new IntegrationTestConfigContext(); mantaClient = new MantaClient(config); testPathPrefix = IntegrationTestConfigContext.generateBasePath(config, this.getClass().getSimpleName()); testPathPrefix = testPathPrefix.substring(0, testPathPrefix.lastIndexOf(SEPARATOR)); }

Target:
public void beforeClass() throws IOException { config = new IntegrationTestConfigContext(); mantaClient = new MantaClient(config); testPathPrefix = IntegrationTestConfigContext.generateBasePathWithoutSeparator(config, this.getClass().getSimpleName()); }
Source:
protected void executeCommand() { List<VmDevice> watchdogs = getWatchdogs(); VmDevice watchdogDevice = watchdogs.get(0); watchdogDevice.setSpecParams(getSpecParams()); getVmDeviceDao().update(watchdogDevice); setActionReturnValue(watchdogDevice); setSucceeded(true); }

Target:
protected void executeCommand() { List<VmDevice> watchdogs = getWatchdogs(); VmDevice watchdogDevice = watchdogs.get(0); watchdogDevice.setSpecParams(getSpecParams()); getVmDeviceDao().update(watchdogDevice); setSucceeded(true); }
Source:
public Storage setDefaultStorage(final String defaultStorageId) { final Storage storage = getStorage(defaultStorageId); try { curator.setData().forPath(ZK_TIMELINES_DEFAULT_STORAGE, defaultStorageId.getBytes(Charsets.UTF_8)); } catch (final Exception e) { LOG.error("Error while setting default storage in zk ", e.getMessage(), e); throw new InternalNakadiException("Error while setting default storage in zk"); } return storage; }

Target:
public Storage setDefaultStorage(final String defaultStorageId) throws NoSuchStorageException, InternalNakadiException { final Storage storage = getStorage(defaultStorageId); try { curator.setData().forPath(ZK_TIMELINES_DEFAULT_STORAGE, defaultStorageId.getBytes(Charsets.UTF_8)); } catch (final Exception e) { LOG.error("Error while setting default storage in zk ", e.getMessage(), e); throw new InternalNakadiException("Error while setting default storage in zk"); } return storage; }
Source:
public static void selectFolder(SWTBot bot, boolean check, String... treePath) { SWTBotTree tree = bot.tree(); bot.waitUntil(Conditions.widgetIsEnabled(tree)); SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(bot, tree, treePath); if (check) { folderNode.check(); } else { folderNode.select(); } }

Target:
public static void selectFolder(SWTBot bot, boolean check, String... treePath) { SWTBotTree tree = bot.tree(); bot.waitUntil(Conditions.widgetIsEnabled(tree)); SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(bot, tree, treePath); folderNode.select(); if (check) { folderNode.check(); } }
Source:
public void killTask(ExecutorDriver driver, TaskID taskId) { LOGGER.info("Killing task : " + taskId.getValue()); healthCheck.cancel(true); if(forceShutdown){ driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(currentTaskId) .setState(TaskState.TASK_KILLED) .build()); driver.stop(); } if (task.process != null) { LOGGER.debug("Found task to kill: " + taskId.getValue()); int pid = task.pid(); if (pid == -1) { LOGGER.error("Graceful shutdown failed. Could not read crate.pid."); task.process.destroy(); task.process = null; return; } boolean success = task.gracefulStop(); if (success) { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_KILLED) .build()); driver.stop(); } else { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_RUNNING) .build()); } } else { LOGGER.error("No running task found. Stopping executor."); driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_LOST) .build()); driver.stop(); } }

Target:
public void killTask(ExecutorDriver driver, TaskID taskId) { LOGGER.info("Killing task : " + taskId.getValue()); healthCheck.cancel(true); if(forceShutdown){ forceShutdown(driver); return; } if (task.process != null) { LOGGER.debug("Found task to kill: " + taskId.getValue()); int pid = task.pid(); if (pid == -1) { LOGGER.error("Graceful shutdown failed. Could not read crate.pid."); task.process.destroy(); task.process = null; return; } boolean success = task.gracefulStop(); if (success) { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_KILLED) .build()); driver.stop(); } else { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_RUNNING) .build()); } } else { LOGGER.error("No running task found. Stopping executor."); driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_LOST) .build()); driver.stop(); } }
Source:
public ClassLoader connectorLoader(String connectorClassOrAlias) { log.debug("Getting plugin class loader for connector: '{}'", connectorClassOrAlias); String fullName = aliases.getOrDefault(connectorClassOrAlias, connectorClassOrAlias); PluginClassLoader classLoader = pluginClassLoader(fullName); if (classLoader == null) { log.error( "Plugin class loader for connector: '{}' was not found. Returning: {}", connectorClassOrAlias, this ); return this; } return classLoader; }

Target:
public ClassLoader connectorLoader(String connectorClassOrAlias) { log.debug("Getting plugin class loader for connector: '{}'", connectorClassOrAlias); String fullName = aliases.containsKey(connectorClassOrAlias) ? aliases.get(connectorClassOrAlias) : connectorClassOrAlias; PluginClassLoader classLoader = pluginClassLoader(fullName); if (classLoader == null) { log.error( "Plugin class loader for connector: '{}' was not found. Returning: {}", connectorClassOrAlias, this ); return this; } return classLoader; }
Source:
public void setMaxSpeed(double maxSpeed) { if (this.maxSpeed == null || maxSpeed > this.maxSpeed) { this.maxSpeed = maxSpeed; } }

Target:
public void setMaxSpeed(double maxSpeed) { if (maxSpeed > this.maxSpeed) { this.maxSpeed = maxSpeed; } }
Source:
public void color(String color) { if (!colorPattern.matcher(color).matches()) { throw new IllegalArgumentException( "Color '" + color + "' doesn't match acceptable color pattern."); } this.color = color; }

Target:
public void color(String color) { this.color = color; }
Source:
public MemcachedClient create() { if (useSharedClient && clients.size() == 1) { logger.info("Using a shared client"); return clients.get(0); } logger.info("Creating a new client"); MemcachedClient client = null; try { client = new MemcachedClient(this.addresses); } catch (IOException ex) { throw new IllegalStateException("Error starting Memcached client.", ex); } clients.add(client); return client; }

Target:
public synchronized MemcachedClient create() { if (useSharedClient && clients.size() == 1) { logger.info("Using a shared client"); return clients.get(0); } logger.info("Creating a new client"); MemcachedClient client = null; try { client = new MemcachedClient(this.addresses); } catch (IOException ex) { throw new IllegalStateException("Error starting Memcached client.", ex); } clients.add(client); return client; }
Source:
private void checkListType(EStructuralFeature structuralFeature) throws IllegalListTypeException { if (structuralFeature.getLowerBound() != 0 || structuralFeature.getUpperBound() != -1) { throw new IllegalListTypeException( "The VIndexDomainModelReference's domainModelEFeature must reference a list."); } if (!EReference.class.isInstance(structuralFeature)) { throw new IllegalListTypeException( "The VIndexDomainModelReference's domainModelEFeature must reference a list of EObjects."); } }

Target:
private void checkListType(EStructuralFeature structuralFeature) throws IllegalListTypeException { if (!structuralFeature.isMany()) { throw new IllegalListTypeException( "The VIndexDomainModelReference's domainModelEFeature must reference a list."); } if (!EReference.class.isInstance(structuralFeature)) { throw new IllegalListTypeException( "The VIndexDomainModelReference's domainModelEFeature must reference a list of EObjects."); } }
Source:
public void setConf(final MongoDBRdfConfiguration conf) { this.conf = conf; auths = conf.getAuthorizations(); }

Target:
public void setConf(final MongoDBRdfConfiguration conf) { this.conf = conf; this.auths = conf.getAuthorizations(); }
Source:
public RowMapper<Map<String, Object>> specialize(ResultSet rs, StatementContext ctx) throws SQLException { ResultSetMetaData m = rs.getMetaData(); int columnCount = m.getColumnCount(); String[] columnNames = new String[columnCount+1]; for (int i = 1; i <= columnCount; i++) { String key = m.getColumnName(i); String alias = m.getColumnLabel(i); if (alias == null) { alias = key; } if (foldCase) { alias = alias.toLowerCase(Locale.ROOT); } columnNames[i] = alias; } return (r, c) -> { Map<String, Object> row = new HashMap<>(); for (int i = 1; i <= columnCount; i++) { row.put(columnNames[i], rs.getObject(i)); } return row; }; }

Target:
public RowMapper<Map<String, Object>> specialize(ResultSet rs, StatementContext ctx) throws SQLException { ResultSetMetaData m = rs.getMetaData(); int columnCount = m.getColumnCount(); String[] columnNames = new String[columnCount+1]; for (int i = 1; i <= columnCount; i++) { String key = m.getColumnName(i); String alias = m.getColumnLabel(i); if (alias == null) { alias = key; } if (foldCase) { alias = alias.toLowerCase(Locale.ROOT); } columnNames[i] = alias; } return (r, c) -> { Map<String, Object> row = new HashMap<>(columnCount); for (int i = 1; i <= columnCount; i++) { row.put(columnNames[i], rs.getObject(i)); } return row; }; }
Source:
private void sendToKafka(final String topic, MemoryBoundLinkedBlockingQueue<String> recordQueue) { ObjectContainer<String> objectToSend; try { while((objectToSend = recordQueue.take()) != null) { final ObjectContainer<String> finalObjectToSend = objectToSend; producer.send(new ProducerRecord<String, String>(topic, finalObjectToSend.getData()), new Callback() { @Override public void onCompletion(RecordMetadata recordMetadata, Exception e) { if(e != null) { log.warn(e, "Exception occured!"); if(topic.equals(config.getMetricTopic())) { if(!metricQueue.offer(finalObjectToSend)) { log.warn("metricQueue is now memory bounded! metricLost: " + metricLost.incrementAndGet()); } } else if(topic.equals(config.getAlertTopic())) { if(!alertQueue.offer(finalObjectToSend)) { log.warn("alertQueue is now memory bounded! alertLost: " + alertLost.incrementAndGet()); } } else { log.warn("Invalid topic name! invalidLost: " + invalidLost.incrementAndGet()); } } } }); } } catch (InterruptedException e) { log.warn(e, "Failed to take record from queue!"); } }

Target:
private void sendToKafka(final String topic, MemoryBoundLinkedBlockingQueue<String> recordQueue) { ObjectContainer<String> objectToSend; try { while (true) { objectToSend = recordQueue.take(); producer.send(new ProducerRecord<>(topic, objectToSend.getData()), producerCallback); } } catch (InterruptedException e) { log.warn(e, "Failed to take record from queue!"); } }
Source:
public List<Map<String, String>> getModifiedData() { if (0 < modifiedData.size()) { XStream _xstream = new XStream(new DomDriver()); Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy_HH-mm-ss"); String lastmoddate = sdf.format(date); java.io.File _writing = null; if (!new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").exists()) { new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").mkdirs(); } _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes"); if (!_writing.exists()) { _writing.mkdirs(); } _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes" + java.io.File.separator + lastmoddate + "_" + "FixTask00012UpdateAssetsHosts" + ".xml"); BufferedOutputStream _bout = null; try { _bout = new BufferedOutputStream(Files.newOutputStream(_writing.toPath())); } catch (IOException e) { } try { _xstream.toXML(modifiedData, _bout); } finally { CloseUtils.closeQuietly(_bout); } } return modifiedData; }

Target:
public List<Map<String, String>> getModifiedData() { if (0 < modifiedData.size()) { XStream _xstream = new XStream(new DomDriver()); Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy_HH-mm-ss"); String lastmoddate = sdf.format(date); java.io.File _writing = null; if (!new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").exists()) { new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").mkdirs(); } _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes"); if (!_writing.exists()) { _writing.mkdirs(); } _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes" + java.io.File.separator + lastmoddate + "_" + "FixTask00012UpdateAssetsHosts" + ".xml"); try (BufferedOutputStream _bout = new BufferedOutputStream(Files.newOutputStream(_writing.toPath()))){ _xstream.toXML(modifiedData, _bout); } catch (IOException e) { Logger.error(this, "Error trying to get modified data from XML.", e); } } return modifiedData; }
Source:
public void init() { try { ccf = new ConnectionContextFactory(conFactory); pcc = ccf.createProducerConnectionContext(new Endpoint(Endpoint.Type.QUEUE, ACTION_PLUGIN_REGISTER)); ActionPluginMessage apMsg = new ActionPluginMessage(); apMsg.setOp(EmailPlugin.INIT_PLUGIN); apMsg.setActionPlugin(EmailPlugin.PLUGIN_NAME); Set<String> properties = new HashSet<String>(); properties.add("to"); properties.add("cc"); properties.add("description"); apMsg.setProperties(properties); MessageId mid = new MessageProcessor().send(pcc, apMsg); msgLog.infoPluginRegistration(EmailPlugin.INIT_PLUGIN, mid.toString()); } catch (JMSException e) { log.debug(e.getMessage(), e); msgLog.errorCannotSendMessage(EmailPlugin.INIT_PLUGIN, e.getMessage()); } }

Target:
public void init() { try { ccf = new ConnectionContextFactory(conFactory); pcc = ccf.createProducerConnectionContext(new Endpoint(Endpoint.Type.QUEUE, ACTION_PLUGIN_REGISTER)); ActionPluginMessage apMsg = new ActionPluginMessage(); apMsg.setOp(EmailPlugin.INIT_PLUGIN); apMsg.setActionPlugin(EmailPlugin.PLUGIN_NAME); Set<String> properties = new HashSet<String>(); properties.add(EmailPlugin.PROP_FROM); properties.add(EmailPlugin.PROP_FROM_NAME); properties.add(EmailPlugin.PROP_TO); properties.add(EmailPlugin.PROP_CC); properties.add(EmailPlugin.PROP_MESSAGE_ID); properties.add(EmailPlugin.PROP_IN_REPLY_TO); properties.add(EmailPlugin.PROP_TEMPLATE_HAWKULAR_URL); properties.add(EmailPlugin.PROP_TEMPLATE_LOCALE); properties.add(EmailPlugin.PROP_TEMPLATE_PLAIN); properties.add(EmailPlugin.PROP_TEMPLATE_HTML); apMsg.setProperties(properties); MessageId mid = new MessageProcessor().send(pcc, apMsg); msgLog.infoPluginRegistration(EmailPlugin.INIT_PLUGIN, mid.toString()); } catch (JMSException e) { log.debug(e.getMessage(), e); msgLog.errorCannotSendMessage(EmailPlugin.INIT_PLUGIN, e.getMessage()); } finally { if (pcc != null) { try { pcc.close(); pcc = null; } catch (IOException ignored) { } } if (ccf != null) { try { ccf.close(); } catch (JMSException ignored) { } } } }
Source:
public RibbonApacheHttpResponse execute(RibbonApacheHttpRequest request, final IClientConfig configOverride) throws Exception { final RequestConfig.Builder builder = RequestConfig.custom(); IClientConfig config = configOverride != null ? configOverride : this.config; if (config != null) { builder.setConnectTimeout(config.get( CommonClientConfigKey.ConnectTimeout, this.connectTimeout)); builder.setSocketTimeout(config.get( CommonClientConfigKey.ReadTimeout, this.readTimeout)); builder.setRedirectsEnabled(config.get( CommonClientConfigKey.FollowRedirects, this.followRedirects)); } else { builder.setConnectTimeout(this.connectTimeout); builder.setSocketTimeout(this.readTimeout); builder.setRedirectsEnabled(this.followRedirects); } final RequestConfig requestConfig = builder.build(); if (isSecure(configOverride)) { final URI secureUri = UriComponentsBuilder.fromUri(request.getUri()) .scheme("https").build().toUri(); request = request.withNewUri(secureUri); } final HttpUriRequest httpUriRequest = request.toRequest(requestConfig); final HttpResponse httpResponse = this.delegate.execute(httpUriRequest); return new RibbonApacheHttpResponse(httpResponse, httpUriRequest.getURI()); }

Target:
public RibbonApacheHttpResponse execute(RibbonApacheHttpRequest request, final IClientConfig configOverride) throws Exception { final RequestConfig.Builder builder = RequestConfig.custom(); IClientConfig config = configOverride != null ? configOverride : this.config; builder.setConnectTimeout(config.get( CommonClientConfigKey.ConnectTimeout, this.connectTimeout)); builder.setSocketTimeout(config.get( CommonClientConfigKey.ReadTimeout, this.readTimeout)); builder.setRedirectsEnabled(config.get( CommonClientConfigKey.FollowRedirects, this.followRedirects)); final RequestConfig requestConfig = builder.build(); if (isSecure(configOverride)) { final URI secureUri = UriComponentsBuilder.fromUri(request.getUri()) .scheme("https").build().toUri(); request = request.withNewUri(secureUri); } final HttpUriRequest httpUriRequest = request.toRequest(requestConfig); final HttpResponse httpResponse = this.delegate.execute(httpUriRequest); return new RibbonApacheHttpResponse(httpResponse, httpUriRequest.getURI()); }
Source:
public LivenessCheckScheduler(Consumer<String> errorHandler, TableUtils table, BlobUtils blob, AtomicReference<String> currentJMVersion, final String pid) { this.table = table; this.blob = blob; this.currentJMVersion = currentJMVersion; liveProcessorsList = new AtomicReference<>(null); this.errorHandler = errorHandler; this.processorId = pid; }

Target:
public LivenessCheckScheduler(Consumer<String> errorHandler, TableUtils table, BlobUtils blob, AtomicReference<String> currentJMVersion, final String pid) { this.table = table; this.blob = blob; this.currentJMVersion = currentJMVersion; this.errorHandler = errorHandler; this.processorId = pid; }
Source:
private ConsumerRebalanceListener getConsumerRebalanceListener(final KafkaConsumer<String, String> consumer) { return new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { for (TopicPartition partition : partitions) consumer.seek(partition, 0); } @Override public void onPartitionsLost(Collection<TopicPartition> partitions) { System.out.println("hit partitions lost " + partitions); } }; }

Target:
private ConsumerRebalanceListener getConsumerRebalanceListener(final KafkaConsumer<String, String> consumer) { return new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { for (TopicPartition partition : partitions) consumer.seek(partition, 0); } }; }
Source:
private static void downloadBlob(CloudBlob blob, FilePath downloadDir, boolean flattenDirectories, TaskListener listener) throws WAStorageException { try { FilePath downloadFile = new FilePath(downloadDir, blob.getName()); if (flattenDirectories) { downloadFile = new FilePath(downloadDir, downloadFile.getName()); } try (OutputStream fos = downloadFile.write()) { long startTime = System.currentTimeMillis(); blob.download(fos, null, getBlobRequestOptions(), Utils.updateUserAgent()); long endTime = System.currentTimeMillis(); listener.getLogger().println( "blob " + blob.getName() + " is downloaded to " + downloadDir + " in " + getTime(endTime - startTime)); } } catch (Exception e) { throw new WAStorageException(e.getMessage(), e.getCause()); } }

Target:
private static void downloadBlob(CloudBlob blob, FilePath downloadDir, boolean flattenDirectories, TaskListener listener) throws WAStorageException { try { FilePath downloadFile = new FilePath(downloadDir, blob.getName()); if (flattenDirectories) { downloadFile = new FilePath(downloadDir, downloadFile.getName()); } long startTime = System.currentTimeMillis(); try (OutputStream fos = downloadFile.write()) { blob.download(fos, null, getBlobRequestOptions(), Utils.updateUserAgent()); } long endTime = System.currentTimeMillis(); listener.getLogger().println( "blob " + blob.getName() + " is downloaded to " + downloadDir + " in " + getTime(endTime - startTime)); } catch (Exception e) { throw new WAStorageException(e.getMessage(), e.getCause()); } }
Source:
public ListResponse<DomainRouterResponse> searchForInternalLbVms(ListInternalLBVMsCmd cmd) { Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(), cmd.getState(), cmd.getZoneId(), cmd.getPodId(), null, cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(), cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), null); ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>(); if (!VirtualNetworkApplianceManager.RouterHealthChecksEnabled.value()) { s_logger.debug("Skipping health checks data for internal lbvms as it's router.health.checks.enabled is false"); return response; } List<DomainRouterResponse> routerResponses = ViewResponseHelper.createDomainRouterResponse(result.first().toArray(new DomainRouterJoinVO[result.first().size()])); for (DomainRouterResponse res : routerResponses) { DomainRouterVO resRouter = _routerDao.findByUuid(res.getId()); res.setHealthChecksFailed(routerHealthCheckResultDao.hasFailingChecks(resRouter.getId())); if (cmd.shouldFetchHealthCheckResults()) { res.setHealthCheckResults(responseGenerator.createHealthCheckResponse(resRouter, new ArrayList<>(routerHealthCheckResultDao.getHealthCheckResults(resRouter.getId())))); } } response.setResponses(routerResponses, result.second()); return response; }

Target:
public ListResponse<DomainRouterResponse> searchForInternalLbVms(ListInternalLBVMsCmd cmd) { Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(), cmd.getState(), cmd.getZoneId(), cmd.getPodId(), null, cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(), cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), null); ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>(); List<DomainRouterResponse> routerResponses = ViewResponseHelper.createDomainRouterResponse(result.first().toArray(new DomainRouterJoinVO[result.first().size()])); if (VirtualNetworkApplianceManager.RouterHealthChecksEnabled.value()) { for (DomainRouterResponse res : routerResponses) { DomainRouterVO resRouter = _routerDao.findByUuid(res.getId()); res.setHealthChecksFailed(routerHealthCheckResultDao.hasFailingChecks(resRouter.getId())); if (cmd.shouldFetchHealthCheckResults()) { res.setHealthCheckResults(responseGenerator.createHealthCheckResponse(resRouter, new ArrayList<>(routerHealthCheckResultDao.getHealthCheckResults(resRouter.getId())))); } } } response.setResponses(routerResponses, result.second()); return response; }
Source:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String location = "/tmp/upload"; String fileName = location + request.getPathInfo(); FileInputStream fis = null; try { fis = new FileInputStream(fileName); response.setContentType("application/octet-stream"); OutputStream out = response.getOutputStream(); IOUtils.copy(fis, out); } finally { IOUtils.closeQuietly(out); IOUtils.closeQuietly(fis); } }

Target:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String fileName = uploadPath + request.getPathInfo(); try (FileInputStream fis = new FileInputStream(fileName)){ response.setContentType("application/octet-stream"); try (OutputStream out = response.getOutputStream()){ IOUtils.copy(fis, out); } } }
Source:
public static byte[] createMaxByteArray(int num_bytes) { byte[] max_byte_arr = new byte[num_bytes]; for (int i = 0; i < max_byte_arr.length; i++) { max_byte_arr[i] = (byte) 0xff; } return max_byte_arr; }

Target:
public static byte[] createMaxByteArray(int num_bytes) { byte[] max_byte_arr = new byte[num_bytes]; Arrays.fill(max_byte_arr, (byte) 0xff); return max_byte_arr; }
Source:
public FormValidation doCheckRemote(StaplerRequest req, @AncestorInPath AbstractProject context, @QueryParameter String value, @QueryParameter String credentialsId) { Jenkins instance = Jenkins.getInstance(); if (instance != null) { ModuleLocation.DescriptorImpl d = instance.getDescriptorByType(ModuleLocation.DescriptorImpl.class); if (d != null) { return d.doCheckCredentialsId( req, context, value, credentialsId); } } return null; }

Target:
public FormValidation doCheckRemote(StaplerRequest req, @AncestorInPath AbstractProject context, @QueryParameter String value, @QueryParameter String credentialsId) { Jenkins instance = Jenkins.getInstance(); if (instance != null) { ModuleLocation.DescriptorImpl d = instance.getDescriptorByType(ModuleLocation.DescriptorImpl.class); if (d != null) { return d.doCheckCredentialsId( req, context, value, credentialsId); } } return FormValidation.warning("Unable to check remote."); }
Source:
public boolean isValidInput() { mErrorView.setVisibility(View.GONE); mInputView.setContentDescription(String.format("%s. %s.", mInputView.getSelectedItemName(), mField.getInstructions())); if (mField.isRequired() && !hasValue()) { String errorMessage = mField.getErrorMessage().getRequired(); if (errorMessage == null || errorMessage.isEmpty()) { errorMessage = getView().getResources().getString(R.string.error_select_field, mField.getLabel()); } handleError(errorMessage); return false; } else if (!mField.isRequired() && mField.getFieldType().equals(RegistrationFieldType.MULTI) && mInputView.length() > 0 && !hasValue()) { String errorMessage = getView().getResources().getString(R.string.error_select_or_enter_field, mField.getLabel()); handleError(errorMessage); return false; } return true; }

Target:
public boolean isValidInput() { mErrorView.setVisibility(View.GONE); mInputView.setContentDescription(String.format("%s. %s.", mInputView.getSelectedItemName(), mField.getInstructions())); if ((mField.isRequired() || (!mField.isRequired() && mField.getFieldType().equals(RegistrationFieldType.MULTI) && mInputView.length() > 0)) && !hasValue()) { initializeErrorMessage(); return false; } return true; }
Source:
public void shouldGetSizeOfDirectory() throws Exception { int testContent = 156575; URI resource = fileManagement.create(URI.create("fileTest"), "size.txt", true); Assert.assertTrue(fileManagement.fileExist(resource)); OutputStream outputStream = fileManagement.write(URI.create("fileTest/size.txt")); try { outputStream.write(testContent); } finally { outputStream.flush(); outputStream.close(); } long directorySize = fileManagement.getSizeOfDirectory(URI.create("fileTest")); Assert.assertEquals(directorySize, 1); }

Target:
public void shouldGetSizeOfDirectory() throws Exception { int testContent = 156575; URI directory = fileManagement.create(URI.create(""), "directorySize", false); URI resource = fileManagement.create(directory, "size.txt", true); Assert.assertTrue(fileManagement.fileExist(resource)); try (OutputStream outputStream = fileManagement.write(URI.create("directorySize/size.txt"))){ outputStream.write(testContent); } long directorySize = fileManagement.getSizeOfDirectory(URI.create("directorySize")); Assert.assertEquals("Incorrect size of directory", 1, directorySize); }
Source:
public void verifyNewSuggestionsTextAndImages(String query) { searchField.click(); waitForElementByBy(jqueryAutocompleteBy); searchField.sendKeys(query); waitForElementByElement(newSuggestionsList.get(0)); System.out.println(newSuggestionsList.size() ); for(int i = 0; i < newSuggestionsList.size(); i++) { Assertion.assertStringContains(suggestionText.get(i).getText(), query); Assertion.assertTrue(suggestionImage.get(i).isDisplayed()); PageObjectLogging.log("assertTrue", "Image next to suggestion verified", true, driver); } }

Target:
public void verifyNewSuggestionsTextAndImages(String query) { searchField.click(); waitForElementByBy(jqueryAutocompleteBy); searchField.sendKeys(query); waitForElementByElement(newSuggestionsList.get(0)); System.out.println(newSuggestionsList.size() ); for(int i = 0; i < newSuggestionsList.size(); i++) { Assertion.assertStringContains(suggestionTextsList.get(i).getText(), query); Assertion.assertTrue(suggestionImagesList.get(i).isDisplayed()); } PageObjectLogging.log("verifyNewSuggestionsTextAndImages", "Image and text next to every suggestion is verified", true); }
Source:
public void testLamba024() throws Exception { new RuntimeTestHelper(LAMBDA024) .setSourceLevel(SourceLevel.JAVA_8) .addProperty(Options.LAMBDA_TO_ANONYMOUS_CONVERTER.getName(), Boolean.TRUE.toString()) .addTestExeFileChecker(new FileChecker() { @Override public void check(@Nonnull File file) throws Exception { DexFile dexFile = new DexFile(file); Set<String> sourceFileInDex = new HashSet<String>(); for (ClassDefItem classDef : dexFile.ClassDefsSection.getItems()) { sourceFileInDex.add(classDef.getSourceFile().getStringValue()); } Assert.assertTrue(sourceFileInDex.contains("I1.java")); Assert.assertTrue(!sourceFileInDex.contains("I2.java")); } }) .compileAndRunTest(); }

Target:
public void testLamba024() throws Exception { new RuntimeTestHelper(LAMBDA024) .setSourceLevel(SourceLevel.JAVA_8) .addProperty(Options.LAMBDA_TO_ANONYMOUS_CONVERTER.getName(), Boolean.TRUE.toString()) .addTestExeFileChecker(new ShrinkFileChecker().addKeptFile("I1.java").addRemovedFile("I2.java")) .compileAndRunTest(); }
Source:
public EngineScheduleExpression(String cronExpression) { super(); String[] cron = cronExpression.split("\\s *"); second(cron[0]).minute(cron[1]).hour(cron[2]).dayOfMonth(cron[3]).month(cron[4]).dayOfWeek(cron[5]); if (cron.length >= 7) { year(cron[6]); } }

Target:
public EngineScheduleExpression(String cronExpression) { String[] cron = cronExpression.split("\\s *"); second(cron[0]).minute(cron[1]).hour(cron[2]).dayOfMonth(cron[3]).month(cron[4]).dayOfWeek(cron[5]); if (cron.length >= 7) { year(cron[6]); } }
Source:
public IMetaStoreClient getHeatbeatMSC() { connectionStats.incrementMetastoreCalls(); return heartbeatMSClient; }

Target:
IMetaStoreClient getHeatbeatMSC() { connectionStats.incrementMetastoreCalls(); return heartbeatMSClient; }
Source:
public void onAttach(Activity activity) { super.onAttach(activity); try { mDelegate = (ServiceFragmentDelegate) activity; setTimer(INITIAL_MEASUREMENT_INTERVAL); } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement ServiceFragmentDelegate"); } }

Target:
public void onAttach(Activity activity) { super.onAttach(activity); try { mDelegate = (ServiceFragmentDelegate) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement ServiceFragmentDelegate"); } }
Source:
public void auditLoggingOffForInboundX12BatchRequest() { final CORE_X12BatchSubmissionAuditLogger auditLogger = getAuditLogger(false); COREEnvelopeBatchSubmissionResponse expectedResponse = new COREEnvelopeBatchSubmissionResponse(); when(adpFactory.getAdapterCORE_X12DocSubmissionProxy()).thenReturn(reqProxy); when(reqProxy.batchSubmitTransaction(request, assertion)).thenReturn(expectedResponse); PassthroughInboundCORE_X12DSGenericBatchRequest batchReq = new PassthroughInboundCORE_X12DSGenericBatchRequest(adpFactory, auditLogger); COREEnvelopeBatchSubmissionResponse actualResposne = batchReq.batchSubmitTransaction( request, assertion, webContextProperties); verify(mockEJBLogger, never()).auditResponseMessage(eq(request), eq(actualResposne), eq(assertion), isNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.FALSE), eq(webContextProperties), eq(NhincConstants.CORE_X12DS_GENERICBATCH_REQUEST_SERVICE_NAME), any(COREX12BatchSubmissionAuditTransforms.class)); }

Target:
public void auditLoggingOffForInboundX12BatchRequest() { when(adpFactory.getAdapterCORE_X12DocSubmissionProxy()).thenReturn(reqProxy); when(reqProxy.batchSubmitTransaction(request, assertion)).thenReturn(expectedResponse); batchReq = new PassthroughInboundCORE_X12DSGenericBatchRequest(adpFactory, getAuditLogger(false)); actualResposne = batchReq.batchSubmitTransaction(request, assertion, webContextProperties); verify(mockEJBLogger, never()).auditResponseMessage(eq(request), eq(actualResposne), eq(assertion), isNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.FALSE), eq(webContextProperties), eq(NhincConstants.CORE_X12DS_GENERICBATCH_REQUEST_SERVICE_NAME), any(COREX12BatchSubmissionAuditTransforms.class)); }
Source:
public NoteInfo getNote(long noteId) { Uri noteUri = Uri.withAppendedPath(Note.CONTENT_URI, Long.toString(noteId)); Cursor cursor = mResolver.query(noteUri, null, null, null, null); if (cursor == null) { return null; } try { if (!cursor.moveToNext()) { return null; } return NoteInfo.buildFromCursor(cursor); } finally { cursor.close(); } }

Target:
public NoteInfo getNote(long noteId) { Uri noteUri = Uri.withAppendedPath(Note.CONTENT_URI, Long.toString(noteId)); Cursor cursor = mResolver.query(noteUri, PROJECTION, null, null, null); if (cursor == null) { return null; } try { if (!cursor.moveToNext()) { return null; } return NoteInfo.buildFromCursor(cursor); } finally { cursor.close(); } }
Source:
public boolean isValidInput() { mErrorView.setVisibility(View.GONE); if (mField.isRequired() && !hasValue()) { String errorMessage = mField.getErrorMessage().getRequired(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_select_field); errorMessage = errorMessage.replaceFirst(getView().getResources() .getString(R.string.register_field) ,mField.getLabel().toLowerCase()); } if(errorMessage!=null){ handleError(errorMessage); } return false; } return true; }

Target:
public boolean isValidInput() { mErrorView.setVisibility(View.GONE); if (mField.isRequired() && !hasValue()) { String errorMessage = mField.getErrorMessage().getRequired(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_select_field, mField.getLabel()); } handleError(errorMessage); return false; } return true; }