auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
private ObjectType findNextNode() { while (true) { if ((inner == null) || !inner.hasNext()) { if (outer.hasNext()) { inner = outer.next().getValue().iterator(); } else { return null; } } while (inner.hasNext()) { return inner.next(); } } }

Target:
private Optional<ObjectType> findNextNode() { while (true) { if ((inner == null) || !inner.hasNext()) { if (outer.hasNext()) { inner = outer.next().getValue().iterator(); } else { return Optional.empty(); } } while (inner.hasNext()) { return Optional.of(inner.next()); } } }
Source:
public void testAutoSyncWithNewSessionEstablishment() throws Exception { final String path = "/" + TestHelper.getTestMethodName(); final String data = "Hello Helix 2"; Assert.assertTrue(TestHelper .verify(() -> _zkClient.getConnection().getZookeeperState().isConnected(), 1000L)); final long originalSessionId = _zkClient.getSessionId(); try { _zkClient.create(path, data, CreateMode.PERSISTENT); } catch (Exception ex) { Assert.fail("Failed to create ephemeral node.", ex); } ZkTestHelper.expireSession(_zkClient); Assert.assertTrue(TestHelper.verify(() -> { try { return _zkClient.getSessionId() != originalSessionId; } catch (ZkClientException ex) { return false; } }, 1000L)); Stat stat = new Stat(); String nodeData = null; try { nodeData = _zkClient.readData(path, stat, true); } catch (ZkException e) { Assert.fail("fail to read data"); } Assert.assertEquals(nodeData, data, "Data is not correct."); }

Target:
public void testAutoSyncWithNewSessionEstablishment() throws Exception { final String path = "/" + TestHelper.getTestMethodName(); final String data = "Hello Helix 2"; Assert.assertTrue(_zkClient.waitUntilConnected(1, TimeUnit.SECONDS)); final long originalSessionId = _zkClient.getSessionId(); try { _zkClient.create(path, data, CreateMode.PERSISTENT); } catch (Exception ex) { Assert.fail("Failed to create ephemeral node.", ex); } ZkTestHelper.expireSession(_zkClient); Stat stat = new Stat(); String nodeData = null; try { nodeData = _zkClient.readData(path, stat, true); } catch (ZkException e) { Assert.fail("fail to read data"); } Assert.assertEquals(nodeData, data, "Data is not correct."); }
Source:
public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl sess, AuditEvent message) throws InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException { List<AuditEvent> resolvingMessages = new ArrayList<>(); if (message == null) return resolvingMessages; if (message instanceof DirectMemberAddedToGroup) { resolvingMessages.addAll(resolveDirectMemberAddedToGroup(sess, (DirectMemberAddedToGroup) message)); } else if (message instanceof MemberRemovedFromGroupTotally) { resolvingMessages.addAll(resolveMemberRemovedFromGroupTotally(sess, (MemberRemovedFromGroupTotally) message)); } return resolvingMessages; }

Target:
public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl sess, AuditEvent message) throws InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException { List<AuditEvent> resolvingMessages = new ArrayList<>(); if (message == null) return resolvingMessages; if (message instanceof DirectMemberAddedToGroup) { resolvingMessages.addAll(resolveEvent(sess, ((DirectMemberAddedToGroup) message).getMember())); } else if (message instanceof IndirectMemberAddedToGroup) { resolvingMessages.addAll(resolveEvent(sess, ((IndirectMemberAddedToGroup) message).getMember())); } else if (message instanceof MemberRemovedFromGroupTotally) { resolvingMessages.addAll(resolveEvent(sess, ((MemberRemovedFromGroupTotally) message).getMember())); } return resolvingMessages; }
Source:
public PowerMeter(final Simulation simulation, final PowerAware<? extends PowerModel> powerAwareEntity) { this(simulation, new ArrayList<>(Arrays.asList(powerAwareEntity))); }

Target:
public PowerMeter(final Simulation simulation, final PowerAware<? extends PowerModel> powerAwareEntity) { this(simulation, Arrays.asList(powerAwareEntity)); }
Source:
private void recipeBattery() { addRecipe(findItemStack("Cost Oriented Battery"), "C C", "PPP", "PPP", 'C', findItemStack("Low Voltage Cable"), 'P', "ingotLead", 'I', new ItemStack(Items.iron_ingot)); addRecipe(findItemStack("Capacity Oriented Battery"), "PBP", 'B', findItemStack("Cost Oriented Battery"), 'P', "ingotLead"); addRecipe(findItemStack("Voltage Oriented Battery"), "PBP", 'B', findItemStack("Cost Oriented Battery"), 'P', new ItemStack(Items.iron_ingot)); addRecipe(findItemStack("Current Oriented Battery"), "PBP", 'B', findItemStack("Cost Oriented Battery"), 'P', "ingotCopper"); addRecipe(findItemStack("Life Oriented Battery"), "PBP", 'B', findItemStack("Cost Oriented Battery"), 'P', new ItemStack(Items.gold_ingot)); addRecipe(findItemStack("Experimental Battery"), " S ", "LDV", " C ", 'S', findItemStack("Capacity Oriented Battery"), 'L', findItemStack("Life Oriented Battery"), 'V', findItemStack("Voltage Oriented Battery"), 'C', findItemStack("Current Oriented Battery"), 'D', new ItemStack(Items.diamond)); addRecipe(findItemStack("Single-use Battery"), "ppp", "III", "ppp", 'C', findItemStack("Low Voltage Cable"), 'p', new ItemStack(Items.coal, 1, 0), 'I', "ingotCopper"); addRecipe(findItemStack("Single-use Battery"), "ppp", "III", "ppp", 'C', findItemStack("Low Voltage Cable"), 'p', new ItemStack(Items.coal, 1, 1), 'I', "ingotCopper"); }

Target:
private void recipeBattery() { addRecipe(findItemStack("Cost Oriented Battery"), "C C", "PPP", "PPP", 'C', findItemStack("Standard Low Voltage Cable"), 'P', "ingotLead", 'I', new ItemStack(Items.iron_ingot)); addRecipe(findItemStack("Capacity Oriented Battery"), "PBP", 'B', findItemStack("Cost Oriented Battery"), 'P', "ingotLead"); addRecipe(findItemStack("Voltage Oriented Battery"), "PBP", 'B', findItemStack("Cost Oriented Battery"), 'P', findItemStack("Iron Cable")); addRecipe(findItemStack("Current Oriented Battery"), "PBP", 'B', findItemStack("Cost Oriented Battery"), 'P', "ingotCopper"); addRecipe(findItemStack("Life Oriented Battery"), "PBP", 'B', findItemStack("Cost Oriented Battery"), 'P', new ItemStack(Items.gold_ingot)); addRecipe(findItemStack("Experimental Battery"), " S ", "LDV", " C ", 'S', findItemStack("Capacity Oriented Battery"), 'L', findItemStack("Life Oriented Battery"), 'V', findItemStack("Voltage Oriented Battery"), 'C', findItemStack("Current Oriented Battery"), 'D', new ItemStack(Items.diamond)); addRecipe(findItemStack("Single-use Battery"), "ppp", "III", "ppp", 'C', findItemStack("Standard Low Voltage Cable"), 'p', new ItemStack(Items.coal, 1, 0), 'I', "ingotCopper"); addRecipe(findItemStack("Single-use Battery"), "ppp", "III", "ppp", 'C', findItemStack("Shoddy Low Voltage Cable"), 'p', new ItemStack(Items.coal, 1, 1), 'I', "ingotCopper"); }
Source:
private ResourceChangeDetector getChangeDetector() { if (_changeDetector.get() == null) { _changeDetector.set(new ResourceChangeDetector()); } return _changeDetector.get(); }

Target:
private ResourceChangeDetector getChangeDetector() { if (CHANGE_DETECTOR_THREAD_LOCAL.get() == null) { CHANGE_DETECTOR_THREAD_LOCAL.set(new ResourceChangeDetector()); } return CHANGE_DETECTOR_THREAD_LOCAL.get(); }
Source:
public void acquire( Channel channel ) throws TransportThrottleException { if ( !isDurationAlreadyExceeded( channel ) ) { ThrottleLock lock = channel.attr( LOCK_KEY ).get(); long startTimeMillis = 0; while ( channel.isOpen() && !channel.isWritable() ) { if ( maxLockDuration > 0 ) { long currentTimeMillis = clock.millis(); if ( startTimeMillis == 0 ) { startTimeMillis = currentTimeMillis; } else { if ( currentTimeMillis - startTimeMillis > maxLockDuration ) { setDurationExceeded( channel ); throw new TransportThrottleException( String.format( "Bolt connection [%s] will be closed because the client did not consume outgoing buffers for %s which is not expected.", channel.remoteAddress(), DurationFormatUtils.formatDurationHMS( maxLockDuration ) ) ); } } } try { lock.lock( channel, 1000 ); } catch ( InterruptedException ex ) { Thread.currentThread().interrupt(); } } } }

Target:
public void acquire( Channel channel ) throws TransportThrottleException { if ( !isDurationAlreadyExceeded( channel ) ) { ThrottleLock lock = channel.attr( LOCK_KEY ).get(); long startTimeMillis = 0; while ( channel.isOpen() && !channel.isWritable() ) { if ( maxLockDuration > 0 ) { long currentTimeMillis = clock.millis(); if ( startTimeMillis == 0 ) { startTimeMillis = currentTimeMillis; } else { if ( currentTimeMillis - startTimeMillis > maxLockDuration ) { setDurationExceeded( channel ); throw new TransportThrottleException( String.format( "Bolt connection [%s] will be closed because the client did not consume outgoing buffers for %s which is not expected.", channel.remoteAddress(), DurationFormatUtils.formatDurationHMS( maxLockDuration ) ) ); } } } try { lock.lock( channel, 1000 ); } catch ( InterruptedException ex ) { Thread.currentThread().interrupt(); throw new RuntimeException( ex ); } } } }
Source:
public PagedMessage getMessage(int messageNumber) { if (messageNumber < 0) { return null; } long size = lastSeenProducerIndex; if (messageNumber >= size) { while ((size = producerIndex) == RESIZING) { Thread.yield(); } if (messageNumber >= size) { return null; } LAST_PRODUCER_INDEX_UPDATER.lazySet(this, size); } final AtomicChunk<PagedMessage> buffer; final int offset; if (messageNumber >= chunkSize) { offset = messageNumber & chunkMask; buffer = jump(messageNumber, size); } else { offset = messageNumber; buffer = consumerBuffer; } PagedMessage msg; while ((msg = buffer.get(offset)) == null) { Thread.yield(); } return msg; }

Target:
public PagedMessage getMessage(int messageNumber) { return messages.get(messageNumber); }
Source:
private void autoClose(Object object) { if (object instanceof AutoCloseable) { close((AutoCloseable) object); } else if (object instanceof AtomicBoolean) { toFalse((AtomicBoolean) object); } else if (object instanceof CountDownLatch) { openLatch((CountDownLatch) object); } else if (hasMethod(object.getClass(), "close")) { invokeMethod(object, "close"); } else if (hasMethod(object.getClass(), "disconnect")) { invokeMethod(object, "disconnect"); } else if (hasMethod(object.getClass(), "stop")) { invokeMethod(object, "stop"); } }

Target:
private void autoClose(Object object) { if (object instanceof AutoCloseable) { close((AutoCloseable) object); } else if (object instanceof AtomicBoolean) { close((AtomicBoolean) object); } else if (object instanceof CountDownLatch) { close((CountDownLatch) object); } else if (hasMethod(object.getClass(), "close")) { invokeMethod(object, "close"); } else if (hasMethod(object.getClass(), "disconnect")) { invokeMethod(object, "disconnect"); } else if (hasMethod(object.getClass(), "stop")) { invokeMethod(object, "stop"); } }
Source:
public void aSynchronizeTimeActionIsPartOfABundledRequest(final Map<String, String> settings) throws Throwable { final BundleRequest request = (BundleRequest) ScenarioContext.Current().get(SCENARIO_CONTEXT_BUNDLE_REQUEST); final SynchronizeTimeRequest action = new SynchronizeTimeRequest(); action.setDeviation(-60); action.setDst(false); request.getActions().getActionList().add(action); this.increaseCount(SCENARIO_CONTEXT_BUNDLE_ACTIONS); }

Target:
public void aSynchronizeTimeActionIsPartOfABundledRequest(final Map<String, String> settings) throws Throwable { final BundleRequest request = (BundleRequest) ScenarioContext.Current().get(SCENARIO_CONTEXT_BUNDLE_REQUEST); final SynchronizeTimeRequest action = this.defaultMapper .map(SynchronizeTimeRequestDataFactory.fromParameterMap(settings), SynchronizeTimeRequest.class); request.getActions().getActionList().add(action); this.increaseCount(SCENARIO_CONTEXT_BUNDLE_ACTIONS); }
Source:
private DescribeAclsResponse createDescribeAclsResponse() { return DescribeAclsResponse.prepareResponse(0, ApiError.NONE, Collections.singleton(new AclBinding( new ResourcePattern(ResourceType.TOPIC, "mytopic", PatternType.LITERAL), new AccessControlEntry("User:ANONYMOUS", "*", AclOperation.WRITE, AclPermissionType.ALLOW)))); }

Target:
private DescribeAclsResponse createDescribeAclsResponse() { DescribeAclsResponseData data = new DescribeAclsResponseData() .setErrorCode(Errors.NONE.code()) .setErrorMessage(Errors.NONE.message()) .setThrottleTimeMs(0) .setResources(Collections.singletonList(new DescribeAclsResource() .setType(ResourceType.TOPIC.code()) .setName("mytopic") .setPatternType(PatternType.LITERAL.code()) .setAcls(Collections.singletonList(new AclDescription() .setHost("*") .setOperation(AclOperation.WRITE.code()) .setPermissionType(AclPermissionType.ALLOW.code()) .setPrincipal("User:ANONYMOUS"))))); return new DescribeAclsResponse(data); }
Source:
private synchronized void initContext(ClientContext ctx, MasterInquireClient masterInquireClient) { mClosed.set(false); mMasterClientContext = MasterClientContext.newBuilder(ctx) .setMasterInquireClient(masterInquireClient).build(); mMetricsEnabled = getClusterConf().getBoolean(PropertyKey.USER_METRICS_COLLECTION_ENABLED); if (mMetricsEnabled) { if (CommonUtils.PROCESS_TYPE.get() != CommonUtils.ProcessType.MASTER) { try { InetSocketAddress masterAddr = masterInquireClient.getPrimaryRpcAddress(); mMasterClientContext.loadConf(masterAddr, true, true); } catch (UnavailableException e) { LOG.error("Failed to get master address during initialization", e); } catch (AlluxioStatusException ae) { LOG.error("Failed to load configuration from " + "meta master during initialization", ae); } } MetricsSystem.startSinks(getClusterConf().get(PropertyKey.METRICS_CONF_FILE)); MetricsHeartbeatContext.addHeartbeat(getClientContext(), masterInquireClient); } mFileSystemMasterClientPool = new FileSystemMasterClientPool(mMasterClientContext); mBlockMasterClientPool = new BlockMasterClientPool(mMasterClientContext); mWorkerGroup = NettyUtils.createEventLoop(NettyUtils.getUserChannel(getClusterConf()), getClusterConf().getInt(PropertyKey.USER_NETWORK_NETTY_WORKER_THREADS), String.format("alluxio-client-nettyPool-%s-%%d", mId), true); mUriValidationEnabled = ctx.getUriValidationEnabled(); }

Target:
private synchronized void initContext(ClientContext ctx, MasterInquireClient masterInquireClient) { mClosed.set(false); mMasterClientContext = MasterClientContext.newBuilder(ctx) .setMasterInquireClient(masterInquireClient).build(); mMetricsEnabled = getClusterConf().getBoolean(PropertyKey.USER_METRICS_COLLECTION_ENABLED); if (mMetricsEnabled) { MetricsSystem.startSinks(getClusterConf().get(PropertyKey.METRICS_CONF_FILE)); MetricsHeartbeatContext.addHeartbeat(getClientContext(), masterInquireClient); } mFileSystemMasterClientPool = new FileSystemMasterClientPool(mMasterClientContext); mBlockMasterClientPool = new BlockMasterClientPool(mMasterClientContext); mWorkerGroup = NettyUtils.createEventLoop(NettyUtils.getUserChannel(getClusterConf()), getClusterConf().getInt(PropertyKey.USER_NETWORK_NETTY_WORKER_THREADS), String.format("alluxio-client-nettyPool-%s-%%d", mId), true); mUriValidationEnabled = ctx.getUriValidationEnabled(); }
Source:
public static <T> T defaultValueForClass(final Class<T> clazz) { if (clazz == Float.class) { return (T) defaultFloatValue(); } else if (clazz == Double.class) { return (T) defaultDoubleValue(); } else if (clazz == Long.class) { return (T) defaultLongValue(); } else if (clazz == String.class) { return (T) defaultStringValue(); } else { return null; } }

Target:
public static <T> T defaultValueForClass(final Class<T> clazz) { if (clazz == Float.class) { return (T) defaultFloatValue(); } else if (clazz == Double.class) { return (T) defaultDoubleValue(); } else if (clazz == Long.class) { return (T) defaultLongValue(); } else if (clazz == Number.class) { return (T) defaultDoubleValue(); } else if (clazz == String.class) { return (T) defaultStringValue(); } else { return null; } }
Source:
protected ICommand getAfterSetCommand(SetRequest request) { CompositeCommand compositeCommand = new CompositeCommand("Set RTPort Name and Kind"); EStructuralFeature feature = request.getFeature(); if (UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature)) { Object newValue = request.getValue(); EObject elementToEdit = request.getElementToEdit(); if ((newValue instanceof Type) && (elementToEdit instanceof Port)) { Port port = (Port) elementToEdit; if (SystemElementsUtils.isSystemProtocol((Collaboration) newValue)) { ICommand cmd = getSetSAPKindCommand(port); if (null != cmd) { compositeCommand.add(cmd); } } if (Strings.isNullOrEmpty(((Port) elementToEdit).getName()) || NewElementUtil.isCreatedElement(elementToEdit)) { String name = ((Type) newValue).getName(); if (!Strings.isNullOrEmpty(name)) { String newName = NewElementUtil.getUniqueName(port, (Type) newValue); ICommand result = new SetValueCommand(new SetRequest(request.getElementToEdit(), UMLPackage.eINSTANCE.getNamedElement_Name(), newName)); if (null != result) { compositeCommand.add(result); } } } } } return compositeCommand.isEmpty() ? super.getAfterSetCommand(request) : compositeCommand; }

Target:
protected ICommand getAfterSetCommand(SetRequest request) { CompositeCommand compositeCommand = new CompositeCommand("Set RTPort Name and Kind"); EStructuralFeature feature = request.getFeature(); if (UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature)) { Object newValue = request.getValue(); EObject elementToEdit = request.getElementToEdit(); if ((newValue instanceof Type) && (elementToEdit instanceof Port)) { Port port = (Port) elementToEdit; if (SystemElementsUtils.isSystemProtocol((Collaboration) newValue)) { ICommand cmd = getSetSAPKindCommand(port); if (null != cmd) { compositeCommand.add(cmd); } } if (Strings.isNullOrEmpty(((Port) elementToEdit).getName()) || NewElementUtil.isCreatedElement(elementToEdit)) { String name = ((Type) newValue).getName(); if (!Strings.isNullOrEmpty(name)) { String newName = NewElementUtil.getUniqueName(port, (Type) newValue); ICommand setNameCommand = new SetValueCommand(new SetRequest(request.getElementToEdit(), UMLPackage.eINSTANCE.getNamedElement_Name(), newName)); if (null != setNameCommand) { compositeCommand.add(setNameCommand); } } } } } return compositeCommand.isEmpty() ? super.getAfterSetCommand(request) : compositeCommand; }
Source:
public Map destroy(String vmId) { final VM vm = getActiveHost().getRunningVMs().get(vmId); if (vm == null) { log.info("VM not found: " + vmId); throw new RuntimeException("VM not found: " + vmId); } vm.setStatus(VM.VMStatus.PoweringDown); Map resultMap = map(); Map statusMap = map(); new TaskWrapper().addTask(TaskType.SHUTDOWN_VM, 5000l, vm); statusMap.put("message", "Machine destroyed"); statusMap.put("code", "0"); resultMap.put("status", statusMap); return resultMap; }

Target:
public Map destroy(String vmId) { final VM vm = getActiveHost().getRunningVMs().get(vmId); if (vm == null) { log.info("VM not found: " + vmId); throw new RuntimeException("VM not found: " + vmId); } vm.setStatus(VM.VMStatus.PoweringDown); Map resultMap = map(); Map statusMap = map(); TaskWrapper.addTask(TaskType.SHUTDOWN_VM, 5000l, vm); statusMap.put("message", "Machine destroyed"); statusMap.put("code", "0"); resultMap.put("status", statusMap); return resultMap; }
Source:
private JsonObject applyImplicitNested(JsonObject partialResult, List<String> nestedPathHierarchy, ElasticsearchSearchPredicateContext context) { if ( nestedPathHierarchy.isEmpty() ) { return partialResult; } String lastPath = nestedPathHierarchy.remove( 0 ); if ( context.isExplicitNested( lastPath ) ) { return applyImplicitNested( partialResult, nestedPathHierarchy, context ); } JsonObject innerObject = new JsonObject(); PATH_ACCESSOR.set( innerObject, lastPath ); QUERY_ACCESSOR.set( innerObject, applyImplicitNested( partialResult, nestedPathHierarchy, context ) ); JsonObject outerObject = new JsonObject(); outerObject.add( "nested", innerObject ); return outerObject; }

Target:
public static JsonObject applyImplicitNested(JsonObject partialResult, List<String> nestedPathHierarchy, ElasticsearchSearchPredicateContext context) { JsonObject result = partialResult; for ( int i = 0; i < nestedPathHierarchy.size(); i++ ) { String path = nestedPathHierarchy.get( nestedPathHierarchy.size() - 1 - i ); if ( path.equals( context.getNestedPath() ) ) { break; } JsonObject innerObject = new JsonObject(); PATH_ACCESSOR.set( innerObject, path ); QUERY_ACCESSOR.set( innerObject, result ); JsonObject outerObject = new JsonObject(); outerObject.add( "nested", innerObject ); result = outerObject; } return result; }
Source:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); boolean initSucceeded = true; if (vdsGroup.supportsTrustedService()) { setSucceeded(initTrustedService()); } if (vdsGroup.supportsVirtService()) { initSucceeded = initVirtResources(); } if (initSucceeded && vdsGroup.supportsGlusterService()) { initSucceeded = initGlusterHost(); } setSucceeded(initSucceeded); }

Target:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); boolean initSucceeded = true; if (vdsGroup.supportsTrustedService()) { initSucceeded = initTrustedService(); } if (initSucceeded && vdsGroup.supportsVirtService()) { initSucceeded = initVirtResources(); } if (initSucceeded && vdsGroup.supportsGlusterService()) { initSucceeded = initGlusterHost(); } setSucceeded(initSucceeded); }
Source:
public PluginIsolatedClassloader(String jarDir) throws FreedomoticException { super(Thread.currentThread().getContextClassLoader()); FileFilter jarFilter = (File pathname) -> pathname.getName().endsWith(".jar"); File[] jarFiles = new File(jarDir).listFiles(jarFilter); URL[] urls; if (null != jarFiles) { urls = new URL[jarFiles.length]; for (int i = 0; i < jarFiles.length; i++) { try { urls[i] = jarFiles[i].toURI().toURL(); } catch (MalformedURLException e) { throw new FreedomoticException( "Could not get URL for JAR file: " + jarFiles[i], e); } } } else { urls = new URL[0]; } childClassLoader = new ChildURLClassLoader(urls, this.getParent()); }

Target:
public PluginIsolatedClassloader(String jarDir) { super(Thread.currentThread().getContextClassLoader()); File[] jarFiles = new File(jarDir).listFiles((File pathname) -> pathname.getName().endsWith(".jar")); URL[] urls; if (null != jarFiles) { urls = new URL[jarFiles.length]; for (int i = 0; i < jarFiles.length; i++) { try { urls[i] = jarFiles[i].toURI().toURL(); } catch (MalformedURLException e) { throw new FreedomoticRuntimeException( "Could not get URL for JAR file: " + jarFiles[i]); } } } else { urls = new URL[0]; } childClassLoader = new ChildURLClassLoader(urls, this.getParent()); }
Source:
public JsonObject getNearestPlace(BigDecimal latitude, BigDecimal longitude) throws IOException, MalformedURLException { JsonObject places = this.getEventPlaces(latitude, longitude); JsonArray features = places.getJsonArray("features"); JsonObject feature = features.get(0).asJsonObject(); return feature; }

Target:
public JsonObject getNearestPlace(BigDecimal latitude, BigDecimal longitude) throws IOException, MalformedURLException { JsonObject places = this.getEventPlaces(latitude, longitude); JsonObject feature = places.getJsonArray("features").getJsonObject(0); return feature; }
Source:
DeferredRequestCreator(RequestCreator creator, ImageView target) { this(creator, target, null); }

Target:
@TestOnly DeferredRequestCreator(RequestCreator creator, ImageView target) { this(creator, target, null); }
Source:
public TestAccumuloDistributedQueries() { super(() -> createAccumuloQueryRunner(ImmutableMap.of()), FeatureSelection.allFeatures().excluding(ADD_COLUMN, DROP_COLUMN, DELETE)); }

Target:
public TestAccumuloDistributedQueries() { super(allFeatures().excluding(ADD_COLUMN, DROP_COLUMN, DELETE_DATA), () -> createAccumuloQueryRunner(ImmutableMap.of())); }
Source:
public MarkerItem getMarkerItem(IMarker marker) { Map<IMarker, MarkerEntry> entryMap = markerToEntryMap; if (entryMap == null) { entryMap = new HashMap<>(); for (MarkerEntry markerEntry : markerEntryArray) { IMarker nextMarker = markerEntry.getMarker(); if (nextMarker != null) { entryMap.put(nextMarker, markerEntry); } } markerToEntryMap = entryMap; } if (entryMap.containsKey(marker)) { return entryMap.get(marker); } return null; }

Target:
public synchronized MarkerItem getMarkerItem(IMarker marker) { if (markerToEntryMap == null) { markerToEntryMap = new HashMap<>(); for (MarkerEntry markerEntry : markerEntryArray) { IMarker nextMarker = markerEntry.getMarker(); if (nextMarker != null) { markerToEntryMap.put(nextMarker, markerEntry); } } } if (markerToEntryMap.containsKey(marker)) { return markerToEntryMap.get(marker); } return null; }
Source:
public static void main(final String[] args) { final CommandLine application = new CommandLine(new MantaCLI()); application.registerConverter(Path.class, s -> Paths.get(s)); List<CommandLine> parsedCommands = null; try { parsedCommands = application.parse(args); } catch (CommandLine.ParameterException ex) { System.err.println(ex.getMessage()); CommandLine.usage(new MantaCLI(), System.err); return; } MantaCLI cli = (MantaCLI) parsedCommands.get(0).getCommand(); if (cli.isHelpRequested) { application.usage(System.out); return; } if (cli.isVersionRequested) { System.out.println("java-manta-client: " + MantaVersion.VERSION); return; } if (parsedCommands.size() == 1) { application.usage(System.err); return; } CommandLine deepest = parsedCommands.get(parsedCommands.size() - 1); MantaSubCommand subcommand = (MantaSubCommand) deepest.getCommand(); if (subcommand.isHelpRequested) { CommandLine.usage(deepest.getCommand(), System.err); return; } if (subcommand.logLevel != null) { Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.setLevel(Level.valueOf(subcommand.logLevel.toString())); } subcommand.run(); }

Target:
public static void main(final String[] args) { final CommandLine application = new CommandLine(new MantaCLI()); application.registerConverter(Path.class, Paths::get); List<CommandLine> parsedCommands = null; try { parsedCommands = application.parse(args); } catch (CommandLine.ParameterException ex) { System.err.println(ex.getMessage()); CommandLine.usage(new MantaCLI(), System.err); return; } MantaCLI cli = (MantaCLI) parsedCommands.get(0).getCommand(); if (cli.isHelpRequested) { application.usage(System.out); return; } if (cli.isVersionRequested) { System.out.println("java-manta-client: " + MantaVersion.VERSION); return; } if (parsedCommands.size() == 1) { application.usage(System.err); return; } CommandLine deepest = parsedCommands.get(parsedCommands.size() - 1); MantaSubCommand subcommand = (MantaSubCommand) deepest.getCommand(); if (subcommand.isHelpRequested) { CommandLine.usage(deepest.getCommand(), System.err); return; } if (subcommand.logLevel != null) { Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.setLevel(Level.valueOf(subcommand.logLevel.toString())); } subcommand.run(); }
Source:
public static HTTPMonitoringConfig build() { ConfigProvider configProvider = DataHolder.getInstance().getConfigProvider(); HTTPMonitoringConfig configurationObject = null; if (configProvider == null) { if (DataHolder.getInstance().getBundleContext() != null) { throw new RuntimeException( "Failed to populate HTTPMonitoringConfig Configuration. Config Provider is Null."); } String deploymentYamlPath = System.getProperty(DEPLOYMENT_YAML_SYS_PROPERTY); if (deploymentYamlPath == null || deploymentYamlPath.isEmpty()) { logger.info("System property '" + DEPLOYMENT_YAML_SYS_PROPERTY + "' is not set. Default deployment.yaml file will be used."); deploymentYamlPath = HTTPMonitoringConfig.class.getResource("/deployment.yaml").getPath(); } else if (!Files.exists(Paths.get(deploymentYamlPath))) { String msg = "Couldn't find " + deploymentYamlPath; throw new RuntimeException(msg); } try { configProvider = ConfigProviderFactory.getConfigProvider(Paths.get(deploymentYamlPath), null); DataHolder.getInstance().setConfigProvider(configProvider); } catch (ConfigurationException e) { throw new RuntimeException("Error loading deployment.yaml Configuration", e); } } try { configurationObject = DataHolder.getInstance().getConfigProvider().getConfigurationObject(HTTPMonitoringConfig.class); } catch (ConfigurationException e) { logger.error("Error loading configurations from deployment.yaml", e); configurationObject = new HTTPMonitoringConfig(); } return configurationObject; }

Target:
public static HTTPMonitoringConfig build() { ConfigProvider configProvider = DataHolder.getInstance().getConfigProvider(); HTTPMonitoringConfig configurationObject; if (configProvider == null) { if (DataHolder.getInstance().getBundleContext() != null) { throw new RuntimeException( "Failed to populate HTTPMonitoringConfig Configuration. Config Provider is Null."); } String deploymentYamlPath = System.getProperty(DEPLOYMENT_YAML_SYS_PROPERTY); if (deploymentYamlPath == null || deploymentYamlPath.isEmpty()) { logger.info("System property '" + DEPLOYMENT_YAML_SYS_PROPERTY + "' is not set. Default deployment.yaml file will be used."); deploymentYamlPath = HTTPMonitoringConfig.class.getResource("/" + DEPLOYMENT_YAML_FILE).getPath(); } else if (!Files.exists(Paths.get(deploymentYamlPath))) { throw new RuntimeException("Couldn't find " + deploymentYamlPath); } try { configProvider = ConfigProviderFactory.getConfigProvider(Paths.get(deploymentYamlPath), null); DataHolder.getInstance().setConfigProvider(configProvider); } catch (ConfigurationException e) { throw new RuntimeException("Error loading deployment.yaml Configuration", e); } } try { configurationObject = DataHolder.getInstance().getConfigProvider().getConfigurationObject(HTTPMonitoringConfig.class); } catch (ConfigurationException e) { throw new RuntimeException( "Error while loading " + HTTPMonitoringConfig.class.getName() + " from config provider", e); } return configurationObject; }
Source:
private boolean sendSlackMessage(String channelName, SlackAttachment attachment) { if (!slackSession.isPresent()) { LOG.debug("No slack session present, not sending message to channel {}", attachment.toString(), channelName); return true; } Optional<SlackChannel> slackChannel = Optional.fromNullable(slackSession.get().findChannelByName(channelName)); if (!slackChannel.isPresent()) { LOG.warn("No slack channel found for name {}", channelName); return false; } SlackMessageHandle<SlackMessageReply> result = slackSession.get().sendMessage(slackChannel.get(), "", attachment); if (!result.getReply().isOk()) { LOG.warn("Failed to send slack message to channel: message: error: {}", channelName, attachment.toString(), result.getReply().getErrorMessage()); return false; } return true; }

Target:
private boolean sendSlackMessage(String channelName, SlackAttachment attachment) { if (!slackSession.isPresent()) { LOG.debug("No slack session present, not sending message to channel {}", attachment.toString(), channelName); return true; } Optional<SlackChannel> slackChannel = Optional.fromNullable(slackSession.get().findChannelByName(channelName)); if (!slackChannel.isPresent()) { LOG.warn("No slack channel found for name {}", channelName); return false; } SlackMessageHandle<SlackMessageReply> result = slackSession.get().sendMessage(slackChannel.get(), "", attachment); if (result == null) { LOG.warn("Failed to send slack message to channel: message: slack result was null", channelName, attachment.toString()); return false; } else if (!result.getReply().isOk()) { LOG.warn("Failed to send slack message to channel: message: error: {}", channelName, attachment.toString(), result.getReply().getErrorMessage()); return false; } return true; }
Source:
private void warnAboutProblematicCredentials(GoogleCredentials credentials) { if (credentials != null && (credentials instanceof UserCredentials) && ((UserCredentials)credentials).getClientId().equals(CLOUDSDK_CLIENT_ID)) { LOGGER.log(Level.WARNING, CLOUDSDK_CREDENTIALS_WARNING); } }

Target:
private void warnAboutProblematicCredentials(GoogleCredentials credentials) { if (credentials instanceof UserCredentials && ((UserCredentials)credentials).getClientId().equals(CLOUDSDK_CLIENT_ID)) { LOGGER.log(Level.WARNING, CLOUDSDK_CREDENTIALS_WARNING); } }
Source:
public Subscription schedulePeriodically(final Action0 action, long initialDelay, long period, TimeUnit unit) { final long periodInNanos = unit.toNanos(period); final long startInNanos = TimeUnit.MILLISECONDS.toNanos(now()) + unit.toNanos(initialDelay); final MultipleAssignmentSubscription mas = new MultipleAssignmentSubscription(); final Action0 recursiveAction = new Action0() { long count = 0; @Override public void call() { if (!mas.isUnsubscribed()) { action.call(); long nextTick = startInNanos + (++count * periodInNanos); SerialSubscription s = new SerialSubscription(); mas.set(s); s.set(schedule(this, nextTick - TimeUnit.MILLISECONDS.toNanos(now()), TimeUnit.NANOSECONDS)); } } }; SerialSubscription s = new SerialSubscription(); mas.set(s); s.set(schedule(recursiveAction, initialDelay, unit)); return mas; }

Target:
public Subscription schedulePeriodically(final Action0 action, long initialDelay, long period, TimeUnit unit) { final long periodInNanos = unit.toNanos(period); final long startInNanos = TimeUnit.MILLISECONDS.toNanos(now()) + unit.toNanos(initialDelay); final MultipleAssignmentSubscription mas = new MultipleAssignmentSubscription(); final Action0 recursiveAction = new Action0() { long count = 0; @Override public void call() { if (!mas.isUnsubscribed()) { action.call(); long nextTick = startInNanos + (++count * periodInNanos); mas.set(schedule(this, nextTick - TimeUnit.MILLISECONDS.toNanos(now()), TimeUnit.NANOSECONDS)); } } }; MultipleAssignmentSubscription s = new MultipleAssignmentSubscription(); mas.set(s); s.set(schedule(recursiveAction, initialDelay, unit)); return mas; }
Source:
public ResponseEntity update(@ApiParam(value = "The name of the user", required = true) @PathVariable String username, @RequestBody @Validated(UserForm.ExistingUser.class) UserForm userToUpdate, BindingResult bindingResult, Authentication authentication, @RequestHeader(HttpHeaders.ACCEPT) String accept) { if (StringUtils.equals(username, "admin")) { return getFailedResponseEntity(HttpStatus.FORBIDDEN, USER_UPDATE_FORBIDDEN, accept); } if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_UPDATE_USER, bindingResult); } if (!(authentication.getPrincipal() instanceof UserDetails)) { String message = "Unsupported logged user principal type: " + authentication.getPrincipal().getClass(); return getFailedResponseEntity(HttpStatus.BAD_REQUEST, message, accept); } final UserDetails loggedUser = (UserDetails) authentication.getPrincipal(); if (StringUtils.equals(loggedUser.getUsername(), username)) { return getFailedResponseEntity(HttpStatus.FORBIDDEN, OWN_USER_DELETE_FORBIDDEN, accept); } UserDto user = conversionService.convert(userToUpdate, UserDto.class); userService.updateByUsername(user); return getSuccessfulResponseEntity(SUCCESSFUL_UPDATE_USER, accept); }

Target:
public ResponseEntity update(@ApiParam(value = "The name of the user", required = true) @PathVariable String username, @RequestBody @Validated(UserForm.ExistingUser.class) UserForm userToUpdate, BindingResult bindingResult, Authentication authentication, @RequestHeader(HttpHeaders.ACCEPT) String accept) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_UPDATE_USER, bindingResult); } if (!(authentication.getPrincipal() instanceof UserDetails)) { String message = "Unsupported logged user principal type: " + authentication.getPrincipal().getClass(); return getFailedResponseEntity(HttpStatus.BAD_REQUEST, message, accept); } final UserDetails loggedUser = (UserDetails) authentication.getPrincipal(); if (StringUtils.equals(loggedUser.getUsername(), username)) { return getFailedResponseEntity(HttpStatus.FORBIDDEN, OWN_USER_DELETE_FORBIDDEN, accept); } UserDto user = conversionService.convert(userToUpdate, UserDto.class); userService.updateByUsername(user); return getSuccessfulResponseEntity(SUCCESSFUL_UPDATE_USER, accept); }
Source:
public VersionView() { Span text = new Span("Version view"); RouterLink back = new RouterLink("return", Login.class); add(text, back); }

Target:
public VersionView() { Span text = new Span("Version view"); RouterLink back = new RouterLink("return", Login.class); back.setId("version-return"); add(text, back); }
Source:
public Status list(ListOptions listOptions) { try { URL requestUrl = getNamespacedUrl(); if(listOptions.getLimit() != null) { requestUrl = new URL(URLUtils.join(requestUrl.toString(), "?limit=" + listOptions.getLimit().toString())); } else if(listOptions.getContinue() != null) { requestUrl = new URL(URLUtils.join(requestUrl.toString(), "?limit=" + listOptions.getLimit().toString() + "&continue=" + listOptions.getContinue())); } Request.Builder requestBuilder = new Request.Builder().get().url(requestUrl); return handleResponse(requestBuilder, Status.class); } catch (InterruptedException | ExecutionException | IOException e) { throw KubernetesClientException.launderThrowable(e); } }

Target:
public Status list(ListOptions listOptions) { try { HttpUrl.Builder urlBuilder = HttpUrl.get(getNamespacedUrl().toString()).newBuilder(); if(listOptions.getLimit() != null) { urlBuilder.addQueryParameter("limit", listOptions.getLimit().toString()); } if(listOptions.getContinue() != null) { urlBuilder.addQueryParameter("continue", listOptions.getContinue()); } if (listOptions.getResourceVersion() != null) { urlBuilder.addQueryParameter("resourceVersion", listOptions.getResourceVersion()); } if (listOptions.getFieldSelector() != null) { urlBuilder.addQueryParameter("fieldSelector", listOptions.getFieldSelector()); } if (listOptions.getLabelSelector() != null) { urlBuilder.addQueryParameter("labelSelector", listOptions.getLabelSelector()); } if (listOptions.getTimeoutSeconds() != null) { urlBuilder.addQueryParameter("timeoutSeconds", listOptions.getTimeoutSeconds().toString()); } if (listOptions.getAllowWatchBookmarks() != null) { urlBuilder.addQueryParameter("allowWatchBookmarks", listOptions.getAllowWatchBookmarks().toString()); } Request.Builder requestBuilder = new Request.Builder().get().url(urlBuilder.build()); return handleResponse(requestBuilder, Status.class); } catch (InterruptedException | ExecutionException | IOException e) { throw KubernetesClientException.launderThrowable(e); } }
Source:
public Map<String, Set<TestInfo>> getTestCollection() { return mTestCollection; }

Target:
private Map<String, Set<TestInfo>> getTestCollection() { return mTestCollection; }
Source:
public Map<String, Optional<byte[]>> getPillKeyStoreByBatch(@Auth final AccessToken accessToken, final Set<String> pillIds) { return pillKeyStore.getBatch(pillIds); }

Target:
public Map<String, DeviceKeyStoreRecord> getPillKeyStoreByBatch(@Auth final AccessToken accessToken, final Set<String> pillIds) { return pillKeyStore.getKeyStoreRecordBatch(pillIds); }
Source:
private void putCurrentIndicesToWriteMode() { try { Logger.debug(this.getClass(), "Trying to set the current indices to Write mode"); ESIndexUtil.putCurrentIndicesToWriteMode(); sendMessage("es.index.write.allow.message"); ReindexThread.setCurrentIndexReadOnly(false); this.stop(); } catch (final ESResponseException e) { Logger.info(ESReadOnlyMonitor.class, () -> e.getMessage()); } }

Target:
private void putCurrentIndicesToWriteMode() { try { Logger.debug(this.getClass(), () -> "Trying to set the current indices to Write mode"); ElasticsearchUtil.setLiveAndWorkingIndicesToWriteMode(); sendMessage("es.index.write.allow.message"); ReindexThread.setCurrentIndexReadOnly(false); this.stop(); } catch (final ElasticsearchResponseException e) { Logger.info(ESReadOnlyMonitor.class, () -> e.getMessage()); } }
Source:
public String getDBStackTemplate() throws TemplatingDoesNotSupportedException { return ""; }

Target:
public String getDBStackTemplate() throws TemplatingNotSupportedException { return ""; }
Source:
public void testPon(final File tumorBam, final String tumorSample, final File normalBam, final String normalSample) throws Exception { Utils.resetRandomGenerator(); final File ponVcf = createTempFile("pon", ".vcf"); final String[] createPonArgs = { "-I", tumorBam.getAbsolutePath(), "-tumor", tumorSample, "-I", normalBam.getAbsolutePath(), "-normal", normalSample, "-R", b37_reference_20_21, "-L", "20", "-O", ponVcf.getAbsolutePath(), "-artifact_detection_mode" }; runCommandLine(createPonArgs); new Main().instanceMain(makeCommandLineArgs(Arrays.asList("-F", ponVcf.getAbsolutePath()), "IndexFeatureFile")); final File outputVcf = createTempFile("output", ".vcf"); final String[] callWithPonArgs = { "-I", tumorBam.getAbsolutePath(), "-tumor", tumorSample, "-I", normalBam.getAbsolutePath(), "-normal", normalSample, "-normal_panel", ponVcf.getAbsolutePath(), "-R", b37_reference_20_21, "-L", "20", "-O", outputVcf.getAbsolutePath() }; runCommandLine(callWithPonArgs); final Set<String> outputKeys = StreamSupport.stream(new FeatureDataSource<VariantContext>(outputVcf).spliterator(), false) .filter(vc -> vc.getFilters().isEmpty()) .map(vc -> keyForVariant(vc)).collect(Collectors.toSet()); Assert.assertEquals(outputKeys.size(), 0); }

Target:
public void testPon(final File tumorBam, final String tumorSample, final File normalBam, final String normalSample) throws Exception { Utils.resetRandomGenerator(); final File ponVcf = createTempFile("pon", ".vcf"); final String[] createPonArgs = { "-I", tumorBam.getAbsolutePath(), "-tumor", tumorSample, "-I", normalBam.getAbsolutePath(), "-normal", normalSample, "-R", b37_reference_20_21, "-L", "20", "-O", ponVcf.getAbsolutePath(), "-artifact_detection_mode" }; runCommandLine(createPonArgs); new Main().instanceMain(makeCommandLineArgs(Arrays.asList("-F", ponVcf.getAbsolutePath()), "IndexFeatureFile")); final File outputVcf = createTempFile("output", ".vcf"); final String[] callWithPonArgs = { "-I", tumorBam.getAbsolutePath(), "-tumor", tumorSample, "-I", normalBam.getAbsolutePath(), "-normal", normalSample, "-normal_panel", ponVcf.getAbsolutePath(), "-R", b37_reference_20_21, "-L", "20", "-O", outputVcf.getAbsolutePath() }; runCommandLine(callWithPonArgs); final long numVariants = StreamSupport.stream(new FeatureDataSource<VariantContext>(outputVcf).spliterator(), false) .filter(vc -> vc.getFilters().isEmpty()).count(); Assert.assertEquals(numVariants, 0); }
Source:
public static StashCommentReport extractComments(String jsonBody) throws StashReportExtractionException { StashCommentReport result = new StashCommentReport(); try { JSONObject jsonComments = (JSONObject) new JSONParser().parse(jsonBody); JSONArray jsonValues = (JSONArray) jsonComments.get("values"); if (jsonValues != null) { for (Object obj : jsonValues.toArray()) { JSONObject jsonComment = (JSONObject) obj; long id = (long) jsonComment.get("id"); String message = (String) jsonComment.get("text"); JSONObject jsonAnchor = (JSONObject) jsonComment.get("anchor"); String path = (String) jsonAnchor.get("path"); Long line = (Long) jsonAnchor.get("line"); long version = (long) jsonComment.get("version"); JSONObject jsonAuthor = (JSONObject) jsonComment.get("author"); long authorId = (long) jsonAuthor.get("id"); String name = (String) jsonAuthor.get("name"); String slug = (String) jsonAuthor.get("slug"); String email = (String) jsonAuthor.get("email"); StashUser stashUser = new StashUser(authorId, name, slug, email); StashComment comment = new StashComment(id, message, path, line, stashUser, version); result.add(comment); } } } catch (ParseException e) { throw new StashReportExtractionException(e); } return result; }

Target:
public static StashCommentReport extractComments(String jsonBody) throws StashReportExtractionException { StashCommentReport result = new StashCommentReport(); try { JSONObject jsonComments = (JSONObject) new JSONParser().parse(jsonBody); JSONArray jsonValues = (JSONArray) jsonComments.get("values"); if (jsonValues != null) { for (Object obj : jsonValues.toArray()) { JSONObject jsonComment = (JSONObject) obj; long id = (long) jsonComment.get("id"); String message = (String) jsonComment.get("text"); JSONObject jsonAnchor = (JSONObject) jsonComment.get("anchor"); String path = (String) jsonAnchor.get("path"); Long line = (Long) jsonAnchor.get("line"); long version = (long) jsonComment.get("version"); JSONObject jsonAuthor = (JSONObject) jsonComment.get("author"); StashUser stashUser = extractUser(jsonAuthor.toJSONString()); StashComment comment = new StashComment(id, message, path, line, stashUser, version); result.add(comment); } } } catch (ParseException e) { throw new StashReportExtractionException(e); } return result; }
Source:
protected List<User> parseResultSet(ResultSet resultSet) throws DAOException { LinkedList<User> resultList = new LinkedList<>(); try { while (resultSet.next()) { User user = new User(); user.setId(resultSet.getInt("Id")); user.setFirstName(resultSet.getString("FirstName")); user.setLastName(resultSet.getString("LastName")); user.setLogin(resultSet.getString("Login")); user.setPassword(resultSet.getString("Password")); user.setEmail(resultSet.getString("Email")); user.setRoleRef(resultSet.getString("RoleName")); user.setCustomerTypeRef(resultSet.getString("TypeName")); user.setRegionRef(resultSet.getString("RegionName")); user.setStatus(resultSet.getString("Status")); resultList.add(user); } } catch (Exception e) { throw new DAOException(e); } return resultList; }

Target:
protected List<User> parseResultSet(ResultSet resultSet) throws DAOException { LinkedList<User> resultList = new LinkedList<>(); try { while (resultSet.next()) { User user = new User(); user.setId(resultSet.getInt("Id")); user.setFirstName(resultSet.getString("FirstName")); user.setLastName(resultSet.getString("LastName")); user.setLogin(resultSet.getString("Login")); user.setPassword(resultSet.getString("Password")); user.setEmail(resultSet.getString("Email")); user.setRoleReference(resultSet.getString("RoleName")); user.setCustomerTypeReference(resultSet.getString("TypeName")); user.setRegionReference(resultSet.getString("RegionName")); user.setStatus(resultSet.getString("Status")); resultList.add(user); } } catch (Exception e) { throw new DAOException(e); } return resultList; }