auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Adapter buildAdapter(org.opennms.netmgt.telemetry.config.model.Adapter adapterDef) throws Exception { AdapterFactory adapterFactory = null; while (ManagementFactory.getRuntimeMXBean().getUptime() < GRACE_PERIOD_MS) { try { Thread.sleep(LOOKUP_DELAY_MS); } catch (InterruptedException e) { LOG.error( "Interrupted while waiting for adapter factory to become available in the service registry. Aborting."); return null; } adapterFactory = adapterRegistry.getAdapterFactoryByClassName(adapterDef.getClassName()); if (adapterFactory != null) { break; } } final Adapter adapter; if (adapterFactory != null) { adapter = adapterFactory.createAdapter(protocolDef, adapterDef.getParameterMap()); } else { final Object adapterInstance; try { final Class<?> clazz = Class.forName(adapterDef.getClassName()); final Constructor<?> ctor = clazz.getConstructor(); adapterInstance = ctor.newInstance(); } catch (Exception e) { throw new RuntimeException(String.format("Failed to instantiate adapter with class name '%s'.", adapterDef.getClassName(), e)); } if (!(adapterInstance instanceof Adapter)) { throw new IllegalArgumentException(String.format("%s must implement %s", adapterDef.getClassName(), Adapter.class.getCanonicalName())); } adapter = (Adapter) adapterInstance; final BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(adapter); wrapper.setPropertyValues(adapterDef.getParameterMap()); final AutowireCapableBeanFactory beanFactory = applicationContext.getAutowireCapableBeanFactory(); beanFactory.autowireBean(adapter); beanFactory.initializeBean(adapter, "adapter"); adapter.setProtocol(protocolDef); } return adapter; }

Target:
private Adapter buildAdapter(org.opennms.netmgt.telemetry.config.model.Adapter adapterDef) throws Exception { Adapter adapter = adapterRegistry.getAdapter(adapterDef.getClassName(), protocolDef, adapterDef.getParameterMap()); if (adapter == null) { final Object adapterInstance; try { final Class<?> clazz = Class.forName(adapterDef.getClassName()); final Constructor<?> ctor = clazz.getConstructor(); adapterInstance = ctor.newInstance(); } catch (Exception e) { throw new RuntimeException(String.format("Failed to instantiate adapter with class name '%s'.", adapterDef.getClassName(), e)); } if (!(adapterInstance instanceof Adapter)) { throw new IllegalArgumentException(String.format("%s must implement %s", adapterDef.getClassName(), Adapter.class.getCanonicalName())); } adapter = (Adapter) adapterInstance; final BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(adapter); wrapper.setPropertyValues(adapterDef.getParameterMap()); final AutowireCapableBeanFactory beanFactory = applicationContext.getAutowireCapableBeanFactory(); beanFactory.autowireBean(adapter); beanFactory.initializeBean(adapter, "adapter"); adapter.setProtocol(protocolDef); } return adapter; }
Source:
protected Resource[] createResources() { final Resource drlResource = KieServices.Factory.get().getResources().newReaderResource(new StringReader(DRL)); drlResource.setTargetPath(TestConstants.DRL_TEST_TARGET_PATH); return new Resource[] { drlResource }; }

Target:
protected Resource[] createResources() { return KieUtil.createResources(DRL); }
Source:
public final int doPhase2Commit () { if (jtsLogger.logger.isTraceEnabled()) { jtsLogger.logger.trace("ServerTransaction::doPhase2Commit ( " + get_uid() + " )"); } org.omg.CosTransactions.Status s = get_status(); if (s != org.omg.CosTransactions.Status.StatusPrepared && s != org.omg.CosTransactions.Status.StatusCommitted) { jtsLogger.i18NLogger.warn_orbspecific_interposition_coordinator_txnotprepared("ServerTransaction.doPhase2Commit", Utility.stringStatus(s)); return finalStatus(); } super.phase2Commit(true); if (super.failedList != null && super.failedList.size() > 0) { return ActionStatus.COMMITTING; } try { doAfterCompletion(get_status()); } catch (Exception e) { } if (parentTransaction != null) parentTransaction.removeChildAction(this); super.destroyAction(); ActionManager.manager().remove(get_uid()); return finalStatus(); }

Target:
public final int doPhase2Commit () { if (jtsLogger.logger.isTraceEnabled()) { jtsLogger.logger.trace("ServerTransaction::doPhase2Commit ( " + get_uid() + " )"); } org.omg.CosTransactions.Status s = get_status(); if (s != org.omg.CosTransactions.Status.StatusPrepared) { jtsLogger.i18NLogger.warn_orbspecific_interposition_coordinator_txnotprepared("ServerTransaction.doPhase2Commit", Utility.stringStatus(s)); return finalStatus(); } super.phase2Commit(true); if (super.failedList != null && super.failedList.size() > 0) { return ActionStatus.COMMITTING; } try { doAfterCompletion(get_status()); } catch (Exception e) { } if (parentTransaction != null) parentTransaction.removeChildAction(this); super.destroyAction(); ActionManager.manager().remove(get_uid()); return finalStatus(); }
Source:
public BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException { if (params.getTableName() == null) { throw new IllegalArgumentException("TableName cannot be null."); } if (params.getPool() == null) { params.pool(getBatchPool()); } if (params.getWriteBufferSize() == BufferedMutatorParams.UNSET) { if (conf.getRaw(TableConfiguration.WRITE_BUFFER_SIZE_KEY) == null){ params.writeBufferSize(tableConfig.getWriteBufferSize() * 4); } else { params.writeBufferSize(tableConfig.getWriteBufferSize()); } } int maxInflightRpcs = conf.getInt(MAX_INFLIGHT_RPCS, getMaxThreads()); return new BigtableBufferedMutator(conf, params.getTableName(), maxInflightRpcs, params.getWriteBufferSize(), client, options, params.getPool(), params.getListener()); }

Target:
public BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException { if (params.getTableName() == null) { throw new IllegalArgumentException("TableName cannot be null."); } if (params.getPool() == null) { params.pool(getBatchPool()); } if (params.getWriteBufferSize() == BufferedMutatorParams.UNSET) { params.writeBufferSize(tableConfig.getWriteBufferSize()); } int defaultRpcCount = MAX_INFLIGHT_RPCS_DEFAULT * options.getChannelCount(); int maxInflightRpcs = conf.getInt(MAX_INFLIGHT_RPCS_KEY, defaultRpcCount); return new BigtableBufferedMutator(conf, params.getTableName(), maxInflightRpcs, params.getWriteBufferSize(), client, options, params.getPool(), params.getListener()); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recycler_view_demo); mSendButton = (Button) findViewById(R.id.sendButton); mMessageEdit = (EditText) findViewById(R.id.messageEdit); mRef = new Firebase("<LINK_0>"); mChatRef = mRef.limitToLast(50); mSendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Chat chat = new Chat(name, mAuthData.getUid(), mMessageEdit.getText().toString()); mRef.push().setValue(chat, new Firebase.CompletionListener() { @Override public void onComplete(FirebaseError firebaseError, Firebase firebase) { if (firebaseError != null) { Log.e(TAG, firebaseError.toString()); } } }); mMessageEdit.setText(""); } }); mMessages = (RecyclerView) findViewById(R.id.messagesList); LinearLayoutManager manager = new LinearLayoutManager(this); manager.setReverseLayout(false); mMessages.setHasFixedSize(false); mMessages.setLayoutManager(manager); mRecycleViewAdapter = new FirebaseRecyclerViewAdapter<Chat, ChatHolder>(Chat.class, R.layout.message, ChatHolder.class, mChatRef) { @Override public void populateViewHolder(ChatHolder chatView, Chat chat) { chatView.setName(chat.getName()); chatView.setText(chat.getText()); if (mAuthData != null && chat.getUid().equals(mAuthData.getUid())) { chatView.setIsSender(true); } else { chatView.setIsSender(false); } } }; mMessages.setAdapter(mRecycleViewAdapter); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recycler_view_demo); mSendButton = (Button) findViewById(R.id.sendButton); mMessageEdit = (EditText) findViewById(R.id.messageEdit); mSendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showFirebaseLoginPrompt(); } }); mRef = new Firebase("<LINK_0>"); mChatRef = mRef.limitToLast(50); mSendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Chat chat = new Chat(name, mAuthData.getUid(), mMessageEdit.getText().toString()); mRef.push().setValue(chat, new Firebase.CompletionListener() { @Override public void onComplete(FirebaseError firebaseError, Firebase firebase) { if (firebaseError != null) { Log.e(TAG, firebaseError.toString()); } } }); mMessageEdit.setText(""); } }); mMessages = (RecyclerView) findViewById(R.id.messagesList); LinearLayoutManager manager = new LinearLayoutManager(this); manager.setReverseLayout(false); mMessages.setHasFixedSize(false); mMessages.setLayoutManager(manager); mRecycleViewAdapter = new FirebaseRecyclerAdapter<Chat, ChatHolder>(Chat.class, R.layout.message, ChatHolder.class, mChatRef) { @Override public void populateViewHolder(ChatHolder chatView, Chat chat) { chatView.setName(chat.getName()); chatView.setText(chat.getText()); if (mAuthData != null && chat.getUid().equals(mAuthData.getUid())) { chatView.setIsSender(true); } else { chatView.setIsSender(false); } } }; mMessages.setAdapter(mRecycleViewAdapter); }
Source:
protected void setBondingOptions(ListModel<Map.Entry<String, EntityModel<String>>> value) { privateBondingOptions = value; }

Target:
private void setBondingOptions(ListModel<Map.Entry<String, EntityModel<String>>> value) { privateBondingOptions = value; }
Source:
public FileBody(File file, long regionSeek, long regionLength) throws IOException { this.file = new RandomAccessFile(file, "r"); channel = this.file.getChannel(); length = regionLength; if (regionSeek > 0) { regionBase = regionSeek; } }

Target:
public FileBody(File file, long regionSeek, long regionLength) throws IOException { this.file = new RandomAccessFile(file, "r"); channel = this.file.getChannel(); length = regionLength; if (regionSeek > 0) { regionBase = regionSeek; } else { regionBase = 0L; } }
Source:
public Pair<List<Guid>, Guid> runBalance(String balanceName, List<Guid> hostIDs, Map<String, String> propertiesMap) { try { XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Object result = client.execute(BALANCE, createBalanceArgs(balanceName, hostIDs, propertiesMap)); return ExternalSchedulerBrokerObjectBuilder.getBalanceResults(result).getResult(); } catch (XmlRpcException e) { log.error("Error communicate with the external scheduler while balancing: {}", e.getMessage()); log.debug("Exception", e); auditLogFailedToConnect(); return null; } }

Target:
public Pair<List<Guid>, Guid> runBalance(String balanceName, List<Guid> hostIDs, Map<String, String> propertiesMap) { try { XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Object result = client.execute(BALANCE, createBalanceArgs(balanceName, hostIDs, propertiesMap)); return ExternalSchedulerBrokerObjectBuilder.getBalanceResults(result).getResult(); } catch (XmlRpcException e) { log.error("Error communicating with the external scheduler while balancing: {}", e.getMessage()); log.debug("Exception", e); auditLogFailedToConnect(); return null; } }
Source:
private void processEvents() { while ( state.get() == State.STARTED ) { try { int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; long elapsedMs = startOfSuspendedEpoch == 0 ? 0 : System.currentTimeMillis() - startOfSuspendedEpoch; long pollMaxMs = useSessionTimeoutMs - elapsedMs; final ConnectionState newState = eventQueue.poll(pollMaxMs, TimeUnit.MILLISECONDS); if ( newState != null ) { if ( listeners.size() == 0 ) { log.warn("There are no ConnectionStateListeners registered."); } listeners.forEach ( new Function<ConnectionStateListener, Void>() { @Override public Void apply(ConnectionStateListener listener) { listener.stateChanged(client, newState); return null; } } ); } else if ( sessionExpirationPercent > 0 ) { synchronized(this) { checkSessionExpiration(); } } } catch ( InterruptedException e ) { } } }

Target:
private void processEvents() { while ( state.get() == State.STARTED ) { try { int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; long elapsedMs = startOfSuspendedEpoch == 0 ? useSessionTimeoutMs / 2 : System.currentTimeMillis() - startOfSuspendedEpoch; long pollMaxMs = useSessionTimeoutMs - elapsedMs; final ConnectionState newState = eventQueue.poll(pollMaxMs, TimeUnit.MILLISECONDS); if ( newState != null ) { if ( listeners.size() == 0 ) { log.warn("There are no ConnectionStateListeners registered."); } listeners.forEach ( new Function<ConnectionStateListener, Void>() { @Override public Void apply(ConnectionStateListener listener) { listener.stateChanged(client, newState); return null; } } ); } else if ( sessionExpirationPercent > 0 ) { synchronized(this) { checkSessionExpiration(); } } } catch ( InterruptedException e ) { } } }
Source:
private Multimap<String, ?> extractParameters(DispatchCommand dcmd) { String[] cmdArgs = dcmd.getArguments(); String paramName = null; int argPos = 0; Multimap<String, String> parms = ArrayListMultimap.create(); for (int i = 2; i < cmdArgs.length; i++) { String arg = cmdArgs[i]; if (arg.startsWith("-")) { if (paramName != null) { parms.put(paramName, null); } paramName = arg; } else { if (paramName == null) { parms.put("$" + argPos++, arg); } else { parms.put(paramName, arg); paramName = null; } } } if(paramName != null) { parms.put(paramName, null); } return parms; }

Target:
private Multimap<String, ?> extractParameters(DispatchCommand dcmd) { String[] cmdArgs = dcmd.getArguments(); String paramName = null; int argPos = 0; Multimap<String, String> parms = ArrayListMultimap.create(); for (int i = 2; i < cmdArgs.length; i++) { String arg = cmdArgs[i]; if (arg.equals("--")) { for (i = i + 1; i < cmdArgs.length; i++) parms.put("$" + argPos++, cmdArgs[i]); continue; } int eqPos = arg.indexOf('='); if (arg.startsWith("--") && eqPos > 0) { parms.put(arg.substring(0, eqPos), arg.substring(eqPos + 1)); continue; } if (arg.startsWith("-")) { if (paramName != null) { parms.put(paramName, null); } paramName = arg; continue; } if (paramName == null) { parms.put("$" + argPos++, arg); } else { parms.put(paramName, arg); paramName = null; } } if(paramName != null) { parms.put(paramName, null); } return parms; }
Source:
private Store getStore(ExtensionContext extensionContext) { return extensionContext.getStore(Namespace.create(getClass(), extensionContext.getUniqueId())); }

Target:
private static Store getStore(ExtensionContext extensionContext) { return extensionContext.getStore(namespace); }
Source:
@Override public Object decode(Response response, Type type) throws IOException { if (response.body() == null) { return null; } Reader reader = response.body().asReader(); try { return mapper.readValue(reader, mapper.constructType(type)); } finally { ensureClosed(reader); } }

Target:
@Override public Object decode(Response response, Type type) throws IOException { if (response.body() == null) { return null; } Reader reader = response.body().asReader(); try { return mapper.readValue(reader, mapper.constructType(type)); } catch (RuntimeJsonMappingException e) { if (e.getCause() != null && e.getCause() instanceof IOException) { throw IOException.class.cast(e.getCause()); } throw e; } }
Source:
? AccessController.doPrivileged( initializeGetCallerStackAction ) : initializeGetCallerStackAction.run(); } private static Class<?> getCallerClass() { Class<?>[] stackTrace = System.getSecurityManager() != null ? AccessController.doPrivileged( GET_CALLER_STACK_ACTION ) : GET_CALLER_STACK_ACTION.run(); if ( stackTrace.length < 4 ) { throw new SecurityException( "Unable to determine the caller class" ); } boolean hibernateMethodLookupDispatcherDetected = false; int maxFrames = Math.min( MAX_STACK_FRAMES, stackTrace.length ); for ( int i = 3; i < maxFrames; i++ ) { if ( stackTrace[i].getName().equals( HibernateMethodLookupDispatcher.class.getName() ) ) { hibernateMethodLookupDispatcherDetected = true; continue; } if ( hibernateMethodLookupDispatcherDetected ) { return stackTrace[i]; } } throw new SecurityException( "Unable to determine the caller class" ); }

Target:
? AccessController.doPrivileged( initializeGetCallerStackAction ) : initializeGetCallerStackAction.run(); } private static Class<?> getCallerClass() { Class<?>[] stackTrace = System.getSecurityManager() != null ? AccessController.doPrivileged( GET_CALLER_STACK_ACTION ) : GET_CALLER_STACK_ACTION.run(); if ( stackTrace.length <= MIN_STACK_FRAMES ) { throw new SecurityException( "Unable to determine the caller class" ); } boolean hibernateMethodLookupDispatcherDetected = false; int maxFrames = Math.min( MAX_STACK_FRAMES, stackTrace.length ); for ( int i = MIN_STACK_FRAMES; i < maxFrames; i++ ) { if ( stackTrace[i].getName().equals( HibernateMethodLookupDispatcher.class.getName() ) ) { hibernateMethodLookupDispatcherDetected = true; continue; } if ( hibernateMethodLookupDispatcherDetected ) { return stackTrace[i]; } } throw new SecurityException( "Unable to determine the caller class" ); }
Source:
protected Collection<ITmfMatchEventDefinition> getEventDefinitions(ITmfTrace trace) { return fMatchMap.get(trace); }

Target:
protected Collection<ITmfMatchEventDefinition> getEventDefinitions(ITmfTrace trace) { return ImmutableList.copyOf(fMatchMap.get(trace)); }
Source:
protected Double map(final Traverser.Admin<S> traverser) { final Expression expression = new ExpressionBuilder(this.equation) .variables(this.variables) .implicitMultiplication(false) .build(); for (final String var : this.variables) { expression.setVariable(var, TraversalUtil.applyNullable( var.equals(CURRENT) ? traverser.get() : this.getNullableScopeValue(Pop.last, var, traverser), this.traversalRing.next()).doubleValue()); } this.traversalRing.reset(); return expression.evaluate(); }

Target:
protected Double map(final Traverser.Admin<S> traverser) { final Expression localExpression = new Expression(this.expression); for (final String var : this.variables) { localExpression.setVariable(var, var.equals(CURRENT) ? TraversalUtil.applyNullable(traverser, this.traversalRing.next()).doubleValue() : TraversalUtil.applyNullable((S) this.getNullableScopeValue(Pop.last, var, traverser), this.traversalRing.next()).doubleValue()); } this.traversalRing.reset(); return localExpression.evaluate(); }
Source:
private void deleteRepositoryContent( final List<RepositoryNode> selectedNodes, final boolean deleteWorkDir) throws IOException { for (RepositoryNode node : selectedNodes) { Repository repo = node.getRepository(); if (!repo.isBare() && deleteWorkDir) { File[] files = repo.getWorkTree().listFiles(); if (files != null) for (File file : files) { if (isTracked(file, repo)) FileUtils.delete(file, FileUtils.RECURSIVE | FileUtils.RETRY); } } repo.close(); FileUtils.delete(repo.getDirectory(), FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING); if (deleteWorkDir && !repo.isBare() && node.getParent() != null && node.getParent().getType() == RepositoryTreeNodeType.SUBMODULES) { FileUtils.delete(repo.getWorkTree(), FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING); node.getParent().getRepository().notifyIndexChanged(); } String[] files = repo.getWorkTree().list(); boolean isWorkingDirEmpty = files != null && files.length == 0; if (deleteWorkDir && isWorkingDirEmpty) { FileUtils.delete(repo.getWorkTree(), FileUtils.RETRY | FileUtils.SKIP_MISSING); } } }

Target:
private void deleteRepositoryContent( final List<RepositoryNode> selectedNodes, final boolean deleteWorkDir) throws IOException { for (RepositoryNode node : selectedNodes) { Repository repo = node.getRepository(); File workTree = deleteWorkDir && !repo.isBare() ? repo.getWorkTree() : null; if (workTree != null) { File[] files = workTree.listFiles(); if (files != null) for (File file : files) { if (isTracked(file, repo)) FileUtils.delete(file, FileUtils.RECURSIVE | FileUtils.RETRY); } } repo.close(); FileUtils.delete(repo.getDirectory(), FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING); if (workTree != null) { if (node.getParent() != null && node.getParent().getType() == RepositoryTreeNodeType.SUBMODULES) { FileUtils.delete(workTree, FileUtils.RECURSIVE | FileUtils.RETRY | FileUtils.SKIP_MISSING); node.getParent().getRepository().notifyIndexChanged(); } String[] files = workTree.list(); boolean isWorkingDirEmpty = files != null && files.length == 0; if (isWorkingDirEmpty) FileUtils.delete(workTree, FileUtils.RETRY | FileUtils.SKIP_MISSING); } } }
Source:
public PythonVisitorContext(AstNode rootTree, PythonFile pythonFile) { this(rootTree, pythonFile, null); symbolTable = new SymbolTableBuilderVisitor(); symbolTable.scanFile(this); }

Target:
public PythonVisitorContext(AstNode rootTree, PythonFile pythonFile) { this(rootTree, pythonFile, null); SymbolTableBuilderVisitor symbolTableBuilderVisitor = new SymbolTableBuilderVisitor(); symbolTableBuilderVisitor.scanFile(this); symbolTable = symbolTableBuilderVisitor.symbolTable(); }
Source:
private static void testCreateUser() throws MambuApiException { String methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); UsersService usersService = MambuAPIFactory.getUsersService(); List<Role> userRoles = usersService.getUserRoles(); if(CollectionUtils.isEmpty(userRoles)){ System.out.println("WARNING: There are no roles in the appication! User can`t be created wih"); System.out.println("User can`t be created wihout a role"); } long currentTime = System.currentTimeMillis(); User userToBeCreated = new User(); userToBeCreated.setRole(userRoles.get(0)); userToBeCreated.setFirstName("API"); userToBeCreated.setLastName("User "); userToBeCreated.setUsername("ApiUser" + currentTime); userToBeCreated.setPassword("password2010"); userToBeCreated.setNotes("User created through SDK " + currentTime); Permissions permissions = new Permissions(); permissions.setCanManageAllBranches(true); permissions.setCanManageEntitiesAssignedToOtherOfficers(true); userToBeCreated.setPermissions(permissions); User createdUser = usersService.createUser(userToBeCreated); if(createdUser == null){ System.out.println("The new user couldn`t be created!"); return; } System.out.println("Details of the newly created user:"); logIndividualUserDetails(createdUser); }

Target:
private static void testCreateUser() throws MambuApiException { String methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); UsersService usersService = MambuAPIFactory.getUsersService(); List<Role> userRoles = usersService.getUserRoles(); if(CollectionUtils.isEmpty(userRoles)){ System.out.println("WARNING: There are no roles in the appication!"); System.out.println("User can`t be created without a role"); return; } long currentTime = System.currentTimeMillis(); User userToBeCreated = new User(); userToBeCreated.setRole(userRoles.get(0)); userToBeCreated.setFirstName("API"); userToBeCreated.setLastName("User "); userToBeCreated.setUsername("ApiUser" + currentTime); userToBeCreated.setPassword("password2010"); userToBeCreated.setNotes("User created through SDK " + currentTime); Permissions permissions = new Permissions(); permissions.setCanManageAllBranches(true); permissions.setCanManageEntitiesAssignedToOtherOfficers(true); userToBeCreated.setPermissions(permissions); User createdUser = usersService.createUser(userToBeCreated); if(createdUser == null){ System.out.println("The new user couldn`t be created!"); return; } System.out.println("Details of the newly created user:"); logIndividualUserDetails(createdUser); }
Source:
private GatewayStatusComparison(ChargeEntity charge, ChargeQueryResponse gatewayQueryResponse) { chargeId = charge.getExternalId(); payStatus = ChargeStatus.fromString(charge.getStatus()); gatewayStatus = gatewayQueryResponse.getMappedStatus().isPresent() ? gatewayQueryResponse.getMappedStatus().get() : null; rawGatewayResponse = gatewayQueryResponse.getRawGatewayResponse(); this.charge = charge; }

Target:
private GatewayStatusComparison(ChargeEntity charge, ChargeQueryResponse gatewayQueryResponse) { chargeId = charge.getExternalId(); payStatus = ChargeStatus.fromString(charge.getStatus()); gatewayStatus = gatewayQueryResponse.getMappedStatus(); rawGatewayResponse = gatewayQueryResponse.getRawGatewayResponse(); this.charge = charge; }
Source:
public static void main(String[] args) throws Exception { Builder builder = Builder.createBuilder(); Streamlet<Integer> zeroes = builder.newSource(() -> 0); builder.newSource(() -> ThreadLocalRandom.current().nextInt(1, 11)) .setNumPartitions(5) .setName("random-ints") .map(i -> i + 1) .setName("add-one") .repartition(2) .setName("repartition") .union(zeroes) .setName("unify-streams") .filter(i -> i != 2) .setName("remove-twos") .log(); Config conf = new Config(); conf.setNumContainers(NUM_CONTAINERS); Resources resources = new Resources(); resources.withCpu(CPU); resources.withRam(ByteAmount.fromGigabytes(GIGABYTES_OF_RAM).asBytes()); conf.setContainerResources(resources); String topologyName = StreamletUtils.getTopologyName(args); new Runner().run(topologyName, conf, builder); }

Target:
public static void main(String[] args) throws Exception { Builder builder = Builder.createBuilder(); Streamlet<Integer> zeroes = builder.newSource(() -> 0); builder.newSource(() -> ThreadLocalRandom.current().nextInt(1, 11)) .setNumPartitions(2) .setName("random-ints") .map(i -> i + 1) .setName("add-one") .union(zeroes) .setName("unify-streams") .filter(i -> i != 2) .setName("remove-twos") .log(); Config conf = new Config(); conf.setNumContainers(NUM_CONTAINERS); Resources resources = new Resources(); resources.withCpu(CPU); resources.withRam(ByteAmount.fromGigabytes(GIGABYTES_OF_RAM).asBytes()); conf.setContainerResources(resources); String topologyName = StreamletUtils.getTopologyName(args); new Runner().run(topologyName, conf, builder); }
Source:
public Future<String> convert(RestRequest restRequest, String input, BlobInfo blobInfo, Callback<String> callback) { final CompletableFuture<String> future = new CompletableFuture<>(); String convertedId = null; Exception exception = null; frontendMetrics.idConverterRequestRate.mark(); long startTimeInMs = System.currentTimeMillis(); try { if (!isOpen) { frontendMetrics.idConverterProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); exception = new RestServiceException("IdConverter is closed", RestServiceErrorCode.ServiceUnavailable); } else if (restRequest.getRestMethod().equals(RestMethod.POST)) { convertedId = "/" + signIdIfRequired(restRequest, input); } else { frontendMetrics.idConverterProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); convertId(input, restRequest, blobInfo).whenComplete( (id, throwable) -> completeConversion(id, extractCompletionExceptionCause(throwable), future, callback)); } } catch (Exception e) { exception = e; } finally { frontendMetrics.idConverterProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); if (convertedId != null || exception != null) { completeConversion(convertedId, exception, future, callback); } } return future; }

Target:
public Future<String> convert(RestRequest restRequest, String input, BlobInfo blobInfo, Callback<String> callback) { final CompletableFuture<String> future = new CompletableFuture<>(); String convertedId = null; Exception exception = null; frontendMetrics.idConverterRequestRate.mark(); long startTimeInMs = System.currentTimeMillis(); try { if (!isOpen) { exception = new RestServiceException("IdConverter is closed", RestServiceErrorCode.ServiceUnavailable); } else if (restRequest.getRestMethod().equals(RestMethod.POST)) { convertedId = "/" + signIdIfRequired(restRequest, input); } else { convertId(input, restRequest, blobInfo).whenComplete( (id, throwable) -> completeConversion(id, extractCompletionExceptionCause(throwable), future, callback)); } } catch (Exception e) { exception = e; } finally { frontendMetrics.idConverterProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); if (convertedId != null || exception != null) { completeConversion(convertedId, exception, future, callback); } } return future; }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PairQueryable other = (PairQueryable) obj; if (getPair() == null) { if (other.getPair() != null) return false; } else if (!getPair().equals(other.getPair())) return false; return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PairQueryable)) { return false; } PairQueryable other = (PairQueryable) obj; if (getPair() == null) { if (other.getPair() != null) { return false; } } else if (!getPair().equals(other.getPair())) { return false; } return true; }
Source:
public VxLanPort bridgeCreateVxLanPort( UUID bridgeId, IPv4Addr mgmtIp, int mgmtPort, int vni, IPv4Addr tunnelIp, UUID tunnelZoneId) throws StateAccessException, SerializationException { BridgeConfig bridgeConfig = bridgeZkManager.get(bridgeId); if (bridgeConfig.vxLanPortId != null) { if (!bridgeConfig.vxLanPortIds.contains(bridgeConfig.vxLanPortId)) { bridgeConfig.vxLanPortIds.add(bridgeConfig.vxLanPortId); log.info("Migrate legacy vxlanPortId on bridge {}", bridgeId); } } for (UUID id: bridgeConfig.vxLanPortIds) { VxLanPort p = (VxLanPort)portsGet(id); if (p.getMgmtIpAddr().equals(mgmtIp)) { throw new IllegalStateException( "Not expected to find a port for vtep " + mgmtIp); } } VxLanPort port = new VxLanPort(bridgeId, mgmtIp, mgmtPort, vni, tunnelIp, tunnelZoneId); PortConfig portConfig = Converter.toPortConfig(port); List<Op> ops = new ArrayList<>(); ops.addAll(portZkManager.prepareCreate(port.getId(), portConfig)); bridgeConfig.vxLanPortIds.add(port.getId()); ops.addAll(bridgeZkManager.prepareUpdate(bridgeId, bridgeConfig)); zkManager.multi(ops); return port; }

Target:
public VxLanPort bridgeCreateVxLanPort( UUID bridgeId, IPv4Addr mgmtIp, int mgmtPort, int vni, IPv4Addr tunnelIp, UUID tunnelZoneId) throws StateAccessException, SerializationException { BridgeConfig bridgeConfig = bridgeZkManager.get(bridgeId); if (bridgeConfig.vxLanPortId != null) { if (!bridgeConfig.vxLanPortIds.contains(bridgeConfig.vxLanPortId)) { bridgeConfig.vxLanPortIds.add(bridgeConfig.vxLanPortId); log.debug("Lazy update of Bridge schema: existing VTEP" + "binding migrated to new schema in {}", bridgeId); } } for (UUID id: bridgeConfig.vxLanPortIds) { VxLanPort p = (VxLanPort)portsGet(id); if (p.getMgmtIpAddr().equals(mgmtIp)) { throw new IllegalStateException( "Not expected to find a port for vtep " + mgmtIp); } } VxLanPort port = new VxLanPort(bridgeId, mgmtIp, mgmtPort, vni, tunnelIp, tunnelZoneId); PortConfig portConfig = Converter.toPortConfig(port); List<Op> ops = new ArrayList<>(); ops.addAll(portZkManager.prepareCreate(port.getId(), portConfig)); bridgeConfig.vxLanPortIds.add(port.getId()); ops.addAll(bridgeZkManager.prepareUpdate(bridgeId, bridgeConfig)); zkManager.multi(ops); return port; }
Source:
public void zkConnectionPolicy_Session() throws Exception { mCluster = MultiProcessCluster.newBuilder(PortCoordination.ZOOKEEPER_CONNECTION_POLICY_SESSION) .setClusterName("ZookeeperConnectionPolicy_Session") .setNumMasters(2) .setNumWorkers(1) .addProperty(PropertyKey.ZOOKEEPER_LEADER_CONNECTION_ERROR_POLICY, "SESSION") .addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS.toString()) .build(); mCluster.start(); int leaderIdx = getPrimaryMasterIndex(); mCluster.restartZk(); int leaderIdx2 = getPrimaryMasterIndex(); assertEquals(leaderIdx, leaderIdx2); mCluster.notifySuccess(); }

Target:
public void zkConnectionPolicy_Session() throws Exception { mCluster = MultiProcessCluster.newBuilder(PortCoordination.ZOOKEEPER_CONNECTION_POLICY_SESSION) .setClusterName("ZookeeperConnectionPolicy_Session") .setNumMasters(2) .setNumWorkers(0) .addProperty(PropertyKey.ZOOKEEPER_LEADER_CONNECTION_ERROR_POLICY, "SESSION") .addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS.toString()) .build(); mCluster.start(); int leaderIdx = getPrimaryMasterIndex(); mCluster.restartZk(); int leaderIdx2 = getPrimaryMasterIndex(); assertEquals(leaderIdx, leaderIdx2); mCluster.notifySuccess(); }
Source:
public static String getPath() { CtfCoreTestPlugin plugin = CtfCoreTestPlugin.getDefault(); if (plugin == null) { return null; } Path tracePath = Paths.get("..", "..", "ctf", "org.eclipse.tracecompass.ctf.core.tests", TRACES_DIRECTORY, TRACE_NAME); tracePath = tracePath.toAbsolutePath(); File file = tracePath.toFile(); if (file.exists()) { deleteTrace(tracePath); } generateLttngKernelTrace(file); return file.getAbsolutePath(); }

Target:
public static String getPath() { CtfCoreTestPlugin plugin = CtfCoreTestPlugin.getDefault(); if (plugin == null) { return null; } Path tracePath = Paths.get("..", "..", "ctf", "org.eclipse.tracecompass.ctf.core.tests", TRACES_DIRECTORY, TRACE_NAME); tracePath = tracePath.toAbsolutePath(); File file = tracePath.toFile(); generateLttngKernelTrace(file); return file.getAbsolutePath(); }
Source:
private static BuiltInFunctionInfo get(String normalizedName, List<ParseNode> children) { initBuiltInFunctionMap(); BuiltInFunctionInfo info = BUILT_IN_FUNCTION_MAP.get(new BuiltInFunctionKey(normalizedName,children.size())); if (info == null) { throw new IllegalArgumentException(normalizedName); } return info; }

Target:
private static BuiltInFunctionInfo get(String normalizedName, List<ParseNode> children) { initBuiltInFunctionMap(); BuiltInFunctionInfo info = BUILT_IN_FUNCTION_MAP.get(new BuiltInFunctionKey(normalizedName,children.size())); if (info == null) { throw new UnknownFunctionException(normalizedName); } return info; }
Source:
public void push(RowMap r) throws Exception { String payload = r.toJSON(outputConfig); ByteArrayContent content = ByteArrayContent.fromString(Json.MEDIA_TYPE, payload); HttpRequest request = requestFactory.buildPostRequest(requestUrl, content); HttpHeaders headers = request.getHeaders(); headers.setContentLength(content.getLength()); headers.setDate(getDateString()); headers.set("digest", digestHeader(DEFAULT_DIGEST_ALGO, DEFAULT_CHARSET, payload)); request.execute(); lastRequest = request; this.context.setPosition(r); }

Target:
public void push(RowMap r) throws Exception { String payload = r.toJSON(outputConfig); ByteArrayContent content = ByteArrayContent.fromString(Json.MEDIA_TYPE, payload); HttpRequest request = requestFactory.buildPostRequest(requestUrl, content); request.execute(); lastRequest = request; this.context.setPosition(r); }
Source:
public LocalizedString getDisplayNames() { if (displayName == null) { String simple = context.getState().getLabel(); if (simple != null) { displayName = resolveExpression(simple); } else if (context.getId() != null) { Map<Locale, Described.State> descriptions = navigation.loadDescriptions(context.getId()); displayName = ObjectFactory.createLocalizedString(descriptions); } } return displayName; }

Target:
public LocalizedString getDisplayNames() { if (displayName == null) { String simple = context.getState().getLabel(); if (simple != null) { displayName = navigation.resolveExpression(simple); } else if (context.getId() != null) { Map<Locale, Described.State> descriptions = navigation.loadDescriptions(context.getId()); displayName = ObjectFactory.createLocalizedString(descriptions); } } return displayName; }
Source:
public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Application creation Workflow."); } ApplicationWorkflowDTO appWorkFlowDTO = (ApplicationWorkflowDTO) workflowDTO; Application application = appWorkFlowDTO.getApplication(); String callBackURL = appWorkFlowDTO.getCallbackUrl(); String message="Approve application ["+ application.getName() +"] creation request from application creator -" +appWorkFlowDTO.getUserName()+" with throttling tier - "+application.getTier(); workflowDTO.setWorkflowDescription(message); workflowDTO.setMetadata("applicationName", application.getName()); workflowDTO.setMetadata("applicationTier", application.getTier()); workflowDTO.setMetadata("applicationCallbackUrl", application.getCallbackUrl()); workflowDTO.setMetadata("applicationDescription", application.getDescription()); workflowDTO.setMetadata("tenantDomain", appWorkFlowDTO.getTenantDomain()); workflowDTO.setMetadata("userName", appWorkFlowDTO.getUserName()); workflowDTO.setMetadata("workflowExternalRef", appWorkFlowDTO.getExternalWorkflowReference()); workflowDTO.setMetadata("callBackURL", callBackURL != null ? callBackURL : "?"); workflowDTO.setProperties("Workflow Process","Application Creation"); super.execute(workflowDTO); return new GeneralWorkflowResponse(); }

Target:
public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Application creation Workflow."); } ApplicationWorkflowDTO appWorkFlowDTO = (ApplicationWorkflowDTO) workflowDTO; Application application = appWorkFlowDTO.getApplication(); String callBackURL = appWorkFlowDTO.getCallbackUrl(); String message = "Approve application [" + application.getName() + "] creation request from application creator -" + appWorkFlowDTO.getUserName() + " with throttling tier - " + application.getTier(); workflowDTO.setWorkflowDescription(message); super.execute(workflowDTO); return new GeneralWorkflowResponse(); }
Source:
public static String cleanUrl(String url) { return url.contains("/#/") ? url.substring(0, url.indexOf("/#/")) : url; }

Target:
public static String cleanUrl(String url) { int index = url.indexOf("/#/"); return index == -1 ? url : url.substring(0, index); }
Source:
public String toString() { return uniqueRuleId; }

Target:
public String toString() { return String.format("%s %s", id, checkType.getName()); }
Source:
public Node visit(PackageDeclaration _n, Object _arg) { List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg); NameExpr name = cloneNodes(_n.getName(), _arg); Comment comment = cloneNodes(_n.getComment(), _arg); PackageDeclaration r = new PackageDeclaration( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), annotations, name ); r.setComment(comment); for (Comment oc : _n.getOrphanComments()) { r.addOrphanComment(oc); } return r; }

Target:
public Node visit(PackageDeclaration _n, Object _arg) { List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg); NameExpr name = cloneNodes(_n.getName(), _arg); Comment comment = cloneNodes(_n.getComment(), _arg); PackageDeclaration r = new PackageDeclaration( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), annotations, name ); r.setComment(comment); addOrphanCommentsToNode(_n, r); return r; }
Source:
public SmudgeFilter(Repository db, InputStream in, OutputStream out) throws IOException { super(in, out); Lfs lfs = new Lfs(db); LfsPointer res = LfsPointer.parseLfsPointer(in); if (res != null) { AnyLongObjectId oid = res.getOid(); Path mediaFile = lfs.getMediaFile(oid); if (!Files.exists(mediaFile)) { downloadLfsResource(lfs, db, res); } in.close(); this.in = Files.newInputStream(mediaFile); } }

Target:
public SmudgeFilter(Repository db, InputStream in, OutputStream out) throws IOException { super(in, out); try { Lfs lfs = new Lfs(db); LfsPointer res = LfsPointer.parseLfsPointer(in); if (res != null) { AnyLongObjectId oid = res.getOid(); Path mediaFile = lfs.getMediaFile(oid); if (!Files.exists(mediaFile)) { downloadLfsResource(lfs, db, res); } this.in = Files.newInputStream(mediaFile); } } finally { in.close(); } }
Source:
public void testAdd() throws Exception { setUriInfo(setUpBasicUriExpectations()); setUpGetPayloadExpectations(1, 2); setUpGetBallooningExpectations(1, 2); setUpGetConsoleExpectations(new int[]{1,2}); setUpEntityQueryExpectations(VdcQueryType.GetVmTemplate, GetVmTemplateParameters.class, new String[] { "Id" }, new Object[] { GUIDS[1] }, getTemplateEntity(0)); setUpEntityQueryExpectations(VdcQueryType.GetVdsGroupByVdsGroupId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getVdsGroupEntity()); setUpCreationExpectations(VdcActionType.AddVm, VmManagementParametersBase.class, new String[] { "StorageDomainId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[2], VdcQueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getEntity(2)); Response response = collection.add(createModel(null)); assertEquals(201, response.getStatus()); assertTrue(response.getEntity() instanceof VM); verifyModel((VM) response.getEntity(), 2); }

Target:
public void testAdd() throws Exception { setUriInfo(setUpBasicUriExpectations()); setUpGetPayloadExpectations(1, 2); setUpGetBallooningExpectations(1, 2); setUpGetCertuficateExpectations(1, 2); setUpGetConsoleExpectations(new int[]{1,2}); setUpEntityQueryExpectations(VdcQueryType.GetVmTemplate, GetVmTemplateParameters.class, new String[] { "Id" }, new Object[] { GUIDS[1] }, getTemplateEntity(0)); setUpEntityQueryExpectations(VdcQueryType.GetVdsGroupByVdsGroupId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getVdsGroupEntity()); setUpCreationExpectations(VdcActionType.AddVm, VmManagementParametersBase.class, new String[] { "StorageDomainId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[2], VdcQueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getEntity(2)); Response response = collection.add(createModel(null)); assertEquals(201, response.getStatus()); assertTrue(response.getEntity() instanceof VM); verifyModel((VM) response.getEntity(), 2); }
Source:
public void doQuery(List<ITmfStateInterval> stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { if (!checkValidTime(t)) { throw new TimeRangeException(); } HTNode currentNode = sht.getRootNode(); currentNode.writeInfoFromNode(stateInfo, t); try { while (currentNode.getNodeType() == HTConfig.CORENODE_TYPE) { currentNode = sht.selectNextChild((CoreNode)currentNode, t); currentNode.writeInfoFromNode(stateInfo, t); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } return; }

Target:
public void doQuery(List<ITmfStateInterval> stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { if (!checkValidTime(t)) { throw new TimeRangeException(); } HTNode currentNode = sht.getRootNode(); currentNode.writeInfoFromNode(stateInfo, t); try { while (currentNode.getNodeType() == HTNode.CORENODE_TYPE) { currentNode = sht.selectNextChild((CoreNode) currentNode, t); currentNode.writeInfoFromNode(stateInfo, t); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } return; }
Source:
boolean selectCommonAncestor(ReadOnlyDocument doc1, ReadOnlyDocument doc2) throws CouchbaseLiteException { if (!c4doc.getRawDoc().selectCommonAncestorRevision(doc1.getRevID(), doc2.getRevID())) return false; setC4Doc(c4doc); return true; }

Target:
boolean selectCommonAncestor(ReadOnlyDocument doc1, ReadOnlyDocument doc2) { if (!c4doc.getRawDoc().selectCommonAncestorRevision(doc1.getRevID(), doc2.getRevID())) return false; setC4Doc(c4doc); return true; }
Source:
public void testViewConversationWebhook() throws GeneralException, NotFoundException, UnauthorizedException { ConversationWebhook conversationWebhookResponse = new ConversationWebhook(); conversationWebhookResponse.setId(WHID); conversationWebhookResponse.setUrl(HTTPS_EXAMPLE_COM_WEBHOOKS); conversationWebhookResponse.setChannelId(CHANID); conversationWebhookResponse.setEvents(Collections.singletonList( ConversationWebhookEvent.MESSAGE_CREATED )); when(mockMessageBirdService.requestByID(CONVERSATIONS_WEBHOOK_URL, WHID, ConversationWebhook.class)) .thenReturn(conversationWebhookResponse); ConversationWebhook conversationWebhook = messageBirdClient.viewConversationWebhook(WHID); assertEquals(WHID, conversationWebhook.getId()); assertEquals(HTTPS_EXAMPLE_COM_WEBHOOKS, conversationWebhook.getUrl()); assertEquals(CHANID, conversationWebhook.getChannelId()); assertEquals(1, conversationWebhook.getEvents().size()); assertEquals(ConversationWebhookEvent.MESSAGE_CREATED, conversationWebhook.getEvents().get(0)); }

Target:
public void testViewConversationWebhook() throws GeneralException, NotFoundException, UnauthorizedException { ConversationWebhook conversationWebhookResponse = createConversationWebhook(); when(mockMessageBirdService.requestByID(CONVERSATIONS_WEBHOOK_URL, WHID, ConversationWebhook.class)) .thenReturn(conversationWebhookResponse); ConversationWebhook conversationWebhook = messageBirdClient.viewConversationWebhook(WHID); assertEquals(WHID, conversationWebhook.getId()); assertEquals(HTTPS_EXAMPLE_COM_WEBHOOKS, conversationWebhook.getUrl()); assertEquals(CHANID, conversationWebhook.getChannelId()); assertEquals(1, conversationWebhook.getEvents().size()); assertEquals(ConversationWebhookEvent.MESSAGE_CREATED, conversationWebhook.getEvents().get(0)); }
Source:
public void testEqualsAndHashCode() { LongProperty test1 = new LongProperty(TestModel.TABLE, "testCol"); LongProperty test2 = new LongProperty(TestModel.TABLE, "testCol"); assertEquals(test1, test2); assertEquals(test1.hashCode(), test2.hashCode()); StringProperty test3 = new StringProperty(TestModel.TABLE, "testCol"); StringProperty test4 = new StringProperty(TestModel.TABLE, "testCol", "DEFAULT 'A"); assertEquals(test3, test4); assertEquals(test3.hashCode(), test4.hashCode()); Function<Integer> func1 = Function.count(); Function<Integer> func2 = Function.rawFunction("COUNT(*)"); assertEquals(func1, func2); assertEquals(func1.hashCode(), func2.hashCode()); IntegerProperty test5 = Property.IntegerProperty.fromFunction(func1, "count"); IntegerProperty test6 = Property.IntegerProperty.fromFunction(func2, "count"); assertEquals(test5, test6); assertEquals(test5.hashCode(), test6.hashCode()); }

Target:
public void testEqualsAndHashCode() { LongProperty test1 = new LongProperty(TestModel.TABLE, "testCol"); LongProperty test2 = new LongProperty(TestModel.TABLE, "testCol"); assertEquals(test1, test2); assertEquals(test1.hashCode(), test2.hashCode()); StringProperty test3 = new StringProperty(TestModel.TABLE, "testCol"); StringProperty test4 = new StringProperty(TestModel.TABLE, "testCol", "DEFAULT 'A'"); assertEquals(test3, test4); assertEquals(test3.hashCode(), test4.hashCode()); Function<Integer> func1 = Function.count(); Function<Integer> func2 = Function.rawFunction("COUNT(*)"); assertEquals(func1, func2); assertEquals(func1.hashCode(), func2.hashCode()); IntegerProperty test5 = Property.IntegerProperty.fromFunction(func1, "count"); IntegerProperty test6 = Property.IntegerProperty.fromFunction(func2, "count"); assertEquals(test5, test6); assertEquals(test5.hashCode(), test6.hashCode()); }
Source:
public boolean quotaExceeded(IOException e) { ErrorInfo errorInfo = getErrorInfo(e); if(errorInfo !=null){ return Quota_Exceeded_REASON.equals(errorInfo.getReason()); } return false; }

Target:
public boolean quotaExceeded(IOException e) { ErrorInfo errorInfo = getErrorInfo(e); if (errorInfo != null) { return QUOTA_EXCEEDED_REASON.equals(errorInfo.getReason()); } return false; }