auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void run(ActionContext context) throws Exception { Class<? extends Driver> driverClass = context.loadPluginClass(JDBC_PLUGIN_ID); DBManager dbManager = new DBManager(config); try { dbManager.ensureJDBCDriverIsAvailable(driverClass); try (Connection connection = getConnection()) { if (!config.enableAutoCommit) { connection.setAutoCommit(false); } ScriptRunner runner = new ScriptRunner(connection, config.enableAutoCommit, true); runner.runScript(new BufferedReader(new FileReader(config.scriptPath))); if (!config.enableAutoCommit) { connection.commit(); } } } catch (Exception e) { LOG.error("Error running script {}.", config.scriptPath, e); } finally { dbManager.destroy(); } }

Target:
public void run(ActionContext context) throws Exception { Class<? extends Driver> driverClass = context.loadPluginClass(JDBC_PLUGIN_ID); DBRun executeQuery = new DBRun(config, driverClass); executeQuery.run(); }
Source:
public String deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { TreeNode treeNode = jp.readValueAsTree(); JsonNode oid = ((JsonNode) treeNode).get(MONGO_QUERY_OID); if (oid != null) return oid.asText(); else if(treeNode.isValueNode() && treeNode instanceof TextNode) { return ((JsonNode) treeNode).textValue(); } else return treeNode.toString(); }

Target:
public String deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { TreeNode treeNode = jp.readValueAsTree(); JsonNode oid = ((JsonNode) treeNode).get(MONGO_QUERY_OID); if (oid != null) return oid.asText(); else return ((JsonNode) treeNode).asText(); }
Source:
public void collect(com.twitter.zipkin.gen.Span span) { if (queue.offer(span) == false) { LOGGER.log(Level.WARNING, "Queue rejected span!"); } }

Target:
public void collect(com.twitter.zipkin.gen.Span span) { if (!queue.offer(span)) { LOGGER.log(Level.WARNING, "Queue rejected span!"); } }
Source:
public void verifyPhoto() { waitForElementByElement(imageArticle); }

Target:
public void verifyPhoto() { waitForElementByElement(imageArticle); PageObjectLogging.log("verifyPhoto", "photo is visible", true); }
Source:
public String toString() { return JsonUtils.toJson(this); }

Target:
public String toString() { return "DatastreamPositionResponse{" + "_datastreamToPhysicalSources=" + _datastreamToPhysicalSources + '}'; }
Source:
public async_tasks mapRow(ResultSet rs, int rowNum) throws SQLException { async_tasks entity = new async_tasks(); entity.setaction_type(VdcActionType.forValue(rs.getInt("action_type"))); entity.setresult(AsyncTaskResultEnum.forValue(rs.getInt("result"))); entity.setstatus(AsyncTaskStatusEnum.forValue(rs.getInt("status"))); entity.settask_id(Guid.createGuidFromString(rs.getString("task_id"))); entity.setaction_parameters(deserializeParameters(rs.getString("action_parameters"),rs.getString("action_params_class"))); entity.setStepId(NGuid.createGuidFromString(rs.getString("step_id"))); entity.setCommandId(Guid.createGuidFromString(rs.getString("command_id"))); entity.setStartTime(DbFacadeUtils.fromDate(rs.getTimestamp("started_at"))); entity.setTaskType(AsyncTaskType.forValue(rs.getInt("task_type"))); return entity; }

Target:
public async_tasks mapRow(ResultSet rs, int rowNum) throws SQLException { async_tasks entity = new async_tasks(); entity.setaction_type(VdcActionType.forValue(rs.getInt("action_type"))); entity.setresult(AsyncTaskResultEnum.forValue(rs.getInt("result"))); entity.setstatus(AsyncTaskStatusEnum.forValue(rs.getInt("status"))); entity.settask_id(Guid.createGuidFromString(rs.getString("task_id"))); entity.setaction_parameters(deserializeParameters(rs.getString("action_parameters"),rs.getString("action_params_class"))); entity.setStepId(NGuid.createGuidFromString(rs.getString("step_id"))); entity.setCommandId(Guid.createGuidFromString(rs.getString("command_id"))); entity.setStartTime(DbFacadeUtils.fromDate(rs.getTimestamp("started_at"))); entity.setTaskType(AsyncTaskType.forValue(rs.getInt("task_type"))); entity.setStoragePoolId(Guid.createGuidFromString(rs.getString("storage_pool_id"))); return entity; }
Source:
public SecurityGroup removeIpPermission(IpPermission ipPermission, SecurityGroup group) { String zone = group.getLocation().getId(); String id = group.getId(); Optional<? extends SecurityGroupApi> sgApi = client.getSecurityGroupExtensionForZone(zone); if (!sgApi.isPresent()) { return null; } org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroup = sgApi.get().get(id); if (ipPermission.getCidrBlocks().size() > 0) { for (String cidr : ipPermission.getCidrBlocks()) { for (SecurityGroupRule rule : filter(securityGroup.getRules(), and(ruleCidr(cidr), ruleProtocol(ipPermission.getIpProtocol()), ruleStartPort(ipPermission.getFromPort()), ruleEndPort(ipPermission.getToPort())))) { sgApi.get().deleteRule(rule.getId()); } } } if (ipPermission.getGroupIds().size() > 0) { for (String groupId : ipPermission.getGroupIds()) { for (SecurityGroupRule rule : filter(securityGroup.getRules(), and(ruleGroup(groupId), ruleProtocol(ipPermission.getIpProtocol()), ruleStartPort(ipPermission.getFromPort()), ruleEndPort(ipPermission.getToPort())))) { sgApi.get().deleteRule(rule.getId()); } } } return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode()); }

Target:
public SecurityGroup removeIpPermission(IpPermission ipPermission, SecurityGroup group) { String zone = group.getLocation().getId(); String id = group.getId(); Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone); if (!sgApi.isPresent()) { return null; } org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroup = sgApi.get().get(id); if (ipPermission.getCidrBlocks().size() > 0) { for (String cidr : ipPermission.getCidrBlocks()) { for (SecurityGroupRule rule : filter(securityGroup.getRules(), and(ruleCidr(cidr), ruleProtocol(ipPermission.getIpProtocol()), ruleStartPort(ipPermission.getFromPort()), ruleEndPort(ipPermission.getToPort())))) { sgApi.get().deleteRule(rule.getId()); } } } if (ipPermission.getGroupIds().size() > 0) { for (String groupId : ipPermission.getGroupIds()) { for (SecurityGroupRule rule : filter(securityGroup.getRules(), and(ruleGroup(groupId), ruleProtocol(ipPermission.getIpProtocol()), ruleStartPort(ipPermission.getFromPort()), ruleEndPort(ipPermission.getToPort())))) { sgApi.get().deleteRule(rule.getId()); } } } return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode()); }
Source:
private void checkQueueSize() { int queueSize = workQueue.size(); if (queueSize >= WORK_QUEUE_SIZE_WARNING_THRESHOLD) { logger.warn("The Gerrit-trigger incoming events queue contains items!" + " Something might be stuck, or your system can't process the commands fast enough." + " Try to increase the number of receiving worker threads on the Gerrit configuration page." + " Current thread-pool size: {}", queueSize, workers.size()); } }

Target:
private void checkQueueSize() { int queueSize = workQueue.size(); if (WORK_QUEUE_SIZE_WARNING_THRESHOLD > 0 && queueSize >= WORK_QUEUE_SIZE_WARNING_THRESHOLD) { logger.warn("The Gerrit incoming events queue contains items!" + " Something might be stuck, or your system can't process the commands fast enough." + " Try to increase the number of receiving worker threads." + " Current thread-pool size: {}", queueSize, workers.size()); } }
Source:
public void visitVariableIdentifier(VariableIdentifierTree tree) { if (isMemberAccess(tree)) { return; } String lowerCaseName = tree.text().toLowerCase(Locale.ROOT); if (!PREDEFINED_VARIABLES.contains(lowerCaseName)) { if (isReadAccess(tree)) { if (!firstVariableReadAccess.containsKey(lowerCaseName)) { firstVariableReadAccess.put(lowerCaseName, tree); } } else { initializedVariables.add(lowerCaseName); } } }

Target:
public void visitVariableIdentifier(VariableIdentifierTree tree) { if (isClassMemberAccess(tree) || uninitializedVariableDeclaration(tree)) { return; } String name = tree.text(); if (!PREDEFINED_VARIABLES.contains(name)) { if (isReadAccess(tree)) { if (!firstVariableReadAccess.containsKey(name)) { firstVariableReadAccess.put(name, tree); } } else { initializedVariables.add(name); } } }
Source:
private UserList getUserListFromService(){ UserList activeUsers = new UserList(); UserListService userService = getUserListService(); if(userService != null){ return userService.getUserList(); } else { Log.i(TAG, "UserListService null, returning empty userlist"); } return activeUsers; }

Target:
private UserList getUserListFromService(){ UserList activeUsers; UserListService userService = getUserListService(); if(userService != null){ activeUsers = userService.getUserList(); } else { activeUsers = new UserList(); Log.i(TAG, "UserListService null, returning empty userlist"); } return activeUsers; }
Source:
public Map<String, Object> toSoyData(Paginator paginator, @Nullable String revision, DateFormatter df) throws IOException { Map<String, Object> data = Maps.newHashMapWithExpectedSize(3); List<Map<String, Object>> entries = Lists.newArrayListWithCapacity(paginator.getLimit()); for (RevCommit c : paginator) { if (verbose) { entries.add(new CommitSoyData().setRevWalk(paginator.getWalk()).toSoyData(req, c, VERBOSE_FIELDS, df)); } else { entries.add(new CommitSoyData().toSoyData(req, c, FIELDS, df)); } } data.put("entries", entries); ObjectId next = paginator.getNextStart(); if (next != null) { data.put("nextUrl", copyAndCanonicalize(view, revision) .replaceParam(LogServlet.START_PARAM, next.name()) .toUrl()); } ObjectId prev = paginator.getPreviousStart(); if (prev != null) { GitilesView.Builder prevView = copyAndCanonicalize(view, revision); if (!prevView.getRevision().getId().equals(prev)) { prevView.replaceParam(LogServlet.START_PARAM, prev.name()); } data.put("previousUrl", prevView.toUrl()); } return data; }

Target:
public Map<String, Object> toSoyData(Paginator paginator, @Nullable String revision, DateFormatter df) throws IOException { Map<String, Object> data = Maps.newHashMapWithExpectedSize(3); List<Map<String, Object>> entries = Lists.newArrayListWithCapacity(paginator.getLimit()); for (RevCommit c : paginator) { Set<Field> fs = verbose ? VERBOSE_FIELDS : FIELDS; entries.add(new CommitSoyData().setRevWalk(paginator.getWalk()).toSoyData(req, c, fs, df)); } data.put("entries", entries); ObjectId next = paginator.getNextStart(); if (next != null) { data.put("nextUrl", copyAndCanonicalize(view, revision) .replaceParam(LogServlet.START_PARAM, next.name()) .toUrl()); } ObjectId prev = paginator.getPreviousStart(); if (prev != null) { GitilesView.Builder prevView = copyAndCanonicalize(view, revision); if (!prevView.getRevision().getId().equals(prev)) { prevView.replaceParam(LogServlet.START_PARAM, prev.name()); } data.put("previousUrl", prevView.toUrl()); } return data; }
Source:
private void recycle() { long now = System.currentTimeMillis(); long activeConnectionTTL = options.getActiveConnectionTTL() * 1000 - (now - initialTimestamp); long keepAliveTTL = now + keepAliveTimeout * 1000; long expiration = keepAliveTimeout == 0 || (options.isActiveConnectionTTL() && activeConnectionTTL <= 0) ? 0L : options.isActiveConnectionTTL() ? Math.min(keepAliveTTL, now + activeConnectionTTL) : keepAliveTTL ; listener.onRecycle(expiration); }

Target:
private void recycle() { expirationTimestamp = keepAliveTimeout == 0 ? 0L : System.currentTimeMillis() + keepAliveTimeout * 1000; listener.onRecycle(); }
Source:
protected void modifyDisk(long hostId, Instance instance, boolean add) { CacheManager cm = CacheManager.getCacheManagerInstance(this.objectManager); InstanceInfo instanceInfo = cm.getInstanceInfoForHost(hostId, instance.getId()); for (Entry<String, InstanceDiskReserveInfo> entry : instanceInfo.getAllReservedDisksInfo()) { String diskDevicePath = entry.getKey(); InstanceDiskReserveInfo reserveInfo = entry.getValue(); Long reserveSize = reserveInfo.getReservedSize(); DiskInfo diskInfo = cm.getDiskInfoForHost(hostId, diskDevicePath); Long allocated = diskInfo.getAllocatedSize(); if (add && (diskInfo.getCapacity() - allocated >= reserveSize)) { diskInfo.addAllocatedSize(reserveSize); log.info("allocated disk space on disk with total = {}, = as used", diskInfo.getDiskDevicePath(), diskInfo.getCapacity(), allocated, "+", reserveSize, allocated + reserveSize); reserveInfo.setAllocated(true); } else if (!add && reserveInfo.isAllocated() && allocated >= reserveSize) { diskInfo.freeAllocatedSize(reserveSize); log.info("freed disk space on disk with total = {}, = as used", diskInfo.getDiskDevicePath(), diskInfo.getCapacity(), allocated, "-", reserveSize, allocated - reserveSize); instanceInfo.releaseDisk(reserveInfo); } } }

Target:
protected void modifyDisk(long hostId, Instance instance, boolean add) { CacheManager cm = CacheManager.getCacheManagerInstance(this.objectManager); HostInfo hostInfo = cm.getHostInfo(hostId, false); if (hostInfo == null) { return; } InstanceInfo instanceInfo = hostInfo.getInstanceInfo(instance.getId()); if (instanceInfo == null) { return; } if (add) { Map<Pair<String, Long>, DiskInfo> volumeToDiskMapping = AllocatorUtils.allocateDiskForVolumes(hostId, instance, this.objectManager); if (volumeToDiskMapping == null) { return; } for (Entry<Pair<String, Long>, DiskInfo> mapping : volumeToDiskMapping.entrySet()) { Pair<String, Long> vol = mapping.getKey(); DiskInfo disk = mapping.getValue(); Long allocated = disk.getAllocatedSize(); disk.addAllocatedSize(vol.getRight()); log.info("allocated disk space on disk with total = {}, = as used", disk.getDiskDevicePath(), disk.getCapacity(), allocated, "+", vol.getRight(), allocated + vol.getRight()); instanceInfo.addReservedSize(disk.getDiskDevicePath(), vol.getRight()); } } else { for (Entry<String, Long> diskAllocated : instanceInfo.getAllocatedDisks()) { String diskDevicePath = diskAllocated.getKey(); Long reserveSize = diskAllocated.getValue(); DiskInfo diskInfo = hostInfo.getDiskInfo(diskDevicePath); diskInfo.freeAllocatedSize(reserveSize); log.info("freed disk space on disk with total = {}, = as used", diskInfo.getDiskDevicePath(), diskInfo.getCapacity(), diskInfo.getAllocatedSize(), "-", reserveSize, diskInfo.getAllocatedSize() - reserveSize); instanceInfo.releaseDisk(diskDevicePath); } } }
Source:
public boolean isIdentityProvider() { try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES); for (ActivityInfo activityInfo : packageInfo.activities) { if (activityInfo.name.equals(IDPAccountPickerActivity.class.getName())) { return true; } } } catch (NameNotFoundException e) { SalesforceSDKLogger.e(TAG, "Exception occurred while examining application info", e); } return false; }

Target:
private boolean isIdentityProvider() { try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES); for (ActivityInfo activityInfo : packageInfo.activities) { if (activityInfo.name.equals(IDPAccountPickerActivity.class.getName())) { return true; } } } catch (NameNotFoundException e) { SalesforceSDKLogger.e(TAG, "Exception occurred while examining application info", e); } return false; }
Source:
public DarkClusterStrategy getOrCreate(@Nonnull String darkClusterName, @Nonnull DarkClusterConfig darkClusterConfig) { if (!_darkStrategyMap.containsKey(darkClusterName)) { _darkStrategyMap.putIfAbsent(darkClusterName, new AtomicReference<>(createStrategy(darkClusterName, darkClusterConfig))); } return _darkStrategyMap.getOrDefault(darkClusterName, new AtomicReference<DarkClusterStrategy>(new NoOpDarkClusterStrategy())).get(); }

Target:
public DarkClusterStrategy getOrCreate(@Nonnull String darkClusterName, @Nonnull DarkClusterConfig darkClusterConfig) { if (!_darkStrategyMap.containsKey(darkClusterName)) { _darkStrategyMap.putIfAbsent(darkClusterName, createStrategy(darkClusterName, darkClusterConfig)); } return _darkStrategyMap.getOrDefault(darkClusterName, NO_OP_DARK_CLUSTER_STRATEGY); }
Source:
private SSHClient create(@NonNull String url) { String host = url.substring(url.lastIndexOf('@')+1, url.lastIndexOf(':')); int port = Integer.parseInt(url.substring(url.lastIndexOf(':')+1)); String authString = url.substring(SSH_URI_PREFIX.length(), url.lastIndexOf('@')); String[] userInfo = authString.split(":"); String username = userInfo[0]; String password = userInfo.length > 1 ? userInfo[1] : null; if(port < 0) port = SSH_DEFAULT_PORT; UtilsHandler utilsHandler = AppConfig.getInstance().getUtilsHandler(); String pem = utilsHandler.getSshAuthPrivateKey(url); AtomicReference<KeyPair> keyPair = new AtomicReference<>(null); if(pem != null && !pem.isEmpty()) { try { CountDownLatch latch = new CountDownLatch(1); new PemToKeyPairTask(pem, result -> { if (result.result != null) { keyPair.set(result.result); latch.countDown(); } }).execute(); latch.await(); } catch(InterruptedException e) { throw new RuntimeException(e); } } String hostKey = utilsHandler.getSshHostKey(url); if(hostKey == null) return null; return create(host, port, hostKey, username, password, keyPair.get()); }

Target:
private SSHClient create(@NonNull String url) { ConnectionInfo connInfo = new ConnectionInfo(url); UtilsHandler utilsHandler = AppConfig.getInstance().getUtilsHandler(); String pem = utilsHandler.getSshAuthPrivateKey(url); AtomicReference<KeyPair> keyPair = new AtomicReference<>(null); if(pem != null && !pem.isEmpty()) { try { CountDownLatch latch = new CountDownLatch(1); new PemToKeyPairTask(pem, result -> { if (result.result != null) { keyPair.set(result.result); latch.countDown(); } }).execute(); latch.await(); } catch(InterruptedException e) { throw new RuntimeException(e); } } String hostKey = utilsHandler.getSshHostKey(url); if(hostKey == null) return null; return create(connInfo.host, connInfo.port, hostKey, connInfo.username, connInfo.password, keyPair.get()); }
Source:
public void addProxy(ProxiesParamProxy proxy) { if (this.getAdditionalProxy(proxy.getAddress(), proxy.getPort()) != null) { throw new IllegalArgumentException("Proxy already exists"); } if (!this.canListenOn(proxy.getAddress(), proxy.getPort())) { throw new IllegalArgumentException("Cannot listen on address:port"); } ProxyServer proxyServer = startProxyServer(proxy.getAddress(), proxy.getPort()); proxyServers.put(proxy.getAddress() + proxy.getPort(), proxyServer); this.getParam().addProxy(proxy); }

Target:
public void addProxy(ProxiesParamProxy proxy) { if (this.getAdditionalProxy(proxy.getAddress(), proxy.getPort()) != null) { throw new IllegalArgumentException("Proxy already exists " + proxy.getAddress() + ":" + proxy.getPort()); } if (!this.canListenOn(proxy.getAddress(), proxy.getPort())) { throw new IllegalArgumentException("Cannot listen on " + proxy.getAddress() + ":" + proxy.getPort()); } ProxyServer proxyServer = startProxyServer(proxy.getAddress(), proxy.getPort()); proxyServers.put(proxy.getAddress() + proxy.getPort(), proxyServer); this.getParam().addProxy(proxy); }
Source:
public void testUpdate() throws OrmException, FileNotFoundException { db.create(); final File site = new File(UUID.randomUUID().toString()); final SitePaths paths = new SitePaths(site); SchemaUpdater u = Guice.createInjector(new AbstractModule() { @Override protected void configure() { bind(new TypeLiteral<SchemaFactory<ReviewDb>>() {}).toInstance(db); bind(SitePaths.class).toInstance(paths); install(new SchemaVersion.Module()); } }).getInstance(SchemaUpdater.class); u.update(new UpdateUI() { @Override public void message(String msg) { } @Override public boolean yesno(boolean def, String msg) { return true; } @Override public void pruneSchema(StatementExecutor e, List<String> pruneList) throws OrmException { for (String sql : pruneList) { e.execute(sql); } } }); db.assertSchemaVersion(); final SystemConfig sc = db.getSystemConfig(); assertEquals(paths.site_path.getAbsolutePath(), sc.sitePath); }

Target:
public void testUpdate() throws OrmException, FileNotFoundException { db.create(); final File site = new File(UUID.randomUUID().toString()); final SitePaths paths = new SitePaths(site); SchemaUpdater u = Guice.createInjector(new AbstractModule() { @Override protected void configure() { bind(new TypeLiteral<SchemaFactory<ReviewDb>>() {}).toInstance(db); bind(SitePaths.class).toInstance(paths); install(new SchemaVersion.Module()); } }).getInstance(SchemaUpdater.class); u.update(new UpdateUI() { @Override public void message(String msg) { } @Override public boolean yesno(boolean def, String msg) { return def; } @Override public void pruneSchema(StatementExecutor e, List<String> pruneList) throws OrmException { for (String sql : pruneList) { e.execute(sql); } } }); db.assertSchemaVersion(); final SystemConfig sc = db.getSystemConfig(); assertEquals(paths.site_path.getAbsolutePath(), sc.sitePath); }
Source:
public void treeForEmptyNavigationTest() { LayoutTemplate lt1 = new LayoutTemplate("lt1"); LayoutTemplate lt2 = new LayoutTemplate("lt2"); LayoutTemplate lt3 = new LayoutTemplate("lt3"); List<LayoutTemplate> templates = new ArrayList<>(); templates.add(lt1); templates.add(lt2); templates.add(lt3); NavTree runtimeTree = runtimeNavigationBuilder.build(Optional.empty(), templates); NavGroup orphanItemsGroup = (NavGroup) runtimeTree.getItemById(RuntimeNavigationBuilder.ORPHAN_GROUP_ID); assertNotNull(orphanItemsGroup); assertEquals(3, orphanItemsGroup.getChildren().size()); assertTrue(containsLayoutTemplate(orphanItemsGroup, lt1)); assertTrue(containsLayoutTemplate(orphanItemsGroup, lt2)); assertTrue(containsLayoutTemplate(orphanItemsGroup, lt3)); }

Target:
public void treeForEmptyNavigationTest() { LayoutTemplate lt1 = new LayoutTemplate("lt1"); LayoutTemplate lt2 = new LayoutTemplate("lt2"); LayoutTemplate lt3 = new LayoutTemplate("lt3"); List<LayoutTemplate> templates = Arrays.asList(lt1, lt2, lt3); NavTree runtimeTree = runtimeNavigationBuilder.build(Optional.empty(), templates); NavGroup orphanItemsGroup = (NavGroup) runtimeTree.getItemById(RuntimeNavigationBuilder.ORPHAN_GROUP_ID); assertNotNull(orphanItemsGroup); assertEquals(3, orphanItemsGroup.getChildren().size()); assertTrue(containsLayoutTemplate(orphanItemsGroup, lt1)); assertTrue(containsLayoutTemplate(orphanItemsGroup, lt2)); assertTrue(containsLayoutTemplate(orphanItemsGroup, lt3)); }
Source:
public void testMismatchBisulfiteCounts(final String readString, final String cigar, final String reference, final boolean positiveStrand, final int expectedMismatches) { final byte baseQuality = 30; final SAMRecord rec = new SAMRecord(null); rec.setReadName("test"); rec.setReadString(readString); rec.setReadNegativeStrandFlag(!positiveStrand); final byte[] byteArray = new byte[readString.length()]; for(int i = 0; i < readString.length();i++){ byteArray[i]=baseQuality; } rec.setBaseQualities(byteArray); rec.setCigarString(cigar); final byte[] refBases = StringUtil.stringToBytes(reference); final int nExact = SequenceUtil.countMismatches(rec, refBases, -1, true, false); Assert.assertEquals(nExact, expectedMismatches); final int sumMismatchesQualityExact = SequenceUtil.sumQualitiesOfMismatches(rec, refBases, -1, true); Assert.assertEquals(sumMismatchesQualityExact, expectedMismatches * baseQuality); }

Target:
public void testMismatchBisulfiteCounts(final String readString, final String cigar, final String reference, final boolean positiveStrand, final int expectedMismatches) { final byte baseQuality = 30; final SAMRecord rec = new SAMRecord(null); rec.setReadName("test"); rec.setReadString(readString); rec.setReadNegativeStrandFlag(!positiveStrand); final byte[] byteArray = new byte[readString.length()]; Arrays.fill(byteArray,baseQuality); rec.setBaseQualities(byteArray); rec.setCigarString(cigar); final byte[] refBases = StringUtil.stringToBytes(reference); final int nExact = SequenceUtil.countMismatches(rec, refBases, -1, true, false); Assert.assertEquals(nExact, expectedMismatches); final int sumMismatchesQualityExact = SequenceUtil.sumQualitiesOfMismatches(rec, refBases, -1, true); Assert.assertEquals(sumMismatchesQualityExact, expectedMismatches * baseQuality); }
Source:
protected void meetSP(final StatementPattern node) throws Exception { final URI pred = (URI) node.getPredicateVar().getValue(); final Var obj = node.getObjectVar(); final StatementPattern clone = node.clone(); if(pred.equals(RDF.TYPE) && obj.isConstant()) { for (final URI property : inferenceEngine.getHasSelfImplyingType((URI) obj.getValue())) { final InferUnion union = new InferUnion(clone, new StatementPattern(clone.getSubjectVar(), new Var("p", property), clone.getSubjectVar())); node.replaceWith(union); } } else if (node.getPredicateVar().isConstant() && (!node.getSubjectVar().isConstant() || !node.getObjectVar().isConstant())) { for (final Resource type : inferenceEngine.getHasSelfImplyingProperty(pred)) { final Extension extension; if(obj.isConstant()) { extension = new Extension(new StatementPattern(obj, TYPE_VAR, obj), new ExtensionElem(obj, "o")); } else { extension = new Extension(new StatementPattern(node.getSubjectVar(), TYPE_VAR, new Var("o", type)), new ExtensionElem(node.getSubjectVar(), obj.getName())); } final InferUnion union = new InferUnion(extension, clone); node.replaceWith(union); } } }

Target:
protected void meetSP(final StatementPattern node) throws Exception { final URI pred = (URI) node.getPredicateVar().getValue(); final Var obj = node.getObjectVar(); final StatementPattern clone = node.clone(); if (RDF.TYPE.equals(pred) && obj.isConstant()) { if (obj.getValue() instanceof URI) { for (final URI property : inferenceEngine.getHasSelfImplyingType((URI) obj.getValue())) { final InferUnion union = new InferUnion(clone, new StatementPattern(clone.getSubjectVar(), new Var(property.stringValue(), property), clone.getSubjectVar())); node.replaceWith(union); } } } else if (node.getPredicateVar().isConstant() && (!node.getSubjectVar().isConstant() || !node.getObjectVar().isConstant())) { for (final Resource type : inferenceEngine.getHasSelfImplyingProperty(pred)) { final Extension extension; if(obj.isConstant()) { extension = new Extension( new StatementPattern(obj, TYPE_VAR, new Var(type.stringValue(), type)), new ExtensionElem(obj, node.getSubjectVar().getName())); } else { extension = new Extension( new StatementPattern(node.getSubjectVar(), TYPE_VAR, new Var(type.stringValue(), type)), new ExtensionElem(node.getSubjectVar(), obj.getName())); } final InferUnion union = new InferUnion(extension, clone); node.replaceWith(union); } } }
Source:
private void populateDupCandidates(List<PairedReadSequence> seqs) { readsByHashInGroup.clear(); for (PairedReadSequence prs : seqs) { int[][] readHashValues = {prs.hashes1, prs.hashes2}; for (int[] readHashValue : readHashValues) { for (int key : readHashValue) { List<PairedReadSequence> dupCandidates = readsByHashInGroup.computeIfAbsent(key, k -> new ArrayList<>()); dupCandidates.add(prs); } } } }

Target:
private void populateDupCandidates(List<PairedReadSequence> seqs) { readsByHashInGroup.clear(); for (PairedReadSequence prs : seqs) { int[][] readHashValues = {prs.hashes1, prs.hashes2}; for (int[] readHashValue : readHashValues) { for (int key : readHashValue) { final List<PairedReadSequence> dupCandidates = readsByHashInGroup.computeIfAbsent(key, k -> new ArrayList<>()); dupCandidates.add(prs); } } } }
Source:
protected String extractErrorMessageForbidden(AccessToken accessToken) { return "Insufficient scope: " + accessToken.getScopes(); }

Target:
protected String extractErrorMessageForbidden(AccessToken accessToken) { return "Insufficient scopes: " + accessToken.getScopes(); }
Source:
public void stop() { if (workDefAdmin != null) { workDefAdmin.clearCaches(); } workDefAdmin = null; if (configCacheProvider != null) { configCacheProvider.invalidate(); configCacheProvider = null; } if (workDefCacheProvider != null) { workDefCacheProvider.invalidate(); workDefCacheProvider = null; } artifactStore = null; actionableItemFactory = null; teamDefFactory = null; versionFactory = null; }

Target:
public void stop() { if (workDefAdmin != null) { workDefAdmin.clearCaches(); } workDefAdmin = null; if (configCacheProvider != null) { configCacheProvider.invalidate(); configCacheProvider = null; } if (workDefCacheProvider != null) { workDefCacheProvider.invalidate(); workDefCacheProvider = null; } versionService = null; artifactStore = null; actionableItemFactory = null; teamDefFactory = null; versionFactory = null; }
Source:
public void setData(@Nullable ISegmentStoreProvider provider) { fSegmentProvider = provider; if (provider == null) { updateModel(null); return; } createProviderColumns(); ISegmentStore<ISegment> segStore = provider.getSegmentStore(); Map<@NonNull Integer, @NonNull Predicate<@NonNull Map<@NonNull String, @NonNull String>>> predicates = computeRegexPredicate(); Predicate<ISegment> predicate = (segment) -> { if (!predicates.isEmpty()) { Map<@NonNull String, @NonNull String> input = getFilterInput(segment, provider); boolean activateProperty = false; for (Map.Entry<Integer, Predicate<Map<String, String>>> mapEntry : predicates.entrySet()) { Integer property = Objects.requireNonNull(mapEntry.getKey()); Predicate<Map<String, String>> value = Objects.requireNonNull(mapEntry.getValue()); if (property == IFilterProperty.DIMMED) { boolean status = value.test(input); activateProperty |= status; } } return activateProperty; } return true; }; if (segStore != null) { if (!predicates.isEmpty()) { updateModel(segStore); } else { Collection<ISegment> filtered = Collections2.filter(segStore, seg -> predicate.test(seg)); ISegmentStore<ISegment> filteredStore = new ArrayListStore<>(filtered.toArray(new ISegment[filtered.size()])); updateModel(filteredStore); return; } } updateModel(null); SegmentStoreProviderProgressListener listener = fListener; if (listener != null) { provider.addListener(listener); } if (provider instanceof IAnalysisModule) { ((IAnalysisModule) provider).schedule(); } }

Target:
public void setData(@Nullable ISegmentStoreProvider provider) { fSegmentProvider = provider; if (provider == null) { updateModel(null); return; } createProviderColumns(); ISegmentStore<ISegment> segStore = provider.getSegmentStore(); Map<@NonNull Integer, @NonNull Predicate<@NonNull Map<@NonNull String, @NonNull String>>> predicates = computeRegexPredicate(); Predicate<ISegment> predicate = (segment) -> { if (!predicates.isEmpty()) { Map<@NonNull String, @NonNull String> input = getFilterInput(segment, provider); boolean activateProperty = false; for (Map.Entry<Integer, Predicate<Map<String, String>>> mapEntry : predicates.entrySet()) { Integer property = Objects.requireNonNull(mapEntry.getKey()); Predicate<Map<String, String>> value = Objects.requireNonNull(mapEntry.getValue()); if (property == IFilterProperty.DIMMED) { boolean status = value.test(input); activateProperty |= status; } } return activateProperty; } return true; }; if (segStore != null) { if (predicates.isEmpty()) { updateModel(segStore); return; } Collection<ISegment> filtered = Collections2.filter(segStore, seg -> predicate.test(seg)); ISegmentStore<ISegment> filteredStore = new ArrayListStore<>(filtered.toArray(new ISegment[filtered.size()])); updateModel(filteredStore); return; } updateModel(null); SegmentStoreProviderProgressListener listener = fListener; if (listener != null) { provider.addListener(listener); } if (provider instanceof IAnalysisModule) { ((IAnalysisModule) provider).schedule(); } }
Source:
void updateColumns() { ProjectId id = createId(42); TestProcessManagerRepository repository = repository(); TestProcessManager pm = new TestProcessManager(id); repository.store(pm); TargetFilters targetFilters = targetFilters(Project.Column.idString(), id.toString()); Iterator<TestProcessManager> found = repository.find(targetFilters, ResponseFormat.getDefaultInstance()); assertThat(found.hasNext()).isFalse(); repository.applyMigration(id, new UpdatePmColumns<>()); Iterator<TestProcessManager> afterMigration = repository.find(targetFilters, ResponseFormat.getDefaultInstance()); assertThat(afterMigration.hasNext()).isTrue(); TestProcessManager entityWithColumns = afterMigration.next(); assertThat(entityWithColumns.state() .getIdString()).isEqualTo(id.toString()); }

Target:
void updateColumns() { ProjectId id = createId(42); TestProcessManagerRepository repository = repository(); TestProcessManager pm = new TestProcessManager(id); repository.store(pm); TargetFilters targetFilters = targetFilters(Project.Column.idString(), id.toString()); Iterator<TestProcessManager> found = repository.find(targetFilters, ResponseFormat.getDefaultInstance()); assertThat(found.hasNext()).isFalse(); repository.applyMigration(id, new UpdatePmColumns<>()); Iterator<TestProcessManager> afterMigration = repository.find(targetFilters, ResponseFormat.getDefaultInstance()); assertThat(afterMigration.hasNext()).isTrue(); TestProcessManager entityWithColumns = afterMigration.next(); Project expectedState = pm .state() .toBuilder() .setIdString(pm.getIdString()) .build(); assertThat(entityWithColumns.state()).isEqualTo(expectedState); }
Source:
public void testExecute_invalidRecommendedLength_shouldThrowException() { InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); FeedbackSessionAttributes session = typicalBundle.feedbackSessions.get("session1InCourse1"); FeedbackQuestionAttributes typicalQuestion = logic.getFeedbackQuestion(session.getFeedbackSessionName(), session.getCourseId(), 1); loginAsInstructor(instructor1ofCourse1.getGoogleId()); String[] param = new String[] { Const.ParamsNames.FEEDBACK_QUESTION_ID, typicalQuestion.getFeedbackQuestionId(), }; FeedbackQuestionSaveRequest saveRequest = getTypicalTextQuestionSaveRequest(); FeedbackTextQuestionDetails textQuestionDetails = new FeedbackTextQuestionDetails(); textQuestionDetails.setRecommendedLength(-1); saveRequest.setQuestionDetails(textQuestionDetails); SaveFeedbackQuestionAction a = getAction(saveRequest, param); assertThrows(InvalidHttpRequestBodyException.class, () -> { getJsonResult(a); }); assertEquals(typicalQuestion.getQuestionDescription(), logic.getFeedbackQuestion(typicalQuestion.getId()).getQuestionDescription()); }

Target:
public void testExecute_invalidRecommendedLength_shouldThrowException() { InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); FeedbackSessionAttributes session = typicalBundle.feedbackSessions.get("session1InCourse1"); FeedbackQuestionAttributes typicalQuestion = logic.getFeedbackQuestion(session.getFeedbackSessionName(), session.getCourseId(), 1); loginAsInstructor(instructor1ofCourse1.getGoogleId()); String[] param = new String[] { Const.ParamsNames.FEEDBACK_QUESTION_ID, typicalQuestion.getFeedbackQuestionId(), }; FeedbackQuestionSaveRequest saveRequest = getTypicalTextQuestionSaveRequest(); FeedbackTextQuestionDetails textQuestionDetails = new FeedbackTextQuestionDetails(); textQuestionDetails.setRecommendedLength(-1); saveRequest.setQuestionDetails(textQuestionDetails); SaveFeedbackQuestionAction a = getAction(saveRequest, param); assertThrows(InvalidHttpRequestBodyException.class, () -> getJsonResult(a)); assertEquals(typicalQuestion.getQuestionDescription(), logic.getFeedbackQuestion(typicalQuestion.getId()).getQuestionDescription()); assertEquals(0, ((FeedbackTextQuestionDetails) typicalQuestion.getQuestionDetails()) .getRecommendedLength()); }
Source:
public void updated(Dictionary<String, ?> properties) throws ConfigurationException { logger.debug("update start"); try { setProperlyConfigured(false); for (FatekPLCSlave slave : slaves.values()) { try { slave.disconnect(); } catch (FatekIOException e) { logger.warn("diconnect", e); } } slaves.clear(); refreshInterval = getLongProperty(properties, "refresh", refreshInterval); Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if (GLOBAL_CONFIG_NAMES.contains(key)) { continue; } String keyItems[] = key.split("\\."); if (keyItems.length != 2) { throw new ConfigurationException(key, "incorrect format, should be slave.property"); } FatekPLCSlave slave = slaves.get(keyItems[0]); if (slave == null) { slave = new FatekPLCSlave(keyItems[0], eventPublisher, itemRegistry); slaves.put(slave.getName(), slave); } slave.configure(keyItems[1], properties.get(key)); } } catch (ConfigurationException e) { logger.error("", e); throw e; } setProperlyConfigured(true); logger.info("Configuration has been updated, refresh={}", refreshInterval); }

Target:
public void updated(Dictionary<String, ?> properties) throws ConfigurationException { logger.debug("update start"); try { for (FatekPLCSlave slave : slaves.values()) { try { slave.disconnect(); } catch (FatekIOException e) { logger.warn("diconnect", e); } } slaves.clear(); refreshInterval = getLongProperty(properties, "refresh", refreshInterval); Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if (GLOBAL_CONFIG_NAMES.contains(key)) { continue; } String keyItems[] = key.split("\\."); if (keyItems.length != 2) { throw new ConfigurationException(key, "incorrect format, should be slave.property"); } FatekPLCSlave slave = slaves.get(keyItems[0]); if (slave == null) { slave = new FatekPLCSlave(keyItems[0], eventPublisher); slaves.put(slave.getName(), slave); } slave.configure(keyItems[1], properties.get(key)); } } catch (ConfigurationException e) { logger.error("", e); throw e; } setProperlyConfigured(true); logger.info("Configuration has been updated, refresh={}", refreshInterval); }
Source:
public void testShowColumnsFromPartitions() { String tableName = "test_show_columns_from_partitions"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "(" + " foo VARCHAR," + " part1 BIGINT," + " part2 VARCHAR" + ") " + "WITH (" + "partitioned_by = ARRAY[ 'part1', 'part2' ]" + ") "; assertUpdate(getSession(), createTable); assertQuery( getSession(), "SHOW COLUMNS FROM \"" + tableName + "$partitions\"", "VALUES ('part1', 'bigint', '', ''), ('part2', 'varchar', '', '')"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"$partitions\"", ".*Table '.*.tpch\\.\\$partitions' does not exist"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"orders$partitions\"", ".*Table '.*\\.tpch\\.orders\\$partitions' does not exist"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"blah$partitions\"", ".*Table '.*.tpch\\.blah\\$partitions' does not exist"); }

Target:
public void testShowColumnsFromPartitions() { String tableName = "test_show_columns_from_partitions"; @Language("SQL") String createTable = "" + "CREATE TABLE " + tableName + " " + "(" + " foo VARCHAR," + " part1 BIGINT," + " part2 VARCHAR" + ") " + "WITH (" + "partitioned_by = ARRAY[ 'part1', 'part2' ]" + ") "; assertUpdate(getSession(), createTable); assertQuery( getSession(), "SHOW COLUMNS FROM \"" + tableName + "$partitions\"", "VALUES ('part1', 'bigint', '', ''), ('part2', 'varchar', '', '')"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"$partitions\"", ".*Table '.*\\.tpch\\.\\$partitions' does not exist"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"orders$partitions\"", ".*Table '.*\\.tpch\\.orders\\$partitions' does not exist"); assertQueryFails( getSession(), "SHOW COLUMNS FROM \"blah$partitions\"", ".*Table '.*\\.tpch\\.blah\\$partitions' does not exist"); }
Source:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); MyqBindingConfig config = parseBindingConfig(item, bindingConfig); addBindingConfig(item, config); }

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { MyqBindingConfig config = parseBindingConfig(item, bindingConfig); addBindingConfig(item, config); super.processBindingConfiguration(context, item, bindingConfig); }
Source:
public void testNegativePositionsAreAllowed() { final GridPosition initialGridPosition = new GridPosition(-1, -1); final Orientation initialOrientation = Orientation.SOUTH; final Robot robot = new Robot(initialGridPosition, Orientation.SOUTH); assertEquals(robot.getOrientation(), initialOrientation); assertEquals(robot.getGridPosition(), initialGridPosition); }

Target:
public void testNegativePositionsAreAllowed() { final GridPosition initialGridPosition = new GridPosition(-1, -1); final Orientation initialOrientation = Orientation.SOUTH; final Robot robot = new Robot(initialGridPosition, initialOrientation); assertEquals(robot.getOrientation(), initialOrientation); assertEquals(robot.getGridPosition(), initialGridPosition); }
Source:
private boolean hasActualVideo() { if (mVideoTrackCount > 0) { return true; } VideoSize videoSize = mPlayer.getVideoSize(); if (videoSize.getHeight() > 0 && videoSize.getWidth() > 0) { Log.w(TAG, "video track count is zero, but it renders video. size: " + videoSize.getWidth() + "/" + videoSize.getHeight()); return true; } return false; }

Target:
private boolean hasActualVideo() { if (mVideoTrackCount > 0) { return true; } VideoSize videoSize = mPlayer.getVideoSize(); if (videoSize.getHeight() > 0 && videoSize.getWidth() > 0) { Log.w(TAG, "video track count is zero, but it renders video. size: " + videoSize); return true; } return false; }
Source:
private boolean runTaskOnWorker( final HttpRemoteTaskRunnerWorkItem workItem, final String workerHost ) throws Exception { String taskId = workItem.getTaskId(); WorkerHolder workerHolder = workers.get(workerHost); if (workerHolder == null || lazyWorkers.containsKey(workerHost) || blackListedWorkers.containsKey(workerHost)) { log.info("Not assigning task[%s] to removed or marked lazy/blacklisted worker[%s]", taskId, workerHost); return false; } log.info("Asking Worker[%s] to run task[%s]", workerHost, taskId); if (workerHolder.assignTask(workItem.getTask())) { long waitMs = config.getTaskAssignmentTimeout().toStandardDuration().getMillis(); long waitStart = System.currentTimeMillis(); boolean isTaskAssignmentTimedout = false; synchronized (statusLock) { while (tasks.containsKey(taskId) && tasks.get(taskId).getState() == HttpRemoteTaskRunnerWorkItem.State.PENDING) { long remaining = waitMs - (System.currentTimeMillis() - waitStart); if (remaining > 0) { statusLock.wait(remaining); } else { isTaskAssignmentTimedout = true; break; } } } if (isTaskAssignmentTimedout) { log.makeAlert( "Task assignment timed out on worker [%s], never ran task [%s] in timeout[%s]!", workerHost, taskId, config.getTaskAssignmentTimeout() ).emit(); taskComplete(workItem, workerHolder, TaskStatus.failure(taskId)); } return true; } else { return false; } }

Target:
private boolean runTaskOnWorker( final HttpRemoteTaskRunnerWorkItem workItem, final String workerHost ) throws Exception { String taskId = workItem.getTaskId(); WorkerHolder workerHolder = workers.get(workerHost); if (workerHolder == null || lazyWorkers.containsKey(workerHost) || blackListedWorkers.containsKey(workerHost)) { log.info("Not assigning task[%s] to removed or marked lazy/blacklisted worker[%s]", taskId, workerHost); return false; } log.info("Asking Worker[%s] to run task[%s]", workerHost, taskId); if (workerHolder.assignTask(workItem.getTask())) { long waitMs = config.getTaskAssignmentTimeout().toStandardDuration().getMillis(); long waitStart = System.currentTimeMillis(); boolean isTaskAssignmentTimedOut = false; synchronized (statusLock) { while (tasks.containsKey(taskId) && tasks.get(taskId).getState() == HttpRemoteTaskRunnerWorkItem.State.PENDING) { long remaining = waitMs - (System.currentTimeMillis() - waitStart); if (remaining > 0) { statusLock.wait(remaining); } else { isTaskAssignmentTimedOut = true; break; } } } if (isTaskAssignmentTimedOut) { log.makeAlert( "Task assignment timed out on worker [%s], never ran task [%s] in timeout[%s]!", workerHost, taskId, config.getTaskAssignmentTimeout() ).emit(); taskComplete(workItem, workerHolder, TaskStatus.failure(taskId)); } return true; } else { return false; } }
Source:
public Transcriber(String roomName, TranscriptionService service) { if(!service.supportsStreamRecognition()) { throw new IllegalArgumentException("Currently only services which" + " support streaming recognition are supported"); } this.transcriptionService = service; addTranscriptionListener(this.transcript); }

Target:
public Transcriber(String roomName, TranscriptionService service) { if(!service.supportsStreamRecognition()) { throw new IllegalArgumentException("Currently only services which" + " support streaming recognition are supported"); } this.transcriptionService = service; addTranscriptionListener(this.transcript); this.roomName = roomName; }
Source:
public double calculateArea() { return getBounds().calculateArea() * envelope.getArea() / polygon.getGeometry().getArea(); }

Target:
public double calculateArea() { return getBounds().calculateArea() * envelope.getArea() / prepPolygon.getGeometry().getArea(); }
Source:
private boolean layerGroupContainmentCheckRequired() { Request request = Dispatcher.REQUEST.get(); if(request == null) { return false; } final String service = request.getService(); boolean isMapService = "WMS".equalsIgnoreCase(service) || "gwc".equalsIgnoreCase(service); if(!isMapService) { return false; } return true; }

Target:
private boolean layerGroupContainmentCheckRequired() { Request request = Dispatcher.REQUEST.get(); if(request == null) { return false; } final String service = request.getService(); return "WMS".equalsIgnoreCase(service) || "gwc".equalsIgnoreCase(service); }
Source:
public FileServiceClientBuilder credential(SASTokenCredential credential) { this.sasTokenCredential = Objects.requireNonNull(credential); return this; }

Target:
public FileServiceClientBuilder credential(SASTokenCredential credential) { this.sasTokenCredential = Objects.requireNonNull(credential); this.sharedKeyCredential = null; return this; }
Source:
private boolean processConfigurationDetails(Document document) { boolean not_compatible = true; Node rootNode = document.getElementsByTagName(PARAMETER_FILE_ROOT).item(0); for (int j = 0; j < rootNode.getAttributes().getLength(); j++) { Node propertyNode = rootNode.getAttributes().item(j); switch (propertyNode.getNodeName()) { case RUN_TIME_PROPERTIES: String runTimePropertyString = propertyNode.getNodeValue(); if (!EMPTY_STRING.equals(runTimePropertyString)) { String[] properties = runTimePropertyString.split(PROPERTY_SEPERATOR); int currentIndex = 0; while (currentIndex < properties.length) { runTimeProperties.put(properties[currentIndex], properties[currentIndex + 1]); currentIndex += 2; } } break; case NOT_XSLT_COMPATIBLE: if (propertyNode.getNodeValue().equals(XSLT_COMPATIBLE_DEFAULT)) { not_compatible = false; } else { return not_compatible; } break; case FIRST_ELEMENT_OF_THE_INPUT: this.name = propertyNode.getNodeValue(); break; } } if (this.name == null) { return true; } return not_compatible; }

Target:
private boolean processConfigurationDetails(Document document) { boolean compatible = false; Node rootNode = document.getElementsByTagName(PARAMETER_FILE_ROOT).item(0); for (int j = 0; j < rootNode.getAttributes().getLength(); j++) { Node propertyNode = rootNode.getAttributes().item(j); switch (propertyNode.getNodeName()) { case RUN_TIME_PROPERTIES: String runTimePropertyString = propertyNode.getNodeValue(); if (!EMPTY_STRING.equals(runTimePropertyString)) { String[] properties = runTimePropertyString.split(PROPERTY_SEPERATOR); int currentIndex = 0; while (currentIndex < properties.length) { runTimeProperties.put(properties[currentIndex], properties[currentIndex + 1]); currentIndex += 2; } } break; case NOT_XSLT_COMPATIBLE: if (propertyNode.getNodeValue().equals(XSLT_COMPATIBLE_DEFAULT)) { compatible = true; } else { return compatible; } break; case FIRST_ELEMENT_OF_THE_INPUT: this.name = propertyNode.getNodeValue(); break; } } if (this.name == null) { return false; } return compatible; }