auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean onHandleIntent(Intent intent, GoogleCloudMessaging gcm) { return false; }

Target:
public boolean onHandleIntent(Intent intent, GoogleCloudMessaging gcm) { return onMessageReceived("", intent.getExtras()); }
Source:
public static void testUndoApproveSavingsAccount() throws MambuApiException { System.out.println("\nIn test Undo Approve Savings Account"); SavingsService service = MambuAPIFactory.getSavingsService(); String accountId = "JLXD301"; SavingsAccount account = service .undoApproveSavingsAccount(accountId, "UNDO Approve Savings account demo notes"); System.out.println("UNDO Approved Savings account with id=" + account.getId() + "\tName=" + account.getName() + "\tAccount State=" + account.getAccountState().toString()); }

Target:
public static void testUndoApproveSavingsAccount() throws MambuApiException { System.out.println("\nIn test Undo Approve Savings Account"); SavingsService service = MambuAPIFactory.getSavingsService(); String accountId = SAVINGS_ACCOUNT_ID; SavingsAccount account = service .undoApproveSavingsAccount(accountId, "UNDO Approve Savings account demo notes"); System.out.println("UNDO Approved Savings account with id=" + account.getId() + "\tName=" + account.getName() + "\tAccount State=" + account.getAccountState().toString()); }
Source:
public Revision(ObjectId sha1, Collection<Branch> branches) { if (sha1 == null) throw new NullPointerException("sha1 can't be null"); this.sha1 = sha1; this.branches = branches; }

Target:
public Revision(ObjectId sha1, Collection<Branch> branches) { this.sha1 = sha1; this.branches = branches; }
Source:
private void broadcast(String noteId, Message m) { synchronized (noteSocketMap) { List<NotebookSocket> socketLists = noteSocketMap.get(noteId); if (socketLists == null || socketLists.size() == 0) { return; } LOG.debug("SEND >> " + m.op); broadcastToWatchers(noteId, StringUtils.EMPTY, m); for (NotebookSocket conn : socketLists) { try { conn.send(serializeMessage(m)); } catch (IOException e) { LOG.error("socket error", e); } } } }

Target:
private void broadcast(String noteId, Message m) { synchronized (noteSocketMap) { broadcastToWatchers(noteId, StringUtils.EMPTY, m); List<NotebookSocket> socketLists = noteSocketMap.get(noteId); if (socketLists == null || socketLists.size() == 0) { return; } LOG.debug("SEND >> " + m.op); for (NotebookSocket conn : socketLists) { try { conn.send(serializeMessage(m)); } catch (IOException e) { LOG.error("socket error", e); } } } }
Source:
public CdoSnapshot fromJson(JsonElement json, JsonDeserializationContext context) { JsonObject jsonObject = (JsonObject) json; CommitId commitId = parseCommitId(jsonObject); GlobalCdoId cdoId = context.deserialize(jsonObject.get(GLOBAL_CDO_ID), GlobalCdoId.class); CdoSnapshotBuilder cdoSnapshotBuilder = cdoSnapshot(cdoId); cdoSnapshotBuilder.withCommitId(commitId); JsonObject state = jsonObject.get(STATE).getAsJsonObject(); for (Property property : propertyScanner.scan(cdoId.getCdoClass().getSourceClass())) { cdoSnapshotBuilder.withPropertyValue(property, decodeValue(state, context, property)); } return cdoSnapshotBuilder.build(); }

Target:
public CdoSnapshot fromJson(JsonElement json, JsonDeserializationContext context) { JsonObject jsonObject = (JsonObject) json; CommitId commitId = parseCommitId(jsonObject); GlobalCdoId cdoId = context.deserialize(jsonObject.get(GLOBAL_CDO_ID), GlobalCdoId.class); CdoSnapshotBuilder cdoSnapshotBuilder = cdoSnapshot(cdoId); cdoSnapshotBuilder.withCommitId(commitId); JsonObject state = jsonObject.get(STATE).getAsJsonObject(); for (Property property : cdoId.getCdoClass().getProperties()) { cdoSnapshotBuilder.withPropertyValue(property, decodeValue(state, context, property)); } return cdoSnapshotBuilder.build(); }
Source:
public static boolean handleCommands(DedicatedServer server) { final Terminal terminal = TerminalConsoleAppender.getTerminal(); if (terminal == null) return false; LineReader reader = LineReaderBuilder.builder() .appName("Forge") .terminal(terminal) .completer(new ConsoleCommandCompleter(server)) .build(); reader.unsetOpt(LineReader.Option.INSERT_TAB); TerminalConsoleAppender.setReader(reader); try { String line; while (!server.isServerStopped() && server.isServerRunning()) { try { line = reader.readLine("> "); } catch (EndOfFileException ignored) { continue; } if (line == null) break; line = line.trim(); if (!line.isEmpty()) { server.addPendingCommand(line, server); } } } catch (UserInterruptException e) { server.initiateShutdown(); } finally { TerminalConsoleAppender.setReader(null); } return true; }

Target:
public static boolean handleCommands(DedicatedServer server) { final Terminal terminal = TerminalConsoleAppender.getTerminal(); if (terminal == null) return false; LineReader reader = LineReaderBuilder.builder() .appName("Forge") .terminal(terminal) .completer(new ConsoleCommandCompleter(server)) .build(); reader.setOpt(LineReader.Option.DISABLE_EVENT_EXPANSION); reader.unsetOpt(LineReader.Option.INSERT_TAB); TerminalConsoleAppender.setReader(reader); try { String line; while (!server.isServerStopped() && server.isServerRunning()) { try { line = reader.readLine("> "); } catch (EndOfFileException ignored) { continue; } if (line == null) break; line = line.trim(); if (!line.isEmpty()) { server.addPendingCommand(line, server); } } } catch (UserInterruptException e) { server.initiateShutdown(); } finally { TerminalConsoleAppender.setReader(null); } return true; }
Source:
private void parseJaxbLayer(LayerType lt, ILayer parentLayer) throws LayerException { if(!lt.getLayer().isEmpty() || (lt.getDataURL()==null )) { parseJaxbLayerCollection(lt, parentLayer); } else { URLType dataUrl = lt.getDataURL(); if (dataUrl != null) { OnlineResourceType resType = dataUrl.getOnlineResource(); try { URI layerURI = new URI(resType.getHref()); if(!layerURI.isAbsolute() && getLocation()!=null) { try { layerURI = getLocation().resolve(layerURI); } catch (IllegalArgumentException ex) { LOGGER.warn("Error while trying to find an absolute path for an external resource", ex); } } ILayer leafLayer; try { leafLayer = createLayer(registerLayerResource(layerURI)); } catch (Exception ex) { throw new LayerException(I18N.tr("Unable to load the data source uri {0}.", resType.getHref()), ex); } leafLayer.setDescription(new Description(lt)); leafLayer.setVisible(!lt.isHidden()); if(lt.isSetStyleList()) { for(StyleType st : lt.getStyleList().getStyle()) { if(st.isSetSLD()) { if(st.getSLD().isSetAbstractStyle()) { leafLayer.addStyle(new Style((JAXBElement<net.opengis.se._2_0.core.StyleType>)st.getSLD().getAbstractStyle(), leafLayer)); } } } } parentLayer.addLayer(leafLayer); } catch (URISyntaxException ex) { throw new LayerException(I18N.tr("Unable to parse the href URI {0}.", resType.getHref()), ex); } catch (InvalidStyle ex) { throw new LayerException(I18N.tr("Unable to load the description of the layer {0}", lt.getTitle().toString()), ex); } } } }

Target:
private void parseJaxbLayer(LayerType lt, ILayer parentLayer) throws LayerException { if(!lt.getLayer().isEmpty() || (lt.getDataURL()==null )) { parseJaxbLayerCollection(lt, parentLayer); } else { URLType dataUrl = lt.getDataURL(); if (dataUrl != null) { OnlineResourceType resType = dataUrl.getOnlineResource(); try { URI layerURI = new URI(resType.getHref()); if(!layerURI.isAbsolute() && getLocation()!=null) { try { layerURI = getLocation().resolve(layerURI); } catch (IllegalArgumentException ex) { LOGGER.warn(I18N.tr("Error while trying to find an absolute path for an external resource"), ex); } } ILayer leafLayer; try { leafLayer = createLayer(registerLayerResource(layerURI)); } catch (Exception ex) { throw new LayerException(I18N.tr("Unable to load the data source uri {0}.", resType.getHref()), ex); } leafLayer.setDescription(new Description(lt)); leafLayer.setVisible(!lt.isHidden()); if(lt.isSetStyleList()) { for(StyleType st : lt.getStyleList().getStyle()) { if(st.isSetSLD()) { if(st.getSLD().isSetAbstractStyle()) { leafLayer.addStyle(new Style((JAXBElement<net.opengis.se._2_0.core.StyleType>)st.getSLD().getAbstractStyle(), leafLayer)); } } } } parentLayer.addLayer(leafLayer); } catch (URISyntaxException ex) { throw new LayerException(I18N.tr("Unable to parse the href URI {0}.", resType.getHref()), ex); } catch (InvalidStyle ex) { throw new LayerException(I18N.tr("Unable to load the description of the layer {0}", lt.getTitle().toString()), ex); } } } }
Source:
protected boolean validate() { if (getParameters() == null || getParameters().getAgent() == null || getParameters().getAgent().getId() == null) { return failValidation(EngineMessage.VDS_REMOVE_FENCE_AGENT_ID_REQUIRED); } VDS host = getVds(); if (host == null) { return failValidation(EngineMessage.VDS_INVALID_SERVER_ID); } if (host.isPmEnabled()) { List<FenceAgent> fenceAgents = fenceAgentDao.getFenceAgentsForHost(getVdsId()); if (fenceAgents.size() == 1) { return failValidation(EngineMessage.VDS_REMOVE_LAST_FENCE_AGENT_PM_ENABLED); } } return super.validate(); }

Target:
protected boolean validate() { if (getParameters() == null || getParameters().getAgent() == null || getParameters().getAgent().getId() == null) { return failValidation(EngineMessage.VDS_REMOVE_FENCE_AGENT_ID_REQUIRED); } Guid vdsId = getParameters().getAgent().getHostId(); VDS host = vdsDao.get(vdsId); if (host == null) { return failValidation(EngineMessage.VDS_INVALID_SERVER_ID); } if (host.isPmEnabled()) { List<FenceAgent> fenceAgents = fenceAgentDao.getFenceAgentsForHost(getVdsId()); if (fenceAgents.size() == 1) { return failValidation(EngineMessage.VDS_REMOVE_LAST_FENCE_AGENT_PM_ENABLED); } } return super.validate(); }
Source:
private Object getInstance(String className) { try { Class descriptorClass = null; String errorMsg = null; if (classLoader != null) { try { descriptorClass = Class.forName(className, true, classLoader); } catch (Exception e) { errorMsg = e.getMessage(); } } if (descriptorClass == null) { try { descriptorClass = Class.forName(className); } catch (Exception e) { errorMsg = e.getMessage(); } } if (descriptorClass == null) { try { descriptorClass = Class.forName(className, true, ClassLoader.getSystemClassLoader()); } catch (Exception e) { errorMsg = e.getMessage(); } } if (descriptorClass == null) { registryFileError(errorMsg); return null; } return descriptorClass.newInstance(); } catch (Exception e) { registryFileError(e.getMessage()); e.printStackTrace(); } return null; }

Target:
private Object getInstance(String className) { try { Class descriptorClass = null; String errorMsg = null; if (classLoader != null) { try { descriptorClass = Class.forName(className, true, classLoader); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); errorMsg = e.getMessage(); } } if (descriptorClass == null) { try { descriptorClass = Class.forName(className); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); errorMsg = e.getMessage(); } } if (descriptorClass == null) { try { descriptorClass = Class.forName(className, true, ClassLoader.getSystemClassLoader()); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); errorMsg = e.getMessage(); } } if (descriptorClass == null) { registryFileError(errorMsg); return null; } return descriptorClass.newInstance(); } catch (Exception e) { registryFileError(e.getMessage()); LOGGER.log(Level.SEVERE, e.getMessage(), e); } return null; }
Source:
public String getQuestionResultStatisticsHtml(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if ("student".equals(view) || responses.isEmpty()) { return ""; } Map<String, Integer> answerFrequency = new LinkedHashMap<String, Integer>(); int numChoicesSelected = getNumberOfEmptyResponse(responses, answerFrequency); if (numChoicesSelected == -1) { return ""; } DecimalFormat df = new DecimalFormat("#.##"); StringBuilder fragments = new StringBuilder(); for (Entry<String, Integer> entry : answerFrequency.entrySet()) { fragments.append(Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS_OPTIONFRAGMENT, Slots.MCQ_CHOICE_VALUE, entry.getKey(), Slots.COUNT, entry.getValue().toString(), Slots.PERCENTAGE, df.format(100 * divideOrReturnZero((double) entry.getValue(), numChoicesSelected)))); } return Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS, Slots.FRAGMENTS, fragments.toString()); }

Target:
public String getQuestionResultStatisticsHtml(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if ("student".equals(view) || responses.isEmpty()) { return ""; } Map<String, Integer> answerFrequency = new LinkedHashMap<String, Integer>(); int numChoicesSelected = getNumberOfResponse(responses, answerFrequency); if (numChoicesSelected == -1) { return ""; } DecimalFormat df = new DecimalFormat("#.##"); StringBuilder fragments = new StringBuilder(); for (Entry<String, Integer> entry : answerFrequency.entrySet()) { fragments.append(Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS_OPTIONFRAGMENT, Slots.MCQ_CHOICE_VALUE, entry.getKey(), Slots.COUNT, entry.getValue().toString(), Slots.PERCENTAGE, df.format(100 * divideOrReturnZero((double) entry.getValue(), numChoicesSelected)))); } return Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS, Slots.FRAGMENTS, fragments.toString()); }
Source:
public Aggregator factorize(ColumnSelectorFactory columnFactory) { BloomKFilter filter = new BloomKFilter(maxNumEntries); ColumnCapabilities capabilities = columnFactory.getColumnCapabilities(field.getDimension()); BaseNullableColumnValueSelector selector = columnFactory.makeColumnValueSelector(field.getDimension()); if (selector instanceof NilColumnValueSelector) { return new NilBloomFilterAggregator((NilColumnValueSelector) selector, filter); } if (capabilities == null) { throw new IAE( "Cannot create bloom filter buffer aggregator for column selector type [%s]", selector.getClass().getName() ); } ValueType type = capabilities.getType(); switch (type) { case STRING: return new StringBloomFilterAggregator(columnFactory.makeDimensionSelector(field), filter); case LONG: return new LongBloomFilterAggregator(columnFactory.makeColumnValueSelector(field.getDimension()), filter); case FLOAT: return new FloatBloomFilterAggregator(columnFactory.makeColumnValueSelector(field.getDimension()), filter); case DOUBLE: return new DoubleBloomFilterAggregator(columnFactory.makeColumnValueSelector(field.getDimension()), filter); default: throw new IAE("Cannot create bloom filter aggregator for invalid column type [%s]", type); } }

Target:
public Aggregator factorize(ColumnSelectorFactory columnFactory) { BloomKFilter filter = new BloomKFilter(maxNumEntries); ColumnCapabilities capabilities = columnFactory.getColumnCapabilities(field.getDimension()); if (capabilities == null) { BaseNullableColumnValueSelector selector = columnFactory.makeColumnValueSelector(field.getDimension()); if (selector instanceof NilColumnValueSelector) { return new EmptyBloomFilterAggregator(filter); } throw new IAE( "Cannot create bloom filter buffer aggregator for column selector type [%s]", selector.getClass().getName() ); } ValueType type = capabilities.getType(); switch (type) { case STRING: return new StringBloomFilterAggregator(columnFactory.makeDimensionSelector(field), filter); case LONG: return new LongBloomFilterAggregator(columnFactory.makeColumnValueSelector(field.getDimension()), filter); case FLOAT: return new FloatBloomFilterAggregator(columnFactory.makeColumnValueSelector(field.getDimension()), filter); case DOUBLE: return new DoubleBloomFilterAggregator(columnFactory.makeColumnValueSelector(field.getDimension()), filter); default: throw new IAE("Cannot create bloom filter aggregator for invalid column type [%s]", type); } }
Source:
public String getCachedString() { String rv; if (variableData.expression == null || variableData.expression.length() == 0) rv = "_"; else if (Double.isNaN(getCachedValue())) rv = "*"; else rv = "" + (int) getCachedValue(); return rv; }

Target:
public String getCachedString() { final String rv; if (variableData.expression == null || variableData.expression.length() == 0) { rv = "_"; } else if (Double.isNaN(getCachedValue())) { rv = "*"; } else { rv = String.valueOf((int) getCachedValue()); } return rv; }
Source:
public static void commitNonXAConns() { Map<String, DataServiceConnection> conns = tlCons.get(); for (DataServiceConnection conn : conns.values()) { if (!conn.isXA()) { try { conn.commit(); if (log.isDebugEnabled()) { log.debug("Committing non-XA connection. ThreadID:" + Thread.currentThread().getId()); } } catch (Exception e) { log.warn("Error in committing non-XA connection: " + e.getMessage(), e); } } } }

Target:
public static void commitNonXAConns() { Map<String, DataServiceConnection> conns = tlCons.get(); for (DataServiceConnection conn : conns.values()) { if (!conn.isXA()) { try { conn.commit(); if (log.isDebugEnabled()) { log.debug("Committing non-XA connection: " + conn.toString() + ", ThreadID - " + Thread.currentThread().getId()); } } catch (Exception e) { log.warn("Error in committing non-XA connection: " + e.getMessage(), e); } } } }
Source:
public EventReactorExpected<TuProject> expectThat(TuAggregate entity) { return super.expectThat(entity); }

Target:
public EventApplierExpected<TuProject> expectThat(TuAggregate entity) { return super.expectThat(entity); }
Source:
private static boolean isValidGZipStream(File f) throws IOException { FileInputStream fis = null; byte[] byteArray = new byte[2]; try { fis = new FileInputStream(f); fis.read(byteArray, 0, 2); ByteBuffer bb = ByteBuffer.wrap(byteArray); byte[] magicHeader = new byte[2]; bb.get(magicHeader, 0, 2); int magic = magicHeader[0] & 0xff | ((magicHeader[1] << 8) & 0xff00); return magic == GZIPInputStream.GZIP_MAGIC; } catch (FileNotFoundException e) { LOG.error("Unable to open file " + f.getName() + " : ", e); return false; } finally { if (fis != null) { fis.close(); } } }

Target:
private static boolean isValidGZipStream(File f) throws IOException { byte[] byteArray = new byte[2]; try (FileInputStream fis = new FileInputStream(f)) { if (2 != fis.read(byteArray, 0, 2)) { LOG.error("Read incorrect number of bytes from " + f.getName()); return false; } ByteBuffer bb = ByteBuffer.wrap(byteArray); byte[] magicHeader = new byte[2]; bb.get(magicHeader, 0, 2); int magic = magicHeader[0] & 0xff | ((magicHeader[1] << 8) & 0xff00); return magic == GZIPInputStream.GZIP_MAGIC; } catch (FileNotFoundException e) { LOG.error("Unable to open file " + f.getName() + " : ", e); return false; } }
Source:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!getExpression().evaluate(tuple, ptr)) { return false; } else if (ptr.getLength() == 0) { return true; } PDataType type = getExpression().getDataType(); String stringValue = (String)type.toObject(ptr); if (stringValue == null) { return false; } stringValue = stringValue.trim(); BigDecimal decimalValue; if (format == null) { decimalValue = (BigDecimal) getDataType().toObject(stringValue); } else { ParsePosition parsePosition = new ParsePosition(0); Number number = format.parse(stringValue, parsePosition); if (parsePosition.getErrorIndex() > -1) { ptr.set(EMPTY_BYTE_ARRAY); return true; } if (number instanceof BigDecimal) { decimalValue = (BigDecimal)number; } else { return false; } } byte[] byteValue = getDataType().toBytes(decimalValue); ptr.set(byteValue); return true; }

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!getExpression().evaluate(tuple, ptr)) { return false; } else if (ptr.getLength() == 0) { return true; } PDataType type = getExpression().getDataType(); String stringValue = (String)type.toObject(ptr); if (stringValue == null) { ptr.set(EMPTY_BYTE_ARRAY); return true; } stringValue = stringValue.trim(); BigDecimal decimalValue; if (format == null) { decimalValue = (BigDecimal) getDataType().toObject(stringValue); } else { ParsePosition parsePosition = new ParsePosition(0); Number number = format.parse(stringValue, parsePosition); if (parsePosition.getErrorIndex() > -1) { ptr.set(EMPTY_BYTE_ARRAY); return true; } if (number instanceof BigDecimal) { decimalValue = (BigDecimal)number; } else { ptr.set(EMPTY_BYTE_ARRAY); return true; } } byte[] byteValue = getDataType().toBytes(decimalValue); ptr.set(byteValue); return true; }
Source:
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); Message msg = itemFromMenuInfo(menuInfo); if (msg == null) { return; } if (msg.getType().equals(MessageType.STREAM_MESSAGE)) { MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.context_stream, menu); if ((app.isTopicMute(msg.getStream().getId(), msg.getSubject()))) { menu.findItem(R.id.mute_topic).setTitle("Unmute Topic"); } else { if (filter != null) menu.removeItem(R.id.mute_topic); } } else if (msg.getPersonalReplyTo(app).length > 1) { MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.context_private, menu); } else { MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.context_single_private, menu); } }

Target:
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); Message msg = itemFromMenuInfo(menuInfo); if (msg == null) { return; } if (msg.getType().equals(MessageType.STREAM_MESSAGE)) { MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.context_stream, menu); } else if (msg.getPersonalReplyTo(app).length > 1) { MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.context_private, menu); } else { MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.context_single_private, menu); } }
Source:
private void actionDel(AjaxRequestTarget aTarget) { @SuppressWarnings("unchecked") List<LinkWithRoleModel> links = (List<LinkWithRoleModel>) LinkFeatureEditor.this .getModelObject().value; AnnotatorState state = LinkFeatureEditor.this.stateModel.getObject(); FeatureState fs = state.getArmedFeature(); LinkWithRoleModel linkWithRoleModel = links.get(state.getArmedSlot()); links.remove(state.getArmedSlot()); state.clearArmedSlot(); aTarget.add(content); Optional<IPageRequestHandler> handler = RequestCycle.get().find(IPageRequestHandler.class); if (handler.isPresent()) { Page page = (Page) handler.get().getPage(); page.send(page, Broadcast.BREADTH, new LinkFeatureDeletedEvent(fs, aTarget, linkWithRoleModel, RequestCycle.get().find(IPartialPageRequestHandler.class).get())); } }

Target:
private void actionDel(AjaxRequestTarget aTarget) { @SuppressWarnings("unchecked") List<LinkWithRoleModel> links = (List<LinkWithRoleModel>) LinkFeatureEditor.this .getModelObject().value; AnnotatorState state = LinkFeatureEditor.this.stateModel.getObject(); FeatureState fs = state.getArmedFeature(); LinkWithRoleModel linkWithRoleModel = links.get(state.getArmedSlot()); links.remove(state.getArmedSlot()); state.clearArmedSlot(); aTarget.add(content); send(this, Broadcast.BUBBLE, new LinkFeatureDeletedEvent(fs, aTarget, linkWithRoleModel)); }
Source:
default ElideSettings getElideSettings(ServiceLocator injector) { DataStore dataStore = new InjectionAwareHibernateStore( injector, Util.getSessionFactory(getHibernate5ConfigPath(), getModelPackageName())); EntityDictionary dictionary = new EntityDictionary(getCheckMappings()); return new ElideSettingsBuilder(dataStore) .withUseFilterExpressions(true) .withEntityDictionary(dictionary) .withJoinFilterDialect(new RSQLFilterDialect(dictionary)) .withSubqueryFilterDialect(new RSQLFilterDialect(dictionary)) .withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")) .build(); }

Target:
default ElideSettings getElideSettings(ServiceLocator injector) { DataStore dataStore = new InjectionAwareHibernateStore( injector, Util.getSessionFactory(getHibernate5ConfigPath(), getModelPackageName())); EntityDictionary dictionary = new EntityDictionary(getCheckMappings()); ElideSettingsBuilder builder = new ElideSettingsBuilder(dataStore) .withUseFilterExpressions(true) .withEntityDictionary(dictionary) .withJoinFilterDialect(new RSQLFilterDialect(dictionary)) .withSubqueryFilterDialect(new RSQLFilterDialect(dictionary)); if (enableIS06081Dates()) { builder = builder.withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")); } return builder.build(); }
Source:
public void actionPerformed(AnActionEvent e) { final Project project = e.getProject(); if (project == null) { return; } Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (editor == null) { return; } final Document document = editor.getDocument(); if (document == null) { return; } VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document); final VirtualFile file = BuckFileUtil.getBuckFile(virtualFile); if (file != null) { BuckQueryCommandHandler handler = new BuckQueryCommandHandler( project, file.getParent(), BuckCommand.QUERY, new Function<List<String>, Void>() { @Nullable @Override public Void apply(@Nullable List<String> strings) { if (strings == null || strings.isEmpty() || strings.get(0) == null || strings.get(0).isEmpty()) { return null; } String target = strings.get(0); BuckBuildCommandHandler handler = new BuckBuildCommandHandler(project, project.getBaseDir(), BuckCommand.PROJECT); handler.command().addParameter(target); handler.command().addParameter("--ide"); handler.command().addParameter("INTELLIJ"); BuckModule buckModule = project.getComponent(BuckModule.class); BuckBuildManager buildManager = BuckBuildManager.getInstance(project); buildManager.setBuilding(project, true); buckModule.attach(target); buildManager.runBuckCommand(handler, "Running buck project for selected file."); buildManager.setBuilding(project, false); return null; } }); BuckBuildManager buildManager = BuckBuildManager.getInstance(project); handler.command().addParameter("owner(" + virtualFile.getPath() + ")"); buildManager.runBuckCommand(handler, "Searching for owning target."); } }

Target:
public void actionPerformed(AnActionEvent e) { final Project project = e.getProject(); if (project == null) { return; } Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (editor == null) { return; } final Document document = editor.getDocument(); if (document == null) { return; } VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document); final VirtualFile file = BuckFileUtil.getBuckFile(virtualFile); if (file != null) { BuckQueryCommandHandler handler = new BuckQueryCommandHandler( project, file.getParent(), BuckCommand.QUERY, new Function<List<String>, Void>() { @Nullable @Override public Void apply(@Nullable List<String> strings) { if (strings == null || strings.isEmpty() || strings.get(0) == null || strings.get(0).isEmpty()) { return null; } String target = strings.get(0); SelectProjectUtils.generateTargetForProject(target, project); return null; } }); BuckBuildManager buildManager = BuckBuildManager.getInstance(project); handler.command().addParameter("owner(" + virtualFile.getPath() + ")"); buildManager.runBuckCommand(handler, "Searching for owning target."); } }
Source:
protected void initialize() { super.initialize(); for (String[] element : fAppearanceColorListModel) { fConsoleColorList.add(element[0]); } fConsoleColorList.getDisplay().asyncExec(() -> { if (fConsoleColorList != null && !fConsoleColorList.isDisposed()) { fConsoleColorList.select(0); handleAppearanceColorListSelection(); } }); }

Target:
protected void initialize() { super.initialize(); for (String[] colorModel : fAppearanceColorListModel) { fConsoleColorList.add(colorModel[0]); } fConsoleColorList.getDisplay().asyncExec(() -> { if (fConsoleColorList != null && !fConsoleColorList.isDisposed()) { fConsoleColorList.select(0); handleAppearanceColorListSelection(); } }); }
Source:
public Properties getSdkProperties() throws IOException { File sdkPropertiesFile = new File(Server.getServersPathFile(), SDKConstants.OPENMRS_SDK_PROPERTIES); if (!sdkPropertiesFile.exists()) { sdkPropertiesFile.createNewFile(); } InputStream in = new FileInputStream(sdkPropertiesFile); Properties sdkProperties = new Properties(); sdkProperties.load(in); return sdkProperties; }

Target:
public Properties getSdkProperties() { File sdkPropertiesFile = new File(Server.getServersPathFile(), SDKConstants.OPENMRS_SDK_PROPERTIES); if (!sdkPropertiesFile.exists()) { try { sdkPropertiesFile.createNewFile(); } catch (IOException e) { throw new IllegalStateException("Failed to create SDK properties file in: \"" + Server.getServersPathFile() + SDKConstants.OPENMRS_SDK_PROPERTIES + "\""); } } InputStream in = null; try { in = new FileInputStream(sdkPropertiesFile); } catch (FileNotFoundException e) { throw new IllegalStateException("SDK properties file not found at: \"" + Server.getServersPathFile() + SDKConstants.OPENMRS_SDK_PROPERTIES + "\""); } Properties sdkProperties = new Properties(); try { sdkProperties.load(in); } catch (IOException e) { throw new IllegalStateException("Failed to load properties from file"); } return sdkProperties; }
Source:
public MetricsService(SlimefunPlugin plugin) { this.plugin = plugin; this.metricFile = new File(plugin.getDataFolder(), REPO_NAME + ".jar"); }

Target:
public MetricsService(SlimefunPlugin plugin) { this.plugin = plugin; this.parentFolder = new File(plugin.getDataFolder(), "cache" + File.separatorChar + "modules"); if (!parentFolder.exists()) parentFolder.mkdirs(); this.metricFile = new File(parentFolder, REPO_NAME + ".jar"); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final GoodDataSettings that = (GoodDataSettings) o; return maxConnections == that.maxConnections && connectionTimeout == that.connectionTimeout && connectionRequestTimeout == that.connectionRequestTimeout && socketTimeout == that.socketTimeout && pollSleep == that.pollSleep && Objects.equals(userAgent, that.userAgent) && Objects.equals(failOverSettings, that.failOverSettings); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final GoodDataSettings that = (GoodDataSettings) o; return maxConnections == that.maxConnections && connectionTimeout == that.connectionTimeout && connectionRequestTimeout == that.connectionRequestTimeout && socketTimeout == that.socketTimeout && pollSleep == that.pollSleep && Objects.equals(userAgent, that.userAgent) && Objects.equals(retrySettings, that.retrySettings); }
Source:
public int compare(final Cell l, final Cell r, boolean ignoreSequenceid) { int diff = 0; if (l instanceof KeyValue && r instanceof KeyValue) { diff = compareKeyValues((KeyValue) l, (KeyValue) r); if (diff != 0) { return diff; } } else if (l instanceof KeyValue && r instanceof ByteBufferKeyValue) { diff = compareKVVsBBKV((KeyValue) l, (ByteBufferKeyValue) r); if (diff != 0) { return diff; } } else if (l instanceof ByteBufferKeyValue && r instanceof KeyValue) { diff = compareKVVsBBKV((KeyValue) r, (ByteBufferKeyValue) l); if (diff != 0) { return -diff; } return ignoreSequenceid ? diff : Long.compare(r.getSequenceId(), l.getSequenceId()); } else if (l instanceof ByteBufferKeyValue && r instanceof ByteBufferKeyValue) { diff = compareBBKV((ByteBufferKeyValue) l, (ByteBufferKeyValue) r); if (diff != 0) { return diff; } } else { int leftRowLength = l.getRowLength(); int rightRowLength = r.getRowLength(); diff = compareRows(l, leftRowLength, r, rightRowLength); if (diff != 0) { return diff; } diff = compareWithoutRow(l, r); if (diff != 0) { return diff; } } return ignoreSequenceid ? diff : Long.compare(r.getSequenceId(), l.getSequenceId()); }

Target:
public int compare(final Cell l, final Cell r, boolean ignoreSequenceid) { int diff = 0; if (l instanceof KeyValue && r instanceof KeyValue) { diff = compareKeyValues((KeyValue) l, (KeyValue) r); if (diff != 0) { return diff; } } else if (l instanceof KeyValue && r instanceof ByteBufferKeyValue) { diff = compareKVVsBBKV((KeyValue) l, (ByteBufferKeyValue) r); if (diff != 0) { return diff; } } else if (l instanceof ByteBufferKeyValue && r instanceof KeyValue) { diff = compareKVVsBBKV((KeyValue) r, (ByteBufferKeyValue) l); if (diff != 0) { return -diff; } } else if (l instanceof ByteBufferKeyValue && r instanceof ByteBufferKeyValue) { diff = compareBBKV((ByteBufferKeyValue) l, (ByteBufferKeyValue) r); if (diff != 0) { return diff; } } else { int leftRowLength = l.getRowLength(); int rightRowLength = r.getRowLength(); diff = compareRows(l, leftRowLength, r, rightRowLength); if (diff != 0) { return diff; } diff = compareWithoutRow(l, r); if (diff != 0) { return diff; } } return ignoreSequenceid ? diff : Long.compare(r.getSequenceId(), l.getSequenceId()); }
Source:
public void getQosByDiskProfileId() { StorageQos qos = dao.GetQosByDiskProfileId(FixturesTool.DISK_PROFILE_1); assertNotNull(qos); assertEquals(FixturesTool.QOS_ID_1, qos.getId()); }

Target:
public void getQosByDiskProfileId() { StorageQos qos = dao.getQosByDiskProfileId(FixturesTool.DISK_PROFILE_1); assertNotNull(qos); assertEquals(FixturesTool.QOS_ID_1, qos.getId()); }
Source:
public AllelicCountWithPhasePosteriors(final AllelicCount count, final double refMinorLogProb, final double altMinorLogProb, final double outlierLogProb) { super(Utils.nonNull(count, "AllelicCount cannot be null.")); ParamUtils.isFinite(refMinorLogProb, "Cannot construct AllelicCountWithPhasePosteriors with non-finite ref-minor probability at: " + count.getInterval()); ParamUtils.isFinite(altMinorLogProb, "Cannot construct AllelicCountWithPhasePosteriors with non-finite alt-minor probability at: " + count.getInterval()); ParamUtils.isFinite(outlierLogProb, "Cannot construct AllelicCountWithPhasePosteriors with non-finite outlier probability at: " + count.getInterval()); final double[] normalizedProbs = MathUtils.normalizeFromLog10( new double[]{MathUtils.logToLog10(refMinorLogProb), MathUtils.logToLog10(altMinorLogProb), MathUtils.logToLog10(outlierLogProb)}); refMinorProb = normalizedProbs[0]; altMinorProb = normalizedProbs[1]; outlierProb = normalizedProbs[2]; if (!Double.isFinite(refMinorProb) || !Double.isFinite(altMinorProb) || !Double.isFinite(outlierProb)) { throw new IllegalArgumentException("Cannot construct AllelicCountWithPhasePosteriors with non-finite probabilities at: " + count.getInterval()); } }

Target:
public AllelicCountWithPhasePosteriors(final AllelicCount count, final double refMinorLogProb, final double altMinorLogProb, final double outlierLogProb) { super(count); ParamUtils.isFinite(refMinorLogProb, "Cannot construct AllelicCountWithPhasePosteriors with non-finite ref-minor probability at: " + count.getInterval()); ParamUtils.isFinite(altMinorLogProb, "Cannot construct AllelicCountWithPhasePosteriors with non-finite alt-minor probability at: " + count.getInterval()); ParamUtils.isFinite(outlierLogProb, "Cannot construct AllelicCountWithPhasePosteriors with non-finite outlier probability at: " + count.getInterval()); final double[] normalizedProbs = MathUtils.normalizeFromLog10( new double[]{MathUtils.logToLog10(refMinorLogProb), MathUtils.logToLog10(altMinorLogProb), MathUtils.logToLog10(outlierLogProb)}); refMinorProb = normalizedProbs[0]; altMinorProb = normalizedProbs[1]; outlierProb = normalizedProbs[2]; Utils.validateArg(Double.isFinite(refMinorProb) && Double.isFinite(altMinorProb) && Double.isFinite(outlierProb), "Cannot construct AllelicCountWithPhasePosteriors with non-finite probabilities at: " + count.getInterval()); }
Source:
protected void formatMaster(final IFormattingContext context, final IDocument document, int offset, int length) { try { final int delta= offset - document.getLineInformationOfOffset(offset).getOffset(); offset -= delta; if (length != 0) length += delta; } catch (BadLocationException exception) { } if (fMaster != null) { context.setProperty(FormattingContextProperties.CONTEXT_PARTITION, new TypedPosition(offset, length, fType)); fMaster.formatterStarts(context); fMaster.format(); fMaster.formatterStops(); } }

Target:
protected void formatMaster(final IFormattingContext context, final IDocument document, int offset, int length) { try { if (length != 0) { final int delta= offset - document.getLineInformationOfOffset(offset).getOffset(); offset -= delta; length += delta; } } catch (BadLocationException exception) { } if (fMaster != null) { context.setProperty(FormattingContextProperties.CONTEXT_PARTITION, new TypedPosition(offset, length, fType)); fMaster.formatterStarts(context); fMaster.format(); fMaster.formatterStops(); } }
Source:
public void run() { TmfCoreTracer.traceRequest(fRequest, "is being serviced by " + fProvider.getName()); fRequest.start(); int nbRequested = fRequest.getNbRequested(); int nbRead = 0; isCompleted = false; ITmfContext context = fProvider.armRequest(fRequest); if (context == null) { fRequest.cancel(); return; } try { ITmfEvent event = fProvider.getNext(context); TmfCoreTracer.traceRequest(fRequest, "read first event"); while (event != null && !fProvider.isCompleted(fRequest, event, nbRead)) { TmfCoreTracer.traceEvent(fProvider, fRequest, event); if (fRequest.getDataType().isInstance(event)) { fRequest.handleData(event); } synchronized (fSynchObject) { while (fIsPaused) { try { fSynchObject.wait(); } catch (InterruptedException e) { } } } if (++nbRead < nbRequested) { event = fProvider.getNext(context); } } isCompleted = true; if (fRequest.isCancelled()) { fRequest.cancel(); } else { fRequest.done(); } } catch (Exception e) { Activator.logError("Error in " + fProvider.getName() + " handling " + fRequest, e); fRequest.fail(); } context.dispose(); }

Target:
public void run() { TmfCoreTracer.traceRequest(fRequest, "is being serviced by " + fProvider.getName()); fRequest.start(); int nbRequested = fRequest.getNbRequested(); int nbRead = 0; isCompleted = false; ITmfContext context = fProvider.armRequest(fRequest); if (context == null) { fRequest.cancel(); return; } try { ITmfEvent event = fProvider.getNext(context); TmfCoreTracer.traceRequest(fRequest, "read first event"); while (event != null && !fProvider.isCompleted(fRequest, event, nbRead)) { TmfCoreTracer.traceEvent(fProvider, fRequest, event); if (fRequest.getDataType().isInstance(event)) { fRequest.handleData(event); } while (fIsPaused) { synchronized (fSynchObject) { try { fSynchObject.wait(); } catch (InterruptedException e) { } } } if (++nbRead < nbRequested) { event = fProvider.getNext(context); } } isCompleted = true; if (fRequest.isCancelled()) { fRequest.cancel(); } else { fRequest.done(); } } catch (Exception e) { Activator.logError("Error in " + fProvider.getName() + " handling " + fRequest, e); fRequest.fail(); } context.dispose(); }
Source:
public StatusOnlyReturnForXmlRpc upgradeStoragePool(String storagePoolId, String targetVersion) { Map<String, Object> xmlRpcReturnValue = irsServer.upgradeStoragePool(storagePoolId, targetVersion); StatusOnlyReturnForXmlRpc wrapper = new StatusOnlyReturnForXmlRpc(xmlRpcReturnValue); return wrapper; }

Target:
public StatusOnlyReturnForXmlRpc upgradeStoragePool(String storagePoolId, String targetVersion) { Map<String, Object> xmlRpcReturnValue = irsServer.upgradeStoragePool(storagePoolId, targetVersion); return new StatusOnlyReturnForXmlRpc(xmlRpcReturnValue); }
Source:
private void close(final boolean clean, final Map<TopicPartition, Long> checkpoint) { if (clean && checkpoint != null) { executeAndMaybeSwallow(clean, () -> stateMgr.checkpoint(checkpoint), "state manager checkpoint", log); } switch (state()) { case CREATED: case RUNNING: case RESTORING: case SUSPENDED: final boolean wipeStateStore = !clean && !eosDisabled; executeAndMaybeSwallow( clean, () -> { StateManagerUtil.closeStateManager( log, logPrefix, clean, wipeStateStore, stateMgr, stateDirectory, TaskType.ACTIVE); }, "state manager close", log); executeAndMaybeSwallow(clean, recordCollector::close, "record collector close", log); break; default: throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); }

Target:
private void close(final boolean clean, final Map<TopicPartition, Long> checkpoint) { if (clean && checkpoint != null) { executeAndMaybeSwallow(clean, () -> stateMgr.checkpoint(checkpoint), "state manager checkpoint", log); } switch (state()) { case CREATED: case RUNNING: case RESTORING: case SUSPENDED: final boolean wipeStateStore = !clean && !eosDisabled; executeAndMaybeSwallow( clean, () -> StateManagerUtil.closeStateManager( log, logPrefix, clean, wipeStateStore, stateMgr, stateDirectory, TaskType.ACTIVE ), "state manager close", log); executeAndMaybeSwallow(clean, recordCollector::close, "record collector close", log); break; default: throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); }
Source:
private Multimap<Publisher, ScoredCandidate<T>> extract(T target, List<ScoredCandidate<T>> filteredCandidates, ResultDescription desc) { desc.startStage("Extracting strong equivalents"); SortedSetMultimap<Publisher, ScoredCandidate<T>> publisherBins = publisherBin(filteredCandidates); ImmutableMultimap.Builder<Publisher, ScoredCandidate<T>> builder = ImmutableMultimap.builder(); for (Publisher publisher : publisherBins.keySet()) { desc.startStage(String.format("Publisher: %s", publisher)); ImmutableSortedSet<ScoredCandidate<T>> copyOfSorted = ImmutableSortedSet.copyOfSorted(publisherBins.get(publisher)); Optional<ScoredCandidate<T>> extracted = extractor.extract(copyOfSorted.asList().reverse(), target, desc); Set<ScoredCandidate<T>> allowedCandidates = candidatesThatCanBeEquivalatedToSamePublisher(copyOfSorted, extracted, target); if(!extracted.isPresent()) { } else if (isSeriesOrBrand(extracted.get().candidate())) { builder.put(publisher, extracted.get()); } else if(allowedCandidates.size() > 0 && !isSeriesOrBrand(target)) { for (ScoredCandidate<T> scoredCandidate : allowedCandidates) { builder.put(publisher, scoredCandidate); } } else { if(extracted.isPresent()) { builder.put(publisher, extracted.get()); } } desc.finishStage(); } desc.finishStage(); return builder.build(); }

Target:
private Multimap<Publisher, ScoredCandidate<T>> extract( T target, List<ScoredCandidate<T>> filteredCandidates, ResultDescription desc ) { desc.startStage("Extracting strong equivalents"); SortedSetMultimap<Publisher, ScoredCandidate<T>> publisherBins = publisherBin(filteredCandidates); ImmutableMultimap.Builder<Publisher, ScoredCandidate<T>> builder = ImmutableMultimap.builder(); for (Publisher publisher : publisherBins.keySet()) { desc.startStage(String.format("Publisher: %s", publisher)); ImmutableSortedSet<ScoredCandidate<T>> copyOfSorted = ImmutableSortedSet.copyOfSorted(publisherBins.get(publisher)); Optional<Set<ScoredCandidate<T>>> multipleExtractedCandidates = multipleCandidateExtractor.extract( copyOfSorted.asList().reverse(), target ); if (multipleExtractedCandidates.isPresent()) { builder.putAll( publisher, multipleExtractedCandidates.get() ); } else { Optional<ScoredCandidate<T>> extracted = extractor.extract( copyOfSorted.asList().reverse(), target, desc ); if (extracted.isPresent()) { builder.put(publisher, extracted.get()); } } desc.finishStage(); } desc.finishStage(); return builder.build(); }
Source:
public void testChunkFillingBlobSizeMultipleOfChunkSize() throws Exception { blobSize = chunkSize * random.nextInt(10) + 1; fillChunksAndAssertSuccess(); }

Target:
public void testChunkFillingBlobSizeMultipleOfChunkSize() throws Exception { blobSize = chunkSize * (random.nextInt(10) + 1); fillChunksAndAssertSuccess(); }
Source:
public EList<DCell> getOrderedCells() { final Map<DColumn, Integer> columnIndices = Maps.newHashMap(); int i = 0; DTable table = TableHelper.getTable(this); if (table != null) { for (DColumn col : table.getColumns()) { columnIndices.put(col, i++); } } Ordering<DCell> ordering = Ordering.from(new Comparator<DCell>() { @Override public int compare(DCell a, DCell b) { int result = 0; DColumn columnA = a.getColumn(); DColumn columnB = b.getColumn(); if (columnA == null || columnA.eContainer() == null) { result = -1; } else if (columnB == null || columnB.eContainer() == null) { result = 1; } else { Integer aIndex = columnIndices.get(columnA); Integer bIndex = columnIndices.get(columnB); if (aIndex == null || bIndex == null) { throw new RuntimeException("Should not happen."); } return aIndex - bIndex; } return result; } }); DCell[] data = new DCell[getCells().size()]; getCells().toArray(data); Arrays.sort(data, ordering); return new EcoreEList.UnmodifiableEList<DCell>(eInternalContainer(), TablePackage.eINSTANCE.getDLine_OrderedCells(), data.length, data); }

Target:
public EList<DCell> getOrderedCells() { Ordering<DCell> ordering = Ordering.from(new Comparator<DCell>() { Map<DColumn, Integer> columnIndices; @Override public int compare(DCell a, DCell b) { int result = 0; DColumn columnA = a.getColumn(); DColumn columnB = b.getColumn(); if (columnA == null || columnA.eContainer() == null) { result = -1; } else if (columnB == null || columnB.eContainer() == null) { result = 1; } else { if (columnIndices == null) { columnIndices = Maps.newHashMap(); int i = 0; for (DColumn col : columnA.getTable().getColumns()) { columnIndices.put(col, i++); } } Integer aIndex = columnIndices.get(columnA); Integer bIndex = columnIndices.get(columnB); if (aIndex == null || bIndex == null) { throw new RuntimeException("Should not happen."); } return aIndex - bIndex; } return result; } }); DCell[] data = new DCell[getCells().size()]; getCells().toArray(data); Arrays.sort(data, ordering); return new EcoreEList.UnmodifiableEList<DCell>(eInternalContainer(), TablePackage.eINSTANCE.getDLine_OrderedCells(), data.length, data); }
Source:
@Override public void endElement(String ignoredUri, String ignoredName, String qName) { if (qName.equals("OS")) { String osText = currentOrNull(currentText); if (osText != null) { os = OSImage.Type.valueOf(currentOrNull(currentText).toUpperCase()); } } else if (qName.equals("Name")) { name = currentOrNull(currentText); } else if (qName.equals("LogicalSizeInGB")) { String gb = currentOrNull(currentText); if (gb != null) { logicalSizeInGB = Integer.parseInt(gb); } } else if (qName.equals("Description")) { description = currentOrNull(currentText); } else if (qName.equals("Category")) { category = currentOrNull(currentText); } else if (qName.equals("Location")) { String locationField = currentOrNull(currentText); if (locationField != null) { for (String location : Splitter.on(';').split(locationField)) { locations.add(location); } } } else if (qName.equals("AffinityGroup")) { affinityGroup = currentOrNull(currentText); } else if (qName.equals("MediaLink")) { String link = currentOrNull(currentText); if (link != null) { mediaLink = URI.create(link); } } else if (qName.equals("Eula")) { String eulaField = currentOrNull(currentText); if (eulaField != null) { for (String eula : Splitter.on(';').split(eulaField)) { if ((eula = emptyToNull(eula.trim())) != null) { eulas.add(eula); } } } } else if (qName.equals("Label")) { label = currentOrNull(currentText); } currentText.setLength(0); }

Target:
@Override public void endElement(String ignoredUri, String ignoredName, String qName) { if (qName.equals("OS")) { String osText = currentOrNull(currentText); if (osText != null) { os = OSImage.Type.valueOf(currentOrNull(currentText).toUpperCase()); } } else if (qName.equals("Name")) { name = currentOrNull(currentText); } else if (qName.equals("LogicalSizeInGB")) { String gb = currentOrNull(currentText); if (gb != null) { logicalSizeInGB = Integer.parseInt(gb); } } else if (qName.equals("Description")) { description = currentOrNull(currentText); } else if (qName.equals("Category")) { category = currentOrNull(currentText); } else if (qName.equals("Location")) { String locationField = currentOrNull(currentText); if (locationField != null) { locations.addAll(Splitter.on(';').splitToList(locationField)); } } else if (qName.equals("AffinityGroup")) { affinityGroup = currentOrNull(currentText); } else if (qName.equals("MediaLink")) { String link = currentOrNull(currentText); if (link != null) { mediaLink = URI.create(link); } } else if (qName.equals("Eula")) { String eulaField = currentOrNull(currentText); if (eulaField != null) { for (String eula : Splitter.on(';').split(eulaField)) { if ((eula = emptyToNull(eula.trim())) != null) { eulas.add(eula); } } } } else if (qName.equals("Label")) { label = currentOrNull(currentText); } currentText.setLength(0); }