auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); } PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), in.line != null ? in.line : 0, rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }

Target:
public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); } else if (in.line != null && in.range != null && in.line != in.range.getEndLine()) { throw new BadRequestException("range endLine must be on the same line as the comment"); } PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), in.line != null ? in.line : 0, rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }
Source:
public int[] getActiveTransactionCount() { int[] count = new int[3]; count[0] = 0; count[1] = 0; count[2] = _txns.size(); for (TransactionLegacy txn : _txns.values()) { if (txn.getStack().size() > 0) { count[0]++; } if (txn.getCurrentConnection() != null) { count[1]++; } } return count; }

Target:
public int[] getActiveTransactionCount() { int[] count = new int[2]; count[0] = 0; count[1] = 0; for (TransactionLegacy txn : _txns.values()) { if (txn.getStack().size() > 0) { count[0]++; } if (txn.getCurrentConnection() != null) { count[1]++; } } return count; }
Source:
private boolean getUids(InputObjectState aa_uids) { synchronized (this) { try { return _recoveryStore.allObjUids(_transactionType, aa_uids); } catch (ObjectStoreException e) { if (LRALogger.logger.isTraceEnabled()) { LRALogger.logger.tracef( "LRARecoverModule: Exception %s while unpacking records of type %s", e.getMessage(), _transactionType, e); } else if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof("LRARecoverModule: Exception %s while unpacking records of type : %s", e.getMessage()); } return false; } } }

Target:
private boolean getUids(InputObjectState aa_uids) { synchronized (this) { try { return _recoveryStore.allObjUids(_transactionType, aa_uids); } catch (ObjectStoreException e) { if (LRALogger.logger.isTraceEnabled()) { LRALogger.logger.tracef(e, "LRARecoverModule: Object store exception %s while unpacking records of type %s", e.getMessage(), _transactionType); } else if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof( "LRARecoverModule: Object store exception %s while unpacking records of type %s", e.getMessage(), _transactionType); } return false; } } }
Source:
public User(String userID, String username, String preferredUsername) { super.setId(userID); super.setName(username); this.preferredUsername = preferredUsername; }

Target:
public User(String userID, String username, String preferredUsername) { super(userID, username); this.preferredUsername = preferredUsername; }
Source:
protected DataCenter postPopulate(DataCenter model) { model.setLocal(new Random().nextBoolean()); model.setStorageFormat(MappingTestHelper.shuffle(StorageFormat.class).value()); return model; }

Target:
protected DataCenter postPopulate(DataCenter model) { model.setStorageFormat(MappingTestHelper.shuffle(StorageFormat.class).value()); return model; }
Source:
protected void configureServlets() { Map<String, String> loggingFilterConfig = new HashMap<String, String>(); loggingFilterConfig.put("header.name", "x-candlepin-request-uuid"); String regex = ".*"; String noStatusResource = "/(?!status).*"; if (config.getBoolean(ConfigProperties.SWAGGER_ENABLED)) { regex = "^(?!/docs).*"; } filterRegex(regex).through(CandlepinScopeFilter.class); filterRegex(regex).through(CandlepinPersistFilter.class); filterRegex(noStatusResource).through(CandlepinSuspendModeFilter.class); filterRegex(regex).through(LoggingFilter.class, loggingFilterConfig); filterRegex(regex).through(ContentTypeHackFilter.class); filterRegex(regex).through(EventFilter.class); serveRegex(regex).with(HttpServletDispatcher.class); }

Target:
protected void configureServlets() { Map<String, String> loggingFilterConfig = new HashMap<String, String>(); loggingFilterConfig.put("header.name", "x-candlepin-request-uuid"); String regex = ".*"; if (config.getBoolean(ConfigProperties.SWAGGER_ENABLED)) { regex = "^(?!/docs).*"; } filterRegex(regex).through(CandlepinScopeFilter.class); filterRegex(regex).through(CandlepinPersistFilter.class); filterRegex(regex).through(LoggingFilter.class, loggingFilterConfig); filterRegex(regex).through(ContentTypeHackFilter.class); filterRegex(regex).through(EventFilter.class); serveRegex(regex).with(HttpServletDispatcher.class); }
Source:
public InputStream wrapInputStream(final InputStream inputStream) { try { return new SnappyInputStream(inputStream); } catch (Exception e) { throw new SAMException("Error instantiating SnappyInputStream", e); } }

Target:
public InputStream wrapInputStream(final InputStream inputStream) { if (isSnappyAvailable()) { try { return new SnappyInputStream(inputStream); } catch (Exception e) { throw new SAMException("Error instantiating SnappyInputStream", e); } } else { throw new SAMException("Snappy not available"); } }
Source:
private ZKHelixAdmin(Builder builder) throws IOException, InvalidRoutingDataException { switch (builder.realmMode) { case MULTI_REALM: _zkClient = new FederatedZkClient(builder.realmAwareZkConnectionConfig, builder.realmAwareZkClientConfig); break; case SINGLE_REALM: _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(builder.realmAwareZkConnectionConfig.createZkConnectionConfig(), builder.realmAwareZkClientConfig.createHelixZkClientConfig()); break; default: throw new HelixException("Invalid RealmMode given: " + builder.realmMode); } _configAccessor = new ConfigAccessor(_zkClient); _usesExternalZkClient = false; }

Target:
private ZKHelixAdmin(Builder builder) { RealmAwareZkClient zkClient; switch (builder.realmMode) { case MULTI_REALM: try { zkClient = new FederatedZkClient(builder.realmAwareZkConnectionConfig, builder.realmAwareZkClientConfig); } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { throw new HelixException("Not able to connect on multi-realm mode.", e); } break; case SINGLE_REALM: zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(builder.zkAddress), builder.realmAwareZkClientConfig.createHelixZkClientConfig()); break; default: throw new HelixException("Invalid RealmMode given: " + builder.realmMode); } _zkClient = zkClient; _configAccessor = new ConfigAccessor(_zkClient); _usesExternalZkClient = false; }
Source:
public double getTotalPopulationWeight() { return (double) reservoir.getTotalPopulationCount(); }

Target:
public double getTotalPopulationWeight() { return reservoir.getTotalPopulationCount(); }
Source:
public String unmaskUrl(String url, TcSessionData tc, String stringToReplaceUser, String stringToReplaceCourse) { if (tc != null){ String uniqname = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_USER_LOGIN_ID); String courseId = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_COURSE_ID); M_log.debug("uniqname: " + uniqname); String replaceValue = "as_user_id=sis_login_id:" + uniqname; if(url.toLowerCase().contains(stringToReplaceUser.toLowerCase())){ url = url.replace(stringToReplaceUser.toLowerCase(), replaceValue); } if(url.toLowerCase().contains(stringToReplaceCourse.toLowerCase())){ url = url.replace(stringToReplaceCourse.toLowerCase(), courseId); } M_log.debug("New URL: " + url); } return url; }

Target:
public String unmaskUrl(String url, TcSessionData tc, String stringToReplaceUser, String stringToReplaceCourse) { if(tc == null){ return url; } String uniqname = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_USER_LOGIN_ID); String courseId = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_COURSE_ID); M_log.debug("uniqname: " + uniqname); String replaceUserIdValue = "as_user_id=sis_login_id:" + uniqname; if(url.toLowerCase().contains(stringToReplaceUser.toLowerCase())){ url = url.replace(stringToReplaceUser.toLowerCase(), replaceUserIdValue); } if(url.toLowerCase().contains(stringToReplaceCourse.toLowerCase())){ url = url.replace(stringToReplaceCourse.toLowerCase(), courseId); } M_log.debug("New URL: " + url); return url; }
Source:
public void testNullDefaults() throws Exception { MessageSpec testMessageSpec = MessageGenerator.JSON_SERDE.readValue(String.join("", Arrays.asList( "{", " \"type\": \"request\",", " \"name\": \"FooBar\",", " \"validVersions\": \"0-2\",", " \"fields\": [", " { \"name\": \"field1\", \"type\": \"int32\", \"versions\": \"0+\" },", " { \"name\": \"field2\", \"type\": \"[]TestStruct\", \"versions\": \"1+\", ", " \"nullableVersions\": \"1+\", \"default\": \"null\", \"fields\": [", " { \"name\": \"field1\", \"type\": \"int32\", \"versions\": \"0+\" }", " ]},", " { \"name\": \"field3\", \"type\": \"bytes\", \"versions\": \"2+\", ", " \"nullableVersions\": \"2+\", \"default\": \"null\" }", " ]", "}")), MessageSpec.class); new MessageDataGenerator("test").generate(testMessageSpec); }

Target:
public void testNullDefaults() throws Exception { MessageSpec testMessageSpec = MessageGenerator.JSON_SERDE.readValue(String.join("", Arrays.asList( "{", " \"type\": \"request\",", " \"name\": \"FooBar\",", " \"validVersions\": \"0-2\",", " \"fields\": [", " { \"name\": \"field1\", \"type\": \"int32\", \"versions\": \"0+\" },", " { \"name\": \"field2\", \"type\": \"[]TestStruct\", \"versions\": \"1+\", ", " \"nullableVersions\": \"1+\", \"default\": \"null\", \"fields\": [", " { \"name\": \"field1\", \"type\": \"int32\", \"versions\": \"0+\" }", " ]},", " { \"name\": \"field3\", \"type\": \"bytes\", \"versions\": \"2+\", ", " \"nullableVersions\": \"2+\", \"default\": \"null\" }", " ]", "}")), MessageSpec.class); new MessageDataGenerator("org.apache.kafka.common.message").generate(testMessageSpec); }
Source:
private void unstage(IStructuredSelection selection) { if (selection.isEmpty()) return; final DirCacheEditor edit; try { edit = currentRepository.lockDirCache().editor(); } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); return; } final RevTree headRevTree; try { final Ref head = currentRepository.getRef(Constants.HEAD); headRevTree = new RevWalk(currentRepository).parseTree(head.getObjectId()); } catch (IOException e1) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); return; } Iterator iterator = selection.iterator(); while (iterator.hasNext()) { StagingEntry entry = (StagingEntry) iterator.next(); switch(entry.getState()) { case ADDED: case CHANGED: case REMOVED: try { final TreeWalk tw = TreeWalk.forPath(currentRepository, entry.getPath(), headRevTree); if (tw != null) { edit.add(new DirCacheEditor.PathEdit(entry.getPath()) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(tw.getFileMode(0)); ent.setObjectId(tw.getObjectId(0)); } }); } } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); } break; default: } } try { edit.commit(); } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); } reload(currentRepository); }

Target:
private void unstage(IStructuredSelection selection) { if (selection.isEmpty()) return; final RevCommit headRev; try { final Ref head = currentRepository.getRef(Constants.HEAD); headRev = new RevWalk(currentRepository).parseCommit(head.getObjectId()); } catch (IOException e1) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); return; } final DirCache dirCache; final DirCacheEditor edit; try { dirCache = currentRepository.lockDirCache(); edit = dirCache.editor(); } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); return; } try { updateDirCache(selection, headRev, edit); try { edit.commit(); } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); } } finally { dirCache.unlock(); } reload(currentRepository); }
Source:
public Optional<Vector3d> getClickedPosition() { return Optional.of(VecHelper.toVector(this.pos).toDouble()); }

Target:
public Optional<Vector3d> getClickedPosition() { return clickedPosition; }
Source:
public static void main( String[] args ) throws Exception { WebSocketChatClient chatclient = new WebSocketChatClient( new URI( "wss://localhost:8887" ) ); String STORETYPE = "JKS"; String KEYSTORE = String.format("src%1$stest%1$1sjava%1$1sorg%1$1sjava_websocket%1$1skeystore.jks", File.separator); String STOREPASSWORD = "storepassword"; String KEYPASSWORD = "keypassword"; KeyStore ks = KeyStore.getInstance( STORETYPE ); File kf = new File( KEYSTORE ); ks.load( new FileInputStream( kf ), STOREPASSWORD.toCharArray() ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( "SunX509" ); kmf.init( ks, KEYPASSWORD.toCharArray() ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( "SunX509" ); tmf.init( ks ); SSLContext sslContext = null; sslContext = SSLContext.getInstance( "TLS" ); sslContext.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); SSLSocketFactory factory = sslContext.getSocketFactory(); chatclient.setSocketFactory( factory ); chatclient.connectBlocking(); BufferedReader reader = new BufferedReader( new InputStreamReader( System.in ) ); while ( true ) { String line = reader.readLine(); if( line.equals( "close" ) ) { chatclient.closeBlocking(); } else if ( line.equals( "open" ) ) { chatclient.reconnect(); } else { chatclient.send( line ); } } }

Target:
public static void main( String[] args ) throws Exception { WebSocketChatClient chatclient = new WebSocketChatClient( new URI( "wss://localhost:8887" ) ); String STORETYPE = "JKS"; String KEYSTORE = Paths.get("src", "test", "java", "org", "java_websocket", "keystore.jks").toString(); String STOREPASSWORD = "storepassword"; String KEYPASSWORD = "keypassword"; KeyStore ks = KeyStore.getInstance( STORETYPE ); File kf = new File( KEYSTORE ); ks.load( new FileInputStream( kf ), STOREPASSWORD.toCharArray() ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( "SunX509" ); kmf.init( ks, KEYPASSWORD.toCharArray() ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( "SunX509" ); tmf.init( ks ); SSLContext sslContext = null; sslContext = SSLContext.getInstance( "TLS" ); sslContext.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); SSLSocketFactory factory = sslContext.getSocketFactory(); chatclient.setSocketFactory( factory ); chatclient.connectBlocking(); BufferedReader reader = new BufferedReader( new InputStreamReader( System.in ) ); while ( true ) { String line = reader.readLine(); if( line.equals( "close" ) ) { chatclient.closeBlocking(); } else if ( line.equals( "open" ) ) { chatclient.reconnect(); } else { chatclient.send( line ); } } }
Source:
public String toString() { StringBuilder result = new StringBuilder(); if (!getLang().equals("und")) { result.append("Id: ").append(getId()); result.append(", Language Code: ").append(getLang()); } if (isNotBlank(getAudioTrackTitleFromMetadata())) { if (result.length() > 0) { result.append(", "); } result.append("Audio Track Title From Metadata: ").append(getAudioTrackTitleFromMetadata()); } if (result.length() > 0) { result.append(", "); } result.append("Audio Codec: ").append(getAudioCodec()); if (getSampleFrequency() != null) { result.append(", Sample Frequency: ").append(getSampleFrequency()); } if (getBitRate() != 0) { result.append(", Bitrate: ").append(getBitRate()); } if (getBitsperSample() != 0 && getBitsperSample() != 16 ) { result.append(", Bits per Sample: ").append(getBitsperSample()); } if (getAudioProperties() != null) { result.append(", ").append(getAudioProperties()); } if (nrAudioChannels != 0) { result.append(", Deprecated Channels: ").append(nrAudioChannels); } if (delay != 0) { result.append(", Deprecated Delay: ").append(delay); } if (isNotBlank(getArtist())) { result.append(", Artist: ").append(getArtist()); if (isNotBlank(getAlbum())) { result.append(", Album: ").append(getAlbum()); } if (isNotBlank(getSongname())) { result.append(", Track Name: ").append(getSongname()); } if (getYear() != 0) { result.append(", Year: ").append(getYear()); } if (getTrack() != 0) { result.append(", Track: ").append(getTrack()); } if (isNotBlank(getGenre())) { result.append(", Genre: ").append(getGenre()); } } if (isNotBlank(getMuxingModeAudio())) { result.append(", Muxing Mode: ").append(getMuxingModeAudio()); } return result.toString(); }

Target:
public String toString() { StringBuilder result = new StringBuilder(); if (!getLang().equals("und")) { result.append("Id: ").append(getId()); result.append(", Language Code: ").append(getLang()); } if (isNotBlank(getAudioTrackTitleFromMetadata())) { if (result.length() > 0) { result.append(", "); } result.append("Audio Track Title From Metadata: ").append(getAudioTrackTitleFromMetadata()); } if (result.length() > 0) { result.append(", "); } result.append("Audio Codec: ").append(getAudioCodec()); result.append(", Bitrate: ").append(getBitRate()); if (getBitsperSample() != 16) { result.append(", Bits per Sample: ").append(getBitsperSample()); } if (getAudioProperties() != null) { result.append(", ").append(getAudioProperties()); } if (isNotBlank(getArtist())) { result.append(", Artist: ").append(getArtist()); } if (isNotBlank(getAlbum())) { result.append(", Album: ").append(getAlbum()); } if (isNotBlank(getSongname())) { result.append(", Track Name: ").append(getSongname()); } if (getYear() != 0) { result.append(", Year: ").append(getYear()); } if (getTrack() != 0) { result.append(", Track: ").append(getTrack()); } if (isNotBlank(getGenre())) { result.append(", Genre: ").append(getGenre()); } if (isNotBlank(getMuxingModeAudio())) { result.append(", Muxing Mode: ").append(getMuxingModeAudio()); } return result.toString(); }
Source:
public static PropertyDescriptor getPropertyDescriptor(Class<?> beanClass, String propertyName) { if (!beanClass.isInterface()) { BeanInfo beanInfo; try { beanInfo = Introspector.getBeanInfo(beanClass); } catch (IntrospectionException e) { return null; } PropertyDescriptor[] propertyDescriptors = beanInfo .getPropertyDescriptors(); for (PropertyDescriptor descriptor : propertyDescriptors) { if (descriptor.getName().equals(propertyName)) { return descriptor; } } } else { try { PropertyDescriptor propertyDescriptors[]; List<PropertyDescriptor> pds = new ArrayList<PropertyDescriptor>(); getInterfacePropertyDescriptors(pds, beanClass); if (pds.size() > 0) { propertyDescriptors = pds .toArray(new PropertyDescriptor[pds.size()]); PropertyDescriptor descriptor; for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { descriptor = propertyDescriptor; if (descriptor.getName().equals(propertyName)) return descriptor; } } } catch (IntrospectionException e) { return null; } } throw new IllegalArgumentException( "Could not find property with name " + propertyName + " in class " + beanClass); }

Target:
public static PropertyDescriptor getPropertyDescriptor(Class<?> beanClass, String propertyName) { if (!beanClass.isInterface()) { BeanInfo beanInfo; try { beanInfo = Introspector.getBeanInfo(beanClass); } catch (IntrospectionException e) { return null; } PropertyDescriptor[] propertyDescriptors = beanInfo .getPropertyDescriptors(); for (PropertyDescriptor descriptor : propertyDescriptors) { if (descriptor.getName().equals(propertyName)) { return descriptor; } } } else { try { List<PropertyDescriptor> pds = new ArrayList<PropertyDescriptor>(); getInterfacePropertyDescriptors(pds, beanClass); if (pds.size() > 0) { for (PropertyDescriptor descriptor : pds.toArray(new PropertyDescriptor[pds.size()])) { if (descriptor.getName().equals(propertyName)) return descriptor; } } } catch (IntrospectionException e) { return null; } } throw new IllegalArgumentException( "Could not find property with name " + propertyName + " in class " + beanClass); }
Source:
public View getView(int position, View convertView, ViewGroup parent) { View view; if (convertView == null) { view = mInflater.inflate(mResource, parent, false); } else { view = convertView; } DiningTable t = mTables.get(position); TextView table; table = (TextView) view.findViewById(R.id.table_num); table.setText(t.getName()); ImageView background; background = (ImageView) view.findViewById(R.id.table_bg); if (t.isFree() == false) { background.setAlpha(USED_FLAG); } return view; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { View view; if (convertView == null) { view = mInflater.inflate(mResource, parent, false); } else { view = convertView; } DiningTable t = getItem(position); TextView table; table = (TextView) view.findViewById(R.id.table_num); table.setText(t.getName()); ImageView background; background = (ImageView) view.findViewById(R.id.table_bg); if (!t.isFree()) { background.setAlpha(USED_FLAG); } return view; }
Source:
public static PsiElement searchInSameFile(@NotNull HaxeFileModel file, @NotNull String name) { List<HaxeClassModel> models = file.getClassModels(); final HaxeModel result = Stream.concat( models.stream().filter(model -> name.equals(model.getName())), models.stream().filter(HaxeClassModel::isEnum) .map(model -> model.getField(name)) .filter(Objects::nonNull)) .findFirst() .orElse(null); return result != null ? result.getBasePsi() : null; }

Target:
public static PsiElement searchInSameFile(@NotNull HaxeFileModel file, @NotNull String name) { List<HaxeClassModel> models = file.getClassModels(); final Stream<HaxeClassModel> classesStream = models.stream().filter(model -> name.equals(model.getName())); final Stream<HaxeFieldModel> enumsStream = models.stream().filter(HaxeClassModel::isEnum) .map(model -> model.getField(name)) .filter(Objects::nonNull); final HaxeModel result = Stream.concat(classesStream, enumsStream) .findFirst() .orElse(null); return result != null ? result.getBasePsi() : null; }
Source:
private boolean isSpecificDockerfileLocationSet(DockerFixture f) { return f.dockerfile() != null && !"".equals(f.dockerfile().trim()); }

Target:
private boolean isSpecificDockerfileLocationSet(DockerFixture f) { return !f.dockerfileFolder().isEmpty(); }
Source:
public void testDynamicLoading() throws IOException, ClassNotFoundException { final String generatedJar = generatejar(); File file = new File(generatedJar); final Class<?> pojo = URLClassLoader.newInstance(new URL[]{file.toURI().toURL()}).loadClass("POJO"); StreamingApplication app = new StreamingApplication() { @Override public void populateDAG(DAG dag, Configuration conf) { TestGeneratorInputOperator genNode = dag.addOperator("genNode", TestGeneratorInputOperator.class); genNode.setMaxTuples(2); DynamicLoader dynamicLoader = dag.addOperator("DynamicLoader", new DynamicLoader()); dynamicLoader.setClass("POJO"); dag.addStream("fromNode1", genNode.outport, dynamicLoader.in); dag.setInputPortAttribute(dynamicLoader.in, Context.PortContext.TUPLE_CLASS, pojo); conf.set(LIBJARS_CONF_KEY_NAME, generatedJar); } }; LocalMode.runApp(app, 10000); FileUtils.forceDelete(new File("src/test/resources/dynamicJar/POJO.class")); FileUtils.forceDelete(new File("src/test/resources/dynamicJar/testPOJO.jar")); }

Target:
public void testDynamicLoading() throws Exception { String generatedJar = generatejar("POJO"); URLClassLoader uCl = URLClassLoader.newInstance(new URL[] {new File(generatedJar).toURI().toURL()}); Class<?> pojo = uCl.loadClass("POJO"); DynamicLoaderApp app = new DynamicLoaderApp(); app.generatedJar = generatedJar; app.pojo = pojo; LocalMode lma = LocalMode.newInstance(); lma.prepareDAG(app, new Configuration()); LocalMode.Controller lc = lma.getController(); lc.runAsync(); DynamicLoaderApp.latch.await(); Assert.assertTrue(DynamicLoaderApp.passed); lc.shutdown(); }
Source:
public QueryResponse getFiles(@RequestParam("species") String species) throws UnknownHostException, IllegalOpenCGACredentialsException, IOException { initializeQueryOptions(); VariantSourceDBAdaptor variantSourceMongoDbAdaptor = DBAdaptorConnector.getVariantSourceDBAdaptor(species); return setQueryResponse(variantSourceMongoDbAdaptor.getAllSources(queryOptions)); }

Target:
public QueryResponse getFiles(@RequestParam("species") String species) throws IllegalOpenCGACredentialsException, IOException { initializeQueryOptions(); VariantSourceDBAdaptor variantSourceMongoDbAdaptor = DBAdaptorConnector.getVariantSourceDBAdaptor(species); return setQueryResponse(variantSourceMongoDbAdaptor.getAllSources(queryOptions)); }
Source:
public BulkheadEventsEndpointResponse getEventsFilteredByBulkheadName( @Selector String bulkheadName) { java.util.List<BulkheadEventDTO> response = getBulkheadEvent(bulkheadName).stream() .map(BulkheadEventDTOFactory::createBulkheadEventDTO) .collect(Collectors.toList()); return new BulkheadEventsEndpointResponse(response); }

Target:
public BulkheadEventsEndpointResponse getEventsFilteredByBulkheadName( @Selector String bulkheadName) { List<BulkheadEventDTO> response = getBulkheadEvent(bulkheadName).stream() .map(BulkheadEventDTOFactory::createBulkheadEventDTO) .collect(Collectors.toList()); return new BulkheadEventsEndpointResponse(response); }
Source:
public void buildSlnCmdLineArgumentsTest() { FreeStyleJob job = msBuildJob("/msbuild_plugin/slnProject/", "project.sln", "/verbosity:detailed"); Build b = job.scheduleBuild(); b.shouldSucceed(); String console = b.getConsole(); assertThat(console, Matchers.containsString("Build succeeded.")); assertThat(console, Matchers.containsString("Done Building Project")); }

Target:
public void buildSlnCmdLineArgumentsTest() { FreeStyleJob job = msBuildJob("/msbuild_plugin/slnProject/", "project.sln", "/verbosity:detailed"); Build b = job.scheduleBuild(); b.shouldSucceed(); String console = b.getConsole(); assertThat(console, containsString("Build succeeded.")); assertThat(console, containsString("Done Building Project")); }
Source:
public void writeTaskContainerMapping(String taskName, String containerId, TaskMode taskMode) { String existingContainerId = taskNameToContainerId.get(taskName); if (existingContainerId != null && !existingContainerId.equals(containerId)) { LOG.info("Task \"{}\" moved from container to container {}", new Object[]{taskName, existingContainerId, containerId}); } else { LOG.debug("Task \"{}\" assigned to container {}", taskName, containerId); } if (containerId == null) { taskContainerMappingMetadataStore.delete(taskName); taskModeMappingMetadataStore.delete(taskName); taskNameToContainerId.remove(taskName); } else { taskContainerMappingMetadataStore.put(taskName, containerIdSerde.toBytes(containerId)); taskModeMappingMetadataStore.put(taskName, taskModeSerde.toBytes(taskMode.toString())); taskNameToContainerId.put(taskName, containerId); } }

Target:
public void writeTaskContainerMapping(String taskName, String containerId, TaskMode taskMode) { String existingContainerId = taskNameToContainerId.get(taskName); if (existingContainerId != null && !existingContainerId.equals(containerId)) { LOG.info("Task \"{}\" in mode moved from container to container {}", new Object[]{taskName, taskMode, existingContainerId, containerId}); } else { LOG.debug("Task \"{}\" in mode assigned to container {}", taskName, taskMode, containerId); } if (containerId == null) { taskContainerMappingMetadataStore.delete(taskName); taskModeMappingMetadataStore.delete(taskName); taskNameToContainerId.remove(taskName); } else { taskContainerMappingMetadataStore.put(taskName, containerIdSerde.toBytes(containerId)); taskModeMappingMetadataStore.put(taskName, taskModeSerde.toBytes(taskMode.toString())); taskNameToContainerId.put(taskName, containerId); } }
Source:
public String obtainSst(final HttpClient httpClient, final HttpHost httpHost) throws IOException { log.debug("Obtaining STT"); final HttpPost postLogin = new HttpPost(LOGIN_URL); try { final HttpEntity requestEntity = new StringEntity(createLoginJson(), ContentType.APPLICATION_JSON); postLogin.setEntity(requestEntity); postLogin.setHeader("Accept", ContentType.APPLICATION_JSON.toString()); final HttpResponse response = httpClient.execute(httpHost, postLogin); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_OK) { throw new GoodDataAuthException("Unable to login: " + status); } final String sst = TokenUtils.extractSST(response); if (sst == null) { throw new GoodDataAuthException("Unable to login. Missing SST Set-Cookie header."); } return sst; } finally { postLogin.releaseConnection(); } }

Target:
public String obtainSst(final HttpClient httpClient, final HttpHost httpHost) throws IOException { log.debug("Obtaining STT"); final HttpPost postLogin = new HttpPost(LOGIN_URL); try { final HttpEntity requestEntity = new StringEntity(createLoginJson(), ContentType.APPLICATION_JSON); postLogin.setEntity(requestEntity); postLogin.setHeader(HttpHeaders.ACCEPT, YAML_CONTENT_TYPE); final HttpResponse response = httpClient.execute(httpHost, postLogin); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_OK) { throw new GoodDataAuthException("Unable to login: " + status); } return TokenUtils.extractToken(response); } finally { postLogin.releaseConnection(); } }
Source:
void generateKeyPair(String workspaceId) { try { KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithm); kpg.initialize(keySize); final KeyPair pair = kpg.generateKeyPair(); final SignatureKeyPairImpl kp = new SignatureKeyPairImpl(workspaceId, pair.getPublic(), pair.getPrivate()); signatureKeyDao.create(kp); LOG.debug( "Generated signature key pair with ws id and algorithm {}.", kp.getWorkspaceId(), algorithm); } catch (NoSuchAlgorithmException | ConflictException | ServerException ex) { LOG.error( "Unable to generate signature keypairs for ws {}. Cause: {}", workspaceId, ex.getMessage()); } }

Target:
SignatureKeyPair generateKeyPair(String workspaceId) throws NoSuchAlgorithmException, ServerException, ConflictException { try { KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithm); kpg.initialize(keySize); final KeyPair pair = kpg.generateKeyPair(); final SignatureKeyPairImpl kp = new SignatureKeyPairImpl(workspaceId, pair.getPublic(), pair.getPrivate()); LOG.debug( "Generated signature key pair with ws id and algorithm {}.", kp.getWorkspaceId(), algorithm); return signatureKeyDao.create(kp); } catch (NoSuchAlgorithmException | ConflictException | ServerException ex) { LOG.error( "Unable to generate signature keypair for ws {}. Cause: {}", workspaceId, ex.getMessage()); throw ex; } }
Source:
public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, final storage_pool storage_pool) { Map<String, String> con = new HashMap<String, String>(); con.put("id", (connection.getid() != null) ? connection.getid() : Guid.Empty.toString()); addOrEmpty(con, connection.getconnection(), "connection"); addOrEmpty(con, connection.getportal(), "portal"); addOrEmpty(con, connection.getport(), "port"); addOrEmpty(con, connection.getiqn(), "iqn"); addOrEmpty(con, connection.getuser_name(), "user"); addOrEmpty(con, connection.getpassword(), "password"); if (storage_pool != null && storage_pool.getcompatibility_version().compareTo(Version.v3_1) >= 0) { addIfNotNullOrEmpty(con, connection.getMountOptions(), "mnt_options"); addIfNotNullOrEmpty(con, connection.getVfsType(), "vfs_type"); } return con; }

Target:
public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, final storage_pool storage_pool) { Map<String, String> con = new HashMap<String, String>(); con.put("id", (connection.getid() != null) ? connection.getid() : Guid.Empty.toString()); addOrEmpty(con, connection.getconnection(), "connection"); addOrEmpty(con, connection.getportal(), "portal"); addOrEmpty(con, connection.getport(), "port"); addOrEmpty(con, connection.getiqn(), "iqn"); addOrEmpty(con, connection.getuser_name(), "user"); addOrEmpty(con, connection.getpassword(), "password"); if (storage_pool != null && Version.v3_1.compareTo(storage_pool.getcompatibility_version()) <= 0) { addIfNotNullOrEmpty(con, connection.getMountOptions(), "mnt_options"); addIfNotNullOrEmpty(con, connection.getVfsType(), "vfs_type"); addIfNotNullOrEmpty(con, connection.getNfsVersion(), "protocol_version"); addIfNotNullOrEmpty(con, connection.getNfsTimeo(), "timeout"); addIfNotNullOrEmpty(con, connection.getNfsRetrans(), "retrans"); } return con; }
Source:
public static void check() { log.debug("mapOne:{}", mapOne); log.debug("mapTwo:{}", mapTwo); log.debug("mapThree:{}", mapThree); assertWithMessage( "The compared maps are not close enough: mapTwo: %s, mapThree: %s", mapTwo, mapThree) .that(mapTwo) .comparingValuesUsing(Correspondence.tolerance(1.0E-4)) .equals(mapThree); }

Target:
public static void check() { log.debug("mapOne:{}", mapOne); log.debug("mapTwo:{}", mapTwo); log.debug("mapThree:{}", mapThree); assertThat(mapTwo.keySet()).isEqualTo(mapThree.keySet()); for (String key : mapTwo.keySet()) { Point p2 = mapTwo.get(key); Point p3 = mapThree.get(key); assertThat(p2.x).isWithin(1.0E-3).of(p3.x); assertThat(p2.y).isWithin(1.0E-3).of(p3.y); } }
Source:
protected ImportValidator getImportValidator() { return new ImportValidator(getParameters()); }

Target:
protected ImportValidator getImportValidator() { if (importValidator == null) { importValidator = new ImportValidator(getParameters()); } return importValidator; }
Source:
public void after() { STUDY.setExternalIdValidationEnabled(false); EXT_ID.setSubstudyId(null); BridgeUtils.setRequestContext(null); }

Target:
public void after() { BridgeUtils.setRequestContext(null); }
Source:
public static <M, K, WV> Window<M, K, WV> keyedTumblingWindow(Function<? super M, ? extends K> keyFn, Duration interval, Supplier<? extends WV> initialValue, FoldLeftFunction<? super M, WV> foldFn) { Trigger<M> defaultTrigger = new TimeTrigger<>(interval); return new WindowInternal<>(defaultTrigger, initialValue::get, new FoldLeftFunction<M, WV>() { @Override public WV apply(M message, WV oldValue) { return foldFn.apply(message, oldValue); } @Override public void init(Config config, TaskContext context) { foldFn.init(config, context); } }, keyFn::apply, null, WindowType.TUMBLING); }

Target:
public static <M, K, WV> Window<M, K, WV> keyedTumblingWindow(Function<? super M, ? extends K> keyFn, Duration interval, Supplier<? extends WV> initialValue, FoldLeftFunction<? super M, WV> foldFn) { Trigger<M> defaultTrigger = new TimeTrigger<>(interval); return new WindowInternal<>(defaultTrigger, (Supplier<WV>) initialValue, (FoldLeftFunction<M, WV>) foldFn, (Function<M, K>) keyFn, null, WindowType.TUMBLING); }
Source:
public LabelAndConfigurationOutputFormatterCallback( ExtendedEventHandler eventHandler, CqueryOptions options, OutputStream out, SkyframeExecutor skyframeExecutor, TargetAccessor<ConfiguredTarget> accessor, boolean showKind) { super(eventHandler, options, out, skyframeExecutor, accessor, showKind); }

Target:
public LabelAndConfigurationOutputFormatterCallback( ExtendedEventHandler eventHandler, CqueryOptions options, OutputStream out, SkyframeExecutor skyframeExecutor, TargetAccessor<ConfiguredTarget> accessor, boolean showKind ) { super(eventHandler, options, out, skyframeExecutor, accessor); this.showKind = showKind; }
Source:
public void enableUser(ByteBuffer username) { if(disabledUsers.contains(username)) { Iterator<ByteBuffer> it = disabledUsers.iterator(); while (it.hasNext()) { ByteBuffer user = it.next(); if (username.equals(user)) { it.remove(); break; } } } }

Target:
public void enableUser(ByteBuffer username) { long stamp = lock.writeLock(); try { short uid = getUidByUsername0(username); credentials.put(uid, ENABLED, true); } finally { lock.unlockWrite(stamp); } }
Source:
public void testGt() { int v = 100; ConcreteIntPredicate gtP = gt(100); assertFalse(gtP.test(v)); assertFalse(gtP.test(v - 1)); assertTrue(gtP.test(v + 1)); assertEquals(gt(v), gtP); assertEquals(gt(v).hashCode(), gtP.hashCode()); assertNotEquals(lt(v), gtP); assertNotEquals(lt(v).hashCode(), gtP.hashCode()); assertNotEquals(gt(v + 1), gtP); assertNotEquals(gt(v + 1).hashCode(), gtP.hashCode()); assertEquals(gtP.toString(), "> 100"); }

Target:
public void testGt() { int v = 100; ConcreteIntPredicate gtP = gt(100); assertFalse(gtP.test(v)); assertFalse(gtP.test(v - 1)); assertTrue(gtP.test(v + 1)); assertEquals(gt(v), gtP); assertEquals(gt(v).hashCode(), gtP.hashCode()); assertNotEquals(lt(v), gtP); assertNotEquals(gt(v + 1), gtP); assertEquals(gtP.toString(), "> 100"); }
Source:
private List<DimFilter> makeBoundDimFilters() { List<DimFilter> boundDimFilters = new ArrayList<>(); for (Interval interval : intervals) { BoundDimFilter boundDimFilter = new BoundDimFilter( dimension, String.valueOf(interval.getStartMillis()), String.valueOf(interval.getEndMillis()), false, false, null, extractionFn, StringComparators.NUMERIC ); boundDimFilters.add(boundDimFilter); } return boundDimFilters; }

Target:
private List<DimFilter> makeBoundDimFilters() { List<DimFilter> boundDimFilters = new ArrayList<>(); for (Pair<Long, Long> interval : intervalLongs) { BoundDimFilter boundDimFilter = new BoundDimFilter( dimension, String.valueOf(interval.lhs), String.valueOf(interval.rhs), false, true, null, extractionFn, StringComparators.NUMERIC ); boundDimFilters.add(boundDimFilter); } return boundDimFilters; }
Source:
public void setAttributesAsText(Object element, String text) { mSuper.setAttributesAsText(element, text); }

Target:
public final void setAttributesAsText(Object element, String text) { onSetAttributesAsText((E)element, text); }
Source:
public String contentAccessMode() { return getContentAccessMode() == null ? "entitlement" : getContentAccessMode(); }

Target:
public String contentAccessMode() { return StringUtils.isEmpty(getContentAccessMode()) ? ContentAccessCertServiceAdapter.DEFAULT_CONTENT_ACCESS_MODE : getContentAccessMode(); }
Source:
public void testInsertTemplateToUnregisteredEntity() { final String ovfExtraData = "<ovf> Some extra OVF data </ovf>"; OvfEntityData ovfEntityData = new OvfEntityData(FixturesTool.VM_TEMPLATE_RHEL5, "AnyVM", VmEntityType.TEMPLATE, ArchitectureType.x86_64, Version.v3_4, FixturesTool.STORAGE_DOAMIN_NFS2_1, null, ovfExtraData); dao.saveOVFData(ovfEntityData); List<OvfEntityData> fetchedOvfEntityData = dao.getByEntityIdAndStorageDomain(FixturesTool.VM_TEMPLATE_RHEL5, FixturesTool.STORAGE_DOAMIN_NFS2_1); assertFalse(fetchedOvfEntityData.isEmpty()); assertTrue("The entity type should be template", fetchedOvfEntityData.get(0).getEntityType().isTemplateType()); assertTrue("The entity OVF extra data should be updated", fetchedOvfEntityData.get(0).getOvfExtraData() .equals(ovfExtraData)); }

Target:
public void testInsertTemplateToUnregisteredEntity() { final String ovfExtraData = "<ovf> Some extra OVF data </ovf>"; OvfEntityData ovfEntityData = new OvfEntityData(FixturesTool.VM_TEMPLATE_RHEL5, "AnyVM", VmEntityType.TEMPLATE, ArchitectureType.x86_64, Version.v3_4, FixturesTool.STORAGE_DOAMIN_NFS2_1, null, ovfExtraData); dao.saveOVFData(ovfEntityData); List<OvfEntityData> fetchedOvfEntityData = dao.getByEntityIdAndStorageDomain(FixturesTool.VM_TEMPLATE_RHEL5, FixturesTool.STORAGE_DOAMIN_NFS2_1); assertTrue(fetchedOvfEntityData.size() == 1); assertTrue("The entity type should be template", fetchedOvfEntityData.get(0).getEntityType().isTemplateType()); assertTrue("The entity OVF extra data should be updated", fetchedOvfEntityData.get(0).getOvfExtraData() .equals(ovfExtraData)); }
Source:
public void postWithUsernameAndTokenInBasicAuthHeader() throws Exception { FreeStyleProject p = j.createFreeStyleProject("bar"); j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); User.get("foo"); WebClient wc = createClientForUser("foo"); WebRequest wr = new WebRequest(new URL(j.getURL(), "job/bar/build"), HttpMethod.POST); wc.addCrumb(wr); assertEquals(201, wc.getPage(wr).getWebResponse().getStatusCode()); j.waitUntilNoActivity(); Cause.UserIdCause triggeredBy = p.getBuildByNumber(1).getCause(Cause.UserIdCause.class); assertEquals("foo", triggeredBy.getUserId()); }

Target:
public void postWithUsernameAndTokenInBasicAuthHeader() throws Exception { FreeStyleProject p = j.createFreeStyleProject("bar"); j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); User.get("foo"); WebClient wc = createClientForUser("foo"); WebRequest wr = new WebRequest(new URL(j.getURL(), "job/bar/build"), HttpMethod.POST); assertEquals(201, wc.getPage(wr).getWebResponse().getStatusCode()); j.waitUntilNoActivity(); Cause.UserIdCause triggeredBy = p.getBuildByNumber(1).getCause(Cause.UserIdCause.class); assertEquals("foo", triggeredBy.getUserId()); }
Source:
public ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentsInfo = getRequestParamValue(Const.ParamsNames.STUDENTS_ENROLLMENT_INFO); Assumption.assertNotNull(studentsInfo); new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), logic.getCourse(courseId)); try { InstructorCourseEnrollResultPageData pageData = new InstructorCourseEnrollResultPageData(account); pageData.courseId = courseId; pageData.students = enrollAndProcessResultForDisplay(studentsInfo, courseId); statusToAdmin = "Students Enrolled in Course <span class=\"bold\">[" + courseId + "]:</span><br>" + (studentsInfo).replace("\n", "<br>"); return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL_RESULT, pageData); } catch (EnrollException | InvalidParametersException e) { setStatusForException(e); statusToAdmin += "<br>Enrollment string entered by user:<br>" + (studentsInfo).replace("\n", "<br>"); InstructorCourseEnrollPageData pageData = new InstructorCourseEnrollPageData(account); pageData.courseId = courseId; pageData.enrollStudents = studentsInfo; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL, pageData); } }

Target:
public ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentsInfo = getRequestParamValue(Const.ParamsNames.STUDENTS_ENROLLMENT_INFO); Assumption.assertPostParamNotNull(Const.ParamsNames.STUDENTS_ENROLLMENT_INFO, studentsInfo); new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), logic.getCourse(courseId)); try { InstructorCourseEnrollResultPageData pageData = new InstructorCourseEnrollResultPageData(account); pageData.courseId = courseId; pageData.students = enrollAndProcessResultForDisplay(studentsInfo, courseId); statusToAdmin = "Students Enrolled in Course <span class=\"bold\">[" + courseId + "]:</span><br>" + (studentsInfo).replace("\n", "<br>"); return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL_RESULT, pageData); } catch (EnrollException | InvalidParametersException e) { setStatusForException(e); statusToAdmin += "<br>Enrollment string entered by user:<br>" + (studentsInfo).replace("\n", "<br>"); InstructorCourseEnrollPageData pageData = new InstructorCourseEnrollPageData(account); pageData.courseId = courseId; pageData.enrollStudents = studentsInfo; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL, pageData); } }
Source:
protected boolean checkIfLunDiskCanBeAdded() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (storage_server_connections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } return isDiskPassPciAndIdeLimit(getParameters().getDiskInfo()); }

Target:
protected boolean checkIfLunDiskCanBeAdded() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (storage_server_connections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } return true; }
Source:
protected static boolean validFieldName(String fieldName) { String[] parts = fieldName.contains(".") ? fieldName.split("\\.") : new String[]{fieldName}; for (String part: parts) { if (part.startsWith("$")) { String msg = String.format("Field names cannot start with a $ in field %s", part); logger.log(Level.SEVERE, msg); return false; } } return true; }

Target:
protected static boolean validFieldName(String fieldName) { String[] parts = fieldName.split("\\."); for (String part: parts) { if (part.startsWith("$")) { String msg = String.format("Field names cannot start with a $ in field %s", part); logger.log(Level.SEVERE, msg); return false; } } return true; }
Source:
PutManager(ClusterMap clusterMap, ResponseHandler responseHandler, NotificationSystem notificationSystem, RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, Time time) { this.clusterMap = clusterMap; this.responseHandler = responseHandler; this.notificationSystem = notificationSystem; this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.time = time; putOperations = Collections.newSetFromMap(new ConcurrentHashMap<PutOperation, Boolean>()); correlationIdToPutOperation = new HashMap<Integer, PutOperation>(); chunkFillerThread = Utils.newThread("ChunkFillerThread", new ChunkFiller(), false); chunkFillerThread.start(); }

Target:
PutManager(ClusterMap clusterMap, ResponseHandler responseHandler, NotificationSystem notificationSystem, RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, Time time) { this.clusterMap = clusterMap; this.responseHandler = responseHandler; this.notificationSystem = notificationSystem; this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.time = time; putOperations = Collections.newSetFromMap(new ConcurrentHashMap<PutOperation, Boolean>()); correlationIdToPutOperation = new HashMap<Integer, PutOperation>(); chunkFillerThread = Utils.newThread("ChunkFillerThread", new ChunkFiller(), true); chunkFillerThread.start(); }