auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testMultipleSchemas() throws Exception { PgConnection pgConnection = con.unwrap(PgConnection.class); String previousSchema = pgConnection.getSchema(); TestUtil.createSchema(con, "schema_update_row"); pgConnection.setSchema("schema_update_row"); TestUtil.createTable(con, "second", "id1 int, name1 text, name2 text, constraint second_pk primary key (id1, name2)"); Statement st2 = con.createStatement(); st2.execute("insert into second values (1,'anyvalue', 'anyvalue2')"); pgConnection.setSchema(previousSchema); Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = st.executeQuery("select id1, name1 from second"); rs.next(); rs.updateString("name1", "newval"); rs.updateRow(); rs.close(); }

Target:
public void testMultipleSchemas() throws Exception { PgConnection pgConnection = con.unwrap(PgConnection.class); String previousSchema = pgConnection.getSchema(); TestUtil.createSchema(con, "schema_update_row"); pgConnection.setSchema("schema_update_row"); TestUtil.createTable(con, "second", "id1 int, name1 text, name2 text, constraint second_pk primary key (id1, name2)"); Statement st2 = con.createStatement(); st2.execute("insert into second values (1,'anyvalue', 'anyvalue2')"); pgConnection.setSchema(previousSchema); Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = st.executeQuery("select id1, name1 from second"); rs.next(); rs.updateString("name1", "newval"); rs.updateRow(); rs.close(); @Test public void simpleAndUpdateableSameQuery() throws Exception { PGConnection unwrap = con.unwrap(PGConnection.class); Assume.assumeNotNull(unwrap); int prepareThreshold = unwrap.getPrepareThreshold(); String sql = "select * from second where id1=?"; for (int i = 0; i <= prepareThreshold; i++) { PreparedStatement ps = null; ResultSet rs = null; try { ps = con.prepareStatement(sql); ps.setInt(1, 1); rs = ps.executeQuery(); rs.next(); String name1 = rs.getString("name1"); Assert.assertEquals("anyvalue", name1); int id1 = rs.getInt("id1"); Assert.assertEquals(1, id1); } finally { TestUtil.closeQuietly(rs); TestUtil.closeQuietly(ps); } } { PreparedStatement ps = null; ResultSet rs = null; try { ps = con.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ps.setInt(1, 1); rs = ps.executeQuery(); rs.next(); String name1 = rs.getString("name1"); Assert.assertEquals("anyvalue", name1); int id1 = rs.getInt("id1"); Assert.assertEquals(1, id1); rs.updateString("name1", "updatedValue"); rs.updateRow(); } finally { TestUtil.closeQuietly(rs); TestUtil.closeQuietly(ps); } } } }
Source:
private void log(Exception exception) { CPSApplicationUIPlugin.getDefault().logException("An error happaned: " + exception.getMessage(), exception); }

Target:
private void log(Exception exception) { CPSApplicationUIPlugin.getDefault().logException("An error happened: " + exception.getMessage(), exception); }
Source:
protected void toggleGhost(KeyValueLineModel value, KeyValueLineWidget widget, boolean becomingGhost) { super.toggleGhost(value, widget, becomingGhost); widget.setEnabled(!becomingGhost); widget.keyField.setEnabled(true); }

Target:
protected void toggleGhost(KeyValueLineModel value, KeyValueLineWidget widget, boolean becomingGhost) { if (!widget.isEnabled()) { return; } super.toggleGhost(value, widget, becomingGhost); widget.setEnabled(!becomingGhost); widget.keyField.setEnabled(true); }
Source:
public void setItemCountEstimateIncrease(int itemCountEstimateIncrease) { if (itemCountEstimateIncrease < 1) { throw new IllegalArgumentException( "itemCountEstimateIncrease cannot be less than 1"); } this.itemCountEstimateIncrease = itemCountEstimateIncrease; this.countCallback = null; this.definedSize = false; }

Target:
public void setItemCountEstimateIncrease(int itemCountEstimateIncrease) { if (itemCountEstimateIncrease < 1) { throw new IllegalArgumentException( "itemCountEstimateIncrease cannot be less than 1"); } this.itemCountEstimateIncrease = itemCountEstimateIncrease; countCallback = null; definedSize = false; }
Source:
public boolean unregisterOutput(String id) { return watermarkPerOutputId.remove(id) != null; }

Target:
public boolean unregisterOutput(String id) { final OutputState output = watermarkPerOutputId.remove(id); if (output != null) { watermarkOutputs.remove(output); return true; } else { return false; } }
Source:
public void shouldDisallowAddingIndexWhenConstraintIndexExists() throws Exception { SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = new DataIntegrityValidatingStatementOperations( null, innerRead, innerWrite ); when( innerRead.indexGetForLabelAndPropertyKey( state, SchemaBoundary.map( descriptor ) ) ).thenReturn( uniqueIndex ); ctx.indexCreate( state, descriptor ); fail( "Should have thrown exception." ); verify( innerWrite, never() ).indexCreate( eq( state ), anyObject() ); }

Target:
public void shouldDisallowAddingIndexWhenConstraintIndexExists() throws Exception { SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = new DataIntegrityValidatingStatementOperations( null, innerRead, innerWrite ); when( innerRead.indexGetForLabelAndPropertyKey( state, SchemaBoundary.map( descriptor ) ) ).thenReturn( uniqueIndex ); try { ctx.indexCreate( state, descriptor ); fail( "Should have thrown exception." ); } catch ( AlreadyConstrainedException e ) { } verify( innerWrite, never() ).indexCreate( eq( state ), anyObject() ); }
Source:
public void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, final Map<String, String> customValues) { AuditLogDirector.log(new AuditLogableBase() { @Override protected VDS getVds() { return server; } @Override public VDSGroup getVdsGroup() { setVdsGroupId(clusterId); return super.getVdsGroup(); } @Override protected GlusterVolumeEntity getGlusterVolume() { return volume; } @Override public AuditLogType getAuditLogTypeValue() { return logType; } @Override public Map<String, String> getCustomValues() { return customValues; } }); }

Target:
public void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, final Map<String, String> customValues) { AuditLogableBase logable = new AuditLogableBase(); logable.setAuditLogType(logType); logable.setVds(server); logable.setGlusterVolume(volume); logable.setVdsGroupId(clusterId == null ? Guid.Empty : clusterId); if (customValues != null) { for (String key : customValues.keySet()) { logable.addCustomValue(key, customValues.get(key)); } } AuditLogDirector.log(logable); }
Source:
public CompletionStage<Void> handle(CacheEntryCreatedEvent e) { if (e.isPre()) { caller = Thread.currentThread(); latch.countDown(); } return null; }

Target:
public CompletionStage<Void> handle(CacheEntryCreatedEvent e) { if (e.isPre()) { caller = Thread.currentThread(); latch.countDown(); } return CompletableFutures.completedNull(); }
Source:
private boolean delete(Media media, String reason) { String editToken; String authCookie; String summary = "Nominating " + media.getFilename() + " for deletion."; authCookie = sessionManager.getAuthCookie(); mwApi.setAuthCookie(authCookie); Calendar calendar = Calendar.getInstance(); String fileDeleteString = "{{delete|reason=" + reason + "|subpage=" + media.getFilename() + "|day=" + calendar.get(Calendar.DAY_OF_MONTH) + "|month=" + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "|year=" + calendar.get(Calendar.YEAR) + "}}"; String subpageString = "=== [[:" + media.getFilename() + "]] ===\n" + reason + " ~~~~"; String logPageString = "\n{{Commons:Deletion requests" + media.getFilename() + "}}\n"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); String date = sdf.format(calendar.getTime()); String userPageString = "\n" + "{{subst:idw|" + media.getFilename() + "}} ~~~~"; try { editToken = mwApi.getEditToken(); if(editToken == null) { return false; } mwApi.prependEdit(editToken, fileDeleteString + "\n", media.getFilename(), summary); mwApi.edit(editToken, subpageString + "\n", "Commons:Deletion_requests/" + media.getFilename(), summary); mwApi.appendEdit(editToken, logPageString + "\n", "Commons:Deletion_requests/" + date, summary); mwApi.appendEdit(editToken, userPageString + "\n", "User_Talk:" + media.getCreator(), summary); } catch (Exception e) { Timber.e(e); return false; } return true; }

Target:
private boolean delete(Media media, String reason) { String editToken; String authCookie; String summary = "Nominating " + media.getFilename() + " for deletion."; authCookie = sessionManager.getAuthCookie(); mwApi.setAuthCookie(authCookie); Calendar calendar = Calendar.getInstance(); String fileDeleteString = "{{delete|reason=" + reason + "|subpage=" + media.getFilename() + "|day=" + calendar.get(Calendar.DAY_OF_MONTH) + "|month=" + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "|year=" + calendar.get(Calendar.YEAR) + "}}"; String subpageString = "=== [[:" + media.getFilename() + "]] ===\n" + reason + " ~~~~"; String logPageString = "\n{{Commons:Deletion requests/" + media.getFilename() + "}}\n"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); String date = sdf.format(calendar.getTime()); String userPageString = "\n{{subst:idw|" + media.getFilename() + "}} ~~~~"; try { editToken = mwApi.getEditToken(); if(editToken == null) { return false; } mwApi.prependEdit(editToken, fileDeleteString + "\n", media.getFilename(), summary); mwApi.edit(editToken, subpageString + "\n", "Commons:Deletion_requests/" + media.getFilename(), summary); mwApi.appendEdit(editToken, logPageString + "\n", "Commons:Deletion_requests/" + date, summary); mwApi.appendEdit(editToken, userPageString + "\n", "User_Talk:" + media.getCreator(), summary); } catch (Exception e) { Timber.e(e); return false; } return true; }
Source:
public Iterable<String> getLocationIds() { if (isInitialManagementContextReal()) { return ((LocationManagerInternal)initialManagementContext.getLocationManager()).getLocationIds(); } else { return null; } }

Target:
public Iterable<String> getLocationIds() { if (isInitialManagementContextReal()) { return ((LocationManagerInternal)initialManagementContext.getLocationManager()).getLocationIds(); } else { return Collections.emptyList(); } }
Source:
public JSONObject toJson(String[] selectedResults) { JSONObject test = new JSONObject(); test.put("name",this.testName); test.put("description",this.testDescription); JSONArray jsonParams = new JSONArray(); for (int i = 0; i < parameters.size(); i++) { JSONObject param = parameters.get(i).toJson(); jsonParams.put(param); } test.put("parameters",parameters); JSONArray jsonMetrics = new JSONArray(); if (selectedResults == null) { for (HashMap.Entry<String, AveragedMetric> entry : metrics.entrySet()) { AveragedMetric metric = entry.getValue(); metric.discardOutliers(); JSONObject obj = serializeMetric(metric,false); jsonMetrics.put(obj); } } else { for (int i = 0; i < selectedResults.length; i++) { AveragedMetric metric = metrics.get(selectedResults[i]); if (metric == null) { continue; } metric.discardOutliers(); JSONObject obj = serializeMetric(metric,false); jsonMetrics.put(obj); } } test.put("results",jsonMetrics); return test; }

Target:
public JSONObject toJson(String[] selectedResults) { JSONObject test = new JSONObject(); test.put("name",this.testName); test.put("description",this.testDescription); JSONArray jsonParams = new JSONArray(); for (int i = 0; i < parameters.size(); i++) { JSONObject param = parameters.get(i).toJson(); jsonParams.put(param); } test.put("parameters",parameters); JSONArray jsonMetrics = new JSONArray(); if (selectedResults == null || selectedResults.length == 0) { for (HashMap.Entry<String, MetricInfo> entry : metrics.entrySet()) { MetricInfo metricInfo = entry.getValue(); if (metricInfo == null || metricInfo.metric == null) { continue; } JSONObject obj = serializeMetric(metricInfo,false); jsonMetrics.put(obj); } } else { for (int i = 0; i < selectedResults.length; i++) { MetricInfo metricInfo = metrics.get(selectedResults[i]); if (metricInfo == null || metricInfo.metric == null) { continue; } JSONObject obj = serializeMetric(metricInfo,false); jsonMetrics.put(obj); } } test.put("results",jsonMetrics); return test; }
Source:
protected PageProvider<LogEntry> getPageProvider(String name, int pageSize, int currentPage, Object... parameters) { final List<SortInfo> sorters = List.of(new SortInfo("eventDate", true)); @SuppressWarnings("unchecked") PageProvider<LogEntry> pageProvider = (PageProvider<LogEntry>) pageProviderService.getPageProvider(name, sorters, Long.valueOf(pageSize), Long.valueOf(currentPage), Map.of(), parameters); return pageProvider; }

Target:
protected PageProvider<LogEntry> getPageProvider(String name, int pageSize, int currentPage, Object... parameters) { List<SortInfo> sorters = List.of(new SortInfo("id", true)); @SuppressWarnings("unchecked") PageProvider<LogEntry> pageProvider = (PageProvider<LogEntry>) pageProviderService.getPageProvider(name, sorters, Long.valueOf(pageSize), Long.valueOf(currentPage), Map.of(), parameters); return pageProvider; }
Source:
GdkRGBA gtk_css_parse_foreground (String css, String precise) { if (css.isEmpty()) return COLOR_WIDGET_FOREGROUND_RGBA; String shortOutput; int startIndex; GdkRGBA rgba = new GdkRGBA (); String searched = ""; if (precise != null) { if (css.contains(precise)) { searched = css.substring(css.indexOf(precise)); } } else { searched = css; } if (searched.isEmpty()) { return COLOR_WIDGET_FOREGROUND_RGBA; } Matcher m = r.matcher(searched); if (m.find()) { String match = m.group(0); if (match.contains("color:")) { startIndex = match.indexOf("color:"); shortOutput = match.substring(startIndex + 7); rgba = gtk_css_property_to_rgba(shortOutput); } } else { return COLOR_WIDGET_FOREGROUND_RGBA; } return rgba; }

Target:
GdkRGBA gtk_css_parse_foreground (String css, String precise) { if (css.isEmpty()) return COLOR_WIDGET_FOREGROUND_RGBA; String shortOutput; int startIndex; GdkRGBA rgba = new GdkRGBA (); String searched = ""; if (precise != null) { if (css.contains(precise)) { searched = css.substring(css.indexOf(precise)); } } else { searched = css; } if (searched.isEmpty()) { return COLOR_WIDGET_FOREGROUND_RGBA; } Matcher m = colorPattern.matcher(searched); if (m.find()) { String match = m.group(0); if (match.contains("color:")) { startIndex = match.indexOf("color:"); shortOutput = match.substring(startIndex + 7); rgba = gtk_css_property_to_rgba(shortOutput); } } else { return COLOR_WIDGET_FOREGROUND_RGBA; } return rgba; }
Source:
protected void runImpl() throws IOException, Failure { PacketLineOut packetOut = new PacketLineOut(out); packetOut.setFlushOnEnd(true); packetOut.writeString("ACK"); packetOut.end(); try { readArguments(); if (!uploadArchiveAllowed || !projectControl.allRefsAreVisible()) { throw new Failure(4, "fatal: upload-archive not permitted on this" + "server"); } ObjectId treeId = repo.resolve(options.treeIsh); if (treeId.equals(ObjectId.zeroId())) { throw new Failure(5, "fatal: reference not found"); } String format = options.format; boolean wasFormatRegistered = registerArchiveFormat(format); try { SideBandOutputStream sidebandOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, out); new ArchiveCommand(repo) .setFormat(format) .setTree(treeId) .setPaths(options.path.toArray(new String[0])) .setPrefix(options.prefix) .setOutputStream(sidebandOut) .call(); sidebandOut.flush(); sidebandOut.close(); } catch (GitAPIException e) { throw new Failure(6, "fatal: git api exception, " + e); } finally { if (wasFormatRegistered) { unregisterArchiveFormat(format); } } } catch (Failure f) { SideBandOutputStream sidebandError = new SideBandOutputStream(SideBandOutputStream.CH_ERROR, SideBandOutputStream.MAX_BUF, out); sidebandError.write(f.getMessage().getBytes()); sidebandError.flush(); sidebandError.close(); throw f; } finally { packetOut.end(); } }

Target:
protected void runImpl() throws IOException, Failure { PacketLineOut packetOut = new PacketLineOut(out); packetOut.setFlushOnEnd(true); packetOut.writeString("ACK"); packetOut.end(); try { readArguments(); if (!uploadArchiveAllowed || !projectControl.allRefsAreVisible()) { throw new Failure(4, "fatal: upload-archive not permitted on this" + "server"); } ObjectId treeId = repo.resolve(options.treeIsh); if (treeId.equals(ObjectId.zeroId())) { throw new Failure(5, "fatal: reference not found"); } String format = options.format; boolean wasFormatRegistered = registerArchiveFormat(format); try { SideBandOutputStream sidebandOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, out); new ArchiveCommand(repo) .setFormat(format) .setTree(treeId) .setPaths(options.path.toArray(new String[0])) .setPrefix(options.prefix) .setOutputStream(sidebandOut) .call(); sidebandOut.flush(); sidebandOut.close(); } catch (GitAPIException e) { throw new Failure(6, "fatal: git api exception, " + e); } finally { if (wasFormatRegistered) { unregisterArchiveFormat(format); } } } catch (Failure f) { SideBandOutputStream sidebandError = new SideBandOutputStream(SideBandOutputStream.CH_ERROR, SideBandOutputStream.MAX_BUF, out); sidebandError.write(f.getMessage().getBytes("UTF-8")); sidebandError.flush(); sidebandError.close(); throw f; } finally { packetOut.end(); } }
Source:
private PieData getData() { PieDataSet dataSet = new PieDataSet(null, ""); List<String> labels = new ArrayList<>(); List<Integer> colors = new ArrayList<>(); for (Account account : mAccountsDbAdapter.getSimpleAccountList()) { if (account.getAccountType() == AccountType.EXPENSE && !account.isPlaceholderAccount() && account.getCommodity() == mCommodity) { long start = new LocalDate().minusMonths(2).dayOfMonth().withMinimumValue().toDate().getTime(); long end = new LocalDate().plusDays(1).toDate().getTime(); double balance = mAccountsDbAdapter.getAccountsBalance( Collections.singletonList(account.getUID()), start, end).asDouble(); if (balance > 0) { dataSet.addEntry(new Entry((float) balance, dataSet.getEntryCount())); colors.add(account.getColor() != Account.DEFAULT_COLOR ? account.getColor() : ReportsActivity.COLORS[(dataSet.getEntryCount() - 1) % ReportsActivity.COLORS.length]); labels.add(account.getName()); } } } dataSet.setColors(colors); dataSet.setSliceSpace(PieChartFragment.SPACE_BETWEEN_SLICES); return new PieData(labels, dataSet); }

Target:
private PieData getData() { PieDataSet dataSet = new PieDataSet(null, ""); List<String> labels = new ArrayList<>(); List<Integer> colors = new ArrayList<>(); for (Account account : mAccountsDbAdapter.getSimpleAccountList()) { if (account.getAccountType() == AccountType.EXPENSE && !account.isPlaceholderAccount() && account.getCommodity().equals(mCommodity)) { long start = new LocalDate().minusMonths(2).dayOfMonth().withMinimumValue().toDate().getTime(); long end = new LocalDate().plusDays(1).toDate().getTime(); double balance = mAccountsDbAdapter.getAccountsBalance( Collections.singletonList(account.getUID()), start, end).asDouble(); if (balance > 0) { dataSet.addEntry(new Entry((float) balance, dataSet.getEntryCount())); colors.add(account.getColor() != Account.DEFAULT_COLOR ? account.getColor() : ReportsActivity.COLORS[(dataSet.getEntryCount() - 1) % ReportsActivity.COLORS.length]); labels.add(account.getName()); } } } dataSet.setColors(colors); dataSet.setSliceSpace(PieChartFragment.SPACE_BETWEEN_SLICES); return new PieData(labels, dataSet); }
Source:
public Boolean showRemoveButton() { if (_showRemoveButton == null) { boolean isRemoveable = ERXValueUtilities.booleanValueWithDefault(d2wContext().valueForKey("isEntityRemoveable"), false); EODataSource ds = dataSource(); if (ds!= null && ds instanceof EODetailDataSource) { EODetailDataSource dds = (EODetailDataSource)ds; EOEnterpriseObject masterObj = (EOEnterpriseObject)dds.masterObject(); EOEntity masterEntity = ERXEOAccessUtilities.entityForEo(masterObj); EORelationship relationship = masterEntity.relationshipNamed(dds.detailKey()); EORelationship reverseRelationship = relationship.inverseRelationship(); if(isRemoveable && !relationship.ownsDestination()) { if (!relationship.ownsDestination()) { if (reverseRelationship == null) { _showRemoveButton = Boolean.TRUE; } else { _showRemoveButton = !reverseRelationship.isMandatory(); } } } else { _showRemoveButton = Boolean.FALSE; } } else { _showRemoveButton = Boolean.valueOf(isRemoveable); } } return _showRemoveButton; }

Target:
public Boolean showRemoveButton() { if (_showRemoveButton == null) { boolean isRemoveable = ERXValueUtilities.booleanValueWithDefault(d2wContext().valueForKey("isEntityRemoveable"), false); EODataSource ds = dataSource(); if (ds!= null && ds instanceof EODetailDataSource) { EODetailDataSource dds = (EODetailDataSource)ds; EOEnterpriseObject masterObj = (EOEnterpriseObject)dds.masterObject(); EOEntity masterEntity = ERXEOAccessUtilities.entityForEo(masterObj); EORelationship relationship = masterEntity.relationshipNamed(dds.detailKey()); EORelationship reverseRelationship = relationship.inverseRelationship(); if(isRemoveable && !relationship.ownsDestination()) { if (reverseRelationship == null) { _showRemoveButton = Boolean.TRUE; } else { _showRemoveButton = !reverseRelationship.isMandatory(); } } else { _showRemoveButton = Boolean.FALSE; } } else { _showRemoveButton = Boolean.valueOf(isRemoveable); } } return _showRemoveButton; }
Source:
public static String generatePartitionPath(LinkedHashMap<String, String> partitionSpec) { StringBuilder suffixBuf = new StringBuilder(); int i = 0; for (Map.Entry<String, String> e : partitionSpec.entrySet()) { if (i > 0) { suffixBuf.append(Path.SEPARATOR); } suffixBuf.append(escapePathName(e.getKey())); suffixBuf.append('='); suffixBuf.append(escapePathName(e.getValue())); i++; } if (partitionSpec.size() > 0) { suffixBuf.append(Path.SEPARATOR); } return suffixBuf.toString(); }

Target:
public static String generatePartitionPath(LinkedHashMap<String, String> partitionSpec) { if (partitionSpec.isEmpty()) { return ""; } StringBuilder suffixBuf = new StringBuilder(); int i = 0; for (Map.Entry<String, String> e : partitionSpec.entrySet()) { if (i > 0) { suffixBuf.append(Path.SEPARATOR); } suffixBuf.append(escapePathName(e.getKey())); suffixBuf.append('='); suffixBuf.append(escapePathName(e.getValue())); i++; } suffixBuf.append(Path.SEPARATOR); return suffixBuf.toString(); }
Source:
public ListBoxModel doFillTimeZoneNameItems() { String current = forCurrentUser(); ListBoxModel items = new ListBoxModel(); items.add(""); for (String id : TimeZone.getAvailableIDs()) { if (id.equalsIgnoreCase(current)) { items.add(new Option(id, id, true)); } else { items.add(id); } } Messages.TimeZoneProperty_DisplayName(); return items; }

Target:
public ListBoxModel doFillTimeZoneNameItems() { String current = forCurrentUser(); ListBoxModel items = new ListBoxModel(); items.add(Messages.TimeZoneProperty_DisplayDefaultTimeZone(), ""); for (String id : TimeZone.getAvailableIDs()) { if (id.equalsIgnoreCase(current)) { items.add(new Option(id, id, true)); } else { items.add(id); } } return items; }
Source:
public Map<String, String> getFields() { Map<String, String> map = fFields; if (map == null) { Builder<String, String> builder = ImmutableMap.<String, String> builder() .put("Source Port", String.valueOf(fSourcePort)) .put("Destination Port", String.valueOf(fDestinationPort)) .put("Sequence Number", String.valueOf(fSequenceNumber)) .put("Acknowledgement Number", String.valueOf(fAcknowledgmentNumber)) .put("Length", String.valueOf(fDataOffset * TCPValues.BLOCK_SIZE) + " bytes") .put("ECN-Nonce Flag", String.valueOf(fNSFlag)) .put("Congestion Window Reduced Flag", String.valueOf(fCWRFlag)) .put("ECN-Echo Flag", String.valueOf(fECEFlag)) .put("Urgent Flag", String.valueOf(fURGFlag)) .put("ACK Flag", String.valueOf(fACKFlag)) .put("PSH Flag", String.valueOf(fPSHFlag)) .put("RST Flag", String.valueOf(fRSTFlag)) .put("SYN Flag", String.valueOf(fSYNFlag)) .put("FIN Flag", String.valueOf(fFINFlag)) .put("Window Size Value", String.valueOf(fWindowSize)) .put("Checksum", String.format("%s%04x", "0x", fChecksum)) .put("Urgent Pointer", String.format("%s%04x", "0x", fUrgentPointer)); byte[] options = fOptions; if (options == null) { builder.put("Options", EMPTY_STRING); } else { builder.put("Options", ConversionHelper.bytesToHex(options, true)); } fFields = NonNullUtils.checkNotNull(builder.build()); return fFields; } return map; }

Target:
public Map<String, String> getFields() { Map<String, String> map = fFields; if (map == null) { Builder<String, String> builder = ImmutableMap.<String, String> builder() .put("Source Port", String.valueOf(fSourcePort)) .put("Destination Port", String.valueOf(fDestinationPort)) .put("Sequence Number", String.valueOf(fSequenceNumber)) .put("Acknowledgement Number", String.valueOf(fAcknowledgmentNumber)) .put("Length", String.valueOf(fDataOffset * TCPValues.BLOCK_SIZE) + " bytes") .put("ECN-Nonce Flag", String.valueOf(fNSFlag)) .put("Congestion Window Reduced Flag", String.valueOf(fCWRFlag)) .put("ECN-Echo Flag", String.valueOf(fECEFlag)) .put("Urgent Flag", String.valueOf(fURGFlag)) .put("ACK Flag", String.valueOf(fACKFlag)) .put("PSH Flag", String.valueOf(fPSHFlag)) .put("RST Flag", String.valueOf(fRSTFlag)) .put("SYN Flag", String.valueOf(fSYNFlag)) .put("FIN Flag", String.valueOf(fFINFlag)) .put("Window Size Value", String.valueOf(fWindowSize)) .put("Checksum", String.format("%s%04x", "0x", fChecksum)) .put("Urgent Pointer", String.format("%s%04x", "0x", fUrgentPointer)); byte[] options = fOptions; if (options == null) { builder.put("Options", EMPTY_STRING); } else { builder.put("Options", ConversionHelper.bytesToHex(options, true)); } fFields = checkNotNull(builder.build()); return fFields; } return map; }
Source:
public CruelDeceiverEffect() { super(Outcome.AddAbility); this.staticText = "Reveal the top card of your library. If it's a land card, Cruel Deceiver gains \"Whenever Cruel Deceiver deals damage to a creature, destroy that creature\" until end of turn"; }

Target:
public CruelDeceiverEffect() { super(Outcome.AddAbility); this.staticText = "Reveal the top card of your library. If it's a land card, {this} gains \"Whenever Cruel Deceiver deals damage to a creature, destroy that creature\" until end of turn"; }
Source:
public String toString() { return SpongeCatalogType.toStringHelperTranslatable(this) .toString(); }

Target:
public String toString() { if (this.toString == null) { this.toString = SpongeCatalogType.toStringHelperTranslatable(this) .toString(); } return this.toString; }
Source:
public Request<TransactionContext, String> toCreateRequest(String containerId) { return SnomedRequests.prepareNewMember() .setReferencedComponentId(containerId) .setReferenceSetId(getReferenceSetId()) .setModuleId(getModuleId()) .setProperties(getProperties()) .build(); }

Target:
public Request<TransactionContext, String> toCreateRequest(String containerId) { return SnomedRequests.prepareNewMember() .setActive(isActive()) .setReferencedComponentId(containerId) .setReferenceSetId(getReferenceSetId()) .setModuleId(getModuleId()) .setProperties(getProperties()) .build(); }
Source:
public SimpleNodeSelector( InternalNodeManager nodeManager, NodeSelectionStats nodeSelectionStats, NodeTaskMap nodeTaskMap, boolean includeCoordinator, Supplier<NodeMap> nodeMap, int minCandidates, int maxSplitsPerNode, int maxPendingSplitsPerTask, int maxTasksPerStage) { this.nodeManager = requireNonNull(nodeManager, "nodeManager is null"); this.nodeSelectionStats = requireNonNull(nodeSelectionStats, "NodeSelectionStats is null"); this.nodeTaskMap = requireNonNull(nodeTaskMap, "nodeTaskMap is null"); this.includeCoordinator = includeCoordinator; this.nodeMap = new AtomicReference<>(nodeMap); this.minCandidates = minCandidates; this.maxSplitsPerNode = maxSplitsPerNode; this.maxPendingSplitsPerTask = maxPendingSplitsPerTask; this.maxTasksPerStage = maxTasksPerStage; }

Target:
public SimpleNodeSelector( InternalNodeManager nodeManager, NodeSelectionStats nodeSelectionStats, NodeTaskMap nodeTaskMap, boolean includeCoordinator, Supplier<NodeMap> nodeMap, int minCandidates, int maxSplitsPerNode, int maxPendingSplitsPerTask, int maxTasksPerStage) { this.nodeManager = requireNonNull(nodeManager, "nodeManager is null"); this.nodeSelectionStats = requireNonNull(nodeSelectionStats, "nodeSelectionStats is null"); this.nodeTaskMap = requireNonNull(nodeTaskMap, "nodeTaskMap is null"); this.includeCoordinator = includeCoordinator; this.nodeMap = new AtomicReference<>(nodeMap); this.minCandidates = minCandidates; this.maxSplitsPerNode = maxSplitsPerNode; this.maxPendingSplitsPerTask = maxPendingSplitsPerTask; this.maxTasksPerStage = maxTasksPerStage; }
Source:
public StatsAndCosts( @JsonProperty("stats") Map<PlanNodeId, PlanNodeStatsEstimate> stats, @JsonProperty("costs") Map<PlanNodeId, PlanNodeCostEstimate> costs) { this.stats = requireNonNull(stats, "stats is null"); this.costs = requireNonNull(costs, "costs is null"); }

Target:
public StatsAndCosts( @JsonProperty("stats") Map<PlanNodeId, PlanNodeStatsEstimate> stats, @JsonProperty("costs") Map<PlanNodeId, PlanNodeCostEstimate> costs) { this.stats = ImmutableMap.copyOf(requireNonNull(stats, "stats is null")); this.costs = ImmutableMap.copyOf(requireNonNull(costs, "costs is null")); }
Source:
protected String createFile(int wordCount) throws IOException { File tempFile = testFolder.newFile("file.txt"); try (FileWriter fw = new FileWriter(tempFile, true)) { BufferedWriter bw = new BufferedWriter(fw); for (int i = 0; i < wordCount; i++) { bw.write(" word" + i); if (rand.nextInt(10) == 1) { bw.newLine(); } } bw.close(); } return tempFile.getAbsolutePath(); }

Target:
protected String createFile(int wordCount) throws IOException { File tempFile = testFolder.newFile("file.txt"); try (FileWriter fw = new FileWriter(tempFile, true); BufferedWriter bw = new BufferedWriter(fw)) { for (int i = 0; i < wordCount; i++) { bw.write(" word" + i); if (RANDOM.nextInt(10) == 1) { bw.newLine(); } } } return tempFile.getAbsolutePath(); }
Source:
private void handleRemovedDevices(Guid vmId, HashSet<Guid> processedDevices, List<VmDevice> devices) { for (VmDevice device : devices) { if (!processedDevices.contains(device.getDeviceId())) { if (device.getIsManaged()) { if (!device.getIsPlugged()) { log.errorFormat("VM {0} managed non pluggable device was removed unexpetedly from libvirt: {1}", vmId, device.toString()); } else { device.setAddress(""); addVmDeviceToList(device); log.debugFormat("VM {0} managed pluggable device was unplugged : {1}", vmId, device.toString()); } } else { removedDeviceIds.add(device.getId()); log.debugFormat("VM {0} unmanaged device was marked for remove : {1}", vmId, device.toString()); } } } }

Target:
private void handleRemovedDevices(Guid vmId, HashSet<Guid> processedDevices, List<VmDevice> devices) { for (VmDevice device : devices) { if (!processedDevices.contains(device.getDeviceId())) { if (device.getIsManaged()) { if (!device.getIsPlugged()) { log.errorFormat("VM {0} managed non pluggable device was removed unexpectedly from libvirt: {1}", vmId, device.toString()); } else { device.setAddress(""); addVmDeviceToList(device); log.debugFormat("VM {0} managed pluggable device was unplugged : {1}", vmId, device.toString()); } } else { removedDeviceIds.add(device.getId()); log.debugFormat("VM {0} unmanaged device was marked for remove : {1}", vmId, device.toString()); } } } }
Source:
protected void setUp() throws Exception { super.setUp(); Statement stmt = con.createStatement(); TestUtil.createTable(con, "testtz", "col1 INTEGER, col2 TIMESTAMP"); stmt.close(); con.setAutoCommit(false); }

Target:
protected void setUp() throws Exception { super.setUp(); Statement stmt = con.createStatement(); TestUtil.createTable(con, "testtz", "col1 INTEGER, col2 TIMESTAMP"); stmt.close(); }
Source:
public void shouldCallSendTemplateMethod() throws IOException, SAXException, ParserConfigurationException, ClassNotFoundException { Map<String, Object> params = new HashMap<>(); params.put(Constants.TEMPLATE_NAME_PARAM, "sampleTemplate3"); params.put(Constants.RECIPIENT_NAME_PARAM, "sampleRecipient3"); byte[] bytes = IOUtils.toByteArray(getClass().getResourceAsStream("/empty_template.xml")); Byte[] byteObjects = new Byte[bytes.length]; int i = 0; for (byte b : bytes) { byteObjects[i++] = b; } when(iheTemplateDataService.findByName("sampleTemplate3")).thenReturn(cdaTemplate); when(hl7RecipientsService.getRecipientbyName("sampleRecipient3")).thenReturn(hl7Recipient); when((Byte[]) iheTemplateDataService.getDetachedField(cdaTemplate, "templateData")).thenReturn(byteObjects); iheActionHelper.handleAction(params); }

Target:
public void shouldCallSendTemplateMethod() throws IOException, SAXException, ParserConfigurationException, ClassNotFoundException { Map<String, Object> params = new HashMap<>(); params.put(Constants.TEMPLATE_NAME_PARAM, "sampleTemplate3"); params.put(Constants.RECIPIENT_NAME_PARAM, "sampleRecipient3"); byte[] bytes; try (InputStream inputStream = getClass().getResourceAsStream("/empty_template.xml")) { bytes = IOUtils.toByteArray(inputStream); } Byte[] byteObjects = ArrayUtils.toObject(bytes); when(iheTemplateDataService.findByName("sampleTemplate3")).thenReturn(cdaTemplate); when(hl7RecipientsService.getRecipientbyName("sampleRecipient3")).thenReturn(hl7Recipient); when((Byte[]) iheTemplateDataService.getDetachedField(cdaTemplate, "templateData")).thenReturn(byteObjects); iheActionHelper.handleAction(params); verify(iheTemplateService).sendTemplateToRecipientUrl(hl7Recipient.getRecipientUrl(), new String(bytes, StandardCharsets.UTF_8)); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Offset other = (Offset) o; return name.equals(other.name) && offset == other.offset; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Offset other = (Offset) o; return compareTo(other) == 0; }
Source:
public void updateQtyBatchs(final I_PP_Order order, final boolean override) { BigDecimal qtyBatchSize = order.getQtyBatchSize(); if (qtyBatchSize.signum() == 0 || override) { final int AD_Workflow_ID = order.getAD_Workflow_ID(); if (AD_Workflow_ID <= 0) { return; } final I_AD_Workflow wf = order.getAD_Workflow(); qtyBatchSize = wf.getQtyBatchSize().setScale(0, RoundingMode.UP); } final BigDecimal qtyBatchs; if (qtyBatchSize.signum() == 0) { qtyBatchs = BigDecimal.ONE; } else { final BigDecimal qtyOrdered = order.getQtyOrdered(); qtyBatchs = qtyOrdered.divide(qtyBatchSize, 0, BigDecimal.ROUND_UP); } order.setQtyBatchs(qtyBatchs); }

Target:
public void updateQtyBatchs(final I_PP_Order order, final boolean override) { BigDecimal qtyBatchSize = order.getQtyBatchSize(); if (qtyBatchSize.signum() == 0 || override) { final int AD_Workflow_ID = order.getAD_Workflow_ID(); if (AD_Workflow_ID <= 0) { return; } final I_AD_Workflow wf = order.getAD_Workflow(); qtyBatchSize = wf.getQtyBatchSize().setScale(0, RoundingMode.UP); order.setQtyBatchSize(qtyBatchSize); } final BigDecimal qtyBatchs; if (qtyBatchSize.signum() == 0) { qtyBatchs = BigDecimal.ONE; } else { final BigDecimal qtyOrdered = order.getQtyOrdered(); qtyBatchs = qtyOrdered.divide(qtyBatchSize, 0, BigDecimal.ROUND_UP); } order.setQtyBatchs(qtyBatchs); }
Source:
public static boolean isFieldObjectType(String fieldName){ if(fieldName == null){ return false; } return OBJECTTYPE_FIELD.equalsIgnoreCase(fieldName); }

Target:
public static boolean isFieldObjectType(String fieldName){ return OBJECTTYPE_FIELD.equalsIgnoreCase(fieldName); }
Source:
private void loadClasses() throws ClassNotFoundException { List<String> classNames = clientUserCodeDeploymentConfig.getClassNames(); List<Class<?>> classes = new ArrayList<Class<?>>(classNames.size()); for (String className : classNames) { classes.add(configClassLoader.loadClass(className)); } List<Class> sortedClasses = sortByInheritance(classes); for (Class clazz : sortedClasses) { String className = clazz.getName(); String resource = className.replace('.', '/').concat(".class"); InputStream is = null; try { is = configClassLoader.getResourceAsStream(resource); if (is == null) { throw new ClassNotFoundException(resource); } byte[] bytes = toByteArray(is); classDefinitionList.add(new AbstractMap.SimpleEntry<String, byte[]>(className, bytes)); } catch (IOException e) { ignore(e); } finally { closeResource(is); } } }

Target:
private void loadClasses() throws ClassNotFoundException { for (String className : clientUserCodeDeploymentConfig.getClassNames()) { String resource = className.replace('.', '/').concat(".class"); InputStream is = null; try { is = configClassLoader.getResourceAsStream(resource); if (is == null) { throw new ClassNotFoundException(resource); } byte[] bytes = toByteArray(is); classDefinitionList.add(new AbstractMap.SimpleEntry<String, byte[]>(className, bytes)); } catch (IOException e) { ignore(e); } finally { closeResource(is); } } }
Source:
public void pageSummary(final String title, final PageSummary.Callback cb) { Call<RbPageSummary> call = webService.pageSummary(title); call.enqueue(new Callback<RbPageSummary>() { @Override public void onResponse(Call<RbPageSummary> call, Response<RbPageSummary> response) { if (response.isSuccessful()) { responseHeaderHandler.onHeaderCheck(response); if (response.body() == null) { cb.failure(new JsonParseException("Response missing required field(s)")); } cb.success(response.body()); } else { Throwable throwable = RetrofitException.httpError(response, retrofit); RbSwitch.INSTANCE.onRbRequestFailed(throwable); cb.failure(throwable); } } @Override public void onFailure(Call<RbPageSummary> call, Throwable t) { RbSwitch.INSTANCE.onRbRequestFailed(t); cb.failure(t); } }); }

Target:
public void pageSummary(final String title, final PageSummary.Callback cb) { Call<RbPageSummary> call = webService.pageSummary(title); call.enqueue(new Callback<RbPageSummary>() { @Override public void onResponse(Call<RbPageSummary> call, Response<RbPageSummary> response) { if (response.isSuccessful()) { responseHeaderHandler.onHeaderCheck(response); if (response.body() == null) { cb.failure(new JsonParseException("Response missing required field(s)")); return; } cb.success(response.body()); } else { Throwable throwable = RetrofitException.httpError(response, retrofit); RbSwitch.INSTANCE.onRbRequestFailed(throwable); cb.failure(throwable); } } @Override public void onFailure(Call<RbPageSummary> call, Throwable t) { RbSwitch.INSTANCE.onRbRequestFailed(t); cb.failure(t); } }); }
Source:
private InterpreterResult executeSql(String sql) { int counter = 0; StringBuilder finalmessage = null; finalmessage = new StringBuilder("%table "); String projId = getProperty(PROJECT_ID); long wTime = Long.parseLong(getProperty(WAIT_TIME)); long maxRows = Long.parseLong(getProperty(MAX_ROWS)); String sqlDialect = getProperty(SQL_DIALECT, ""); Boolean useLegacySql; switch (sqlDialect) { case "standardSQL": useLegacySql = false; break; case "legacySQL": useLegacySql = true; break; default: useLegacySql = null; } Iterator<GetQueryResultsResponse> pages; try { pages = run(sql, projId, wTime, maxRows, useLegacySql); } catch (IOException ex) { logger.error(ex.getMessage()); return new InterpreterResult(Code.ERROR, ex.getMessage()); } try { while (pages.hasNext()) { finalmessage.append(printRows(pages.next())); } return new InterpreterResult(Code.SUCCESS, finalmessage.toString()); } catch (NullPointerException ex) { return new InterpreterResult(Code.ERROR, ex.getMessage()); } }

Target:
private InterpreterResult executeSql(String sql) { int counter = 0; StringBuilder finalmessage = null; finalmessage = new StringBuilder("%table "); String projId = getProperty(PROJECT_ID); long wTime = Long.parseLong(getProperty(WAIT_TIME)); long maxRows = Long.parseLong(getProperty(MAX_ROWS)); String sqlDialect = getProperty(SQL_DIALECT, "").toLowerCase(); Boolean useLegacySql; switch (sqlDialect) { case "standardsql": useLegacySql = false; break; case "legacysql": useLegacySql = true; break; default: useLegacySql = null; } Iterator<GetQueryResultsResponse> pages; try { pages = run(sql, projId, wTime, maxRows, useLegacySql); } catch (IOException ex) { logger.error(ex.getMessage()); return new InterpreterResult(Code.ERROR, ex.getMessage()); } try { while (pages.hasNext()) { finalmessage.append(printRows(pages.next())); } return new InterpreterResult(Code.SUCCESS, finalmessage.toString()); } catch (NullPointerException ex) { return new InterpreterResult(Code.ERROR, ex.getMessage()); } }
Source:
public void registerDialogWatchers() { registerWatcher( AppIsNotRespondingWatcher.class.getSimpleName(), new AppIsNotRespondingWatcher(InstrumentationRegistry.getInstrumentation())); }

Target:
private void registerDialogWatchers() { registerWatcher( AppIsNotRespondingWatcher.class.getSimpleName(), new AppIsNotRespondingWatcher(InstrumentationRegistry.getInstrumentation())); }
Source:
protected JavaMainCaller getScalaCommand() throws Exception { checkScalaVersion(); VersionNumber sv = findScalaVersion(); boolean isPreviousScala271 = (new VersionNumber("2.7.1").compareTo(sv) > 0 && !sv.isZero()); if (StringUtils.isEmpty(scaladocClassName)) { if (!isPreviousScala271) { scaladocClassName = "scala.tools.nsc.ScalaDoc"; } else { scaladocClassName = scalaClassName; } } JavaMainCaller jcmd = getEmptyScalaCommand(scaladocClassName); jcmd.addArgs(args); jcmd.addJvmArgs(jvmArgs); addCompilerPluginOptions(jcmd); if (isPreviousScala271) { jcmd.addArgs("-Ydoc"); } List<String> paths = new ArrayList<>(project.getCompileClasspathElements()); paths.remove(project.getBuild().getOutputDirectory()); if (additionalDependencies != null) { for (Dependency dependency : additionalDependencies) { addToClasspath(factory.createDependencyArtifact(dependency), paths, false); } } if (!paths.isEmpty()) jcmd.addOption("-classpath", MainHelper.toMultiPath(paths)); boolean isScaladoc2 = (new VersionNumber("2.8.0").compareTo(sv) <= 0 || sv.isZero()) && ("scala.tools.nsc.ScalaDoc".equals(scaladocClassName)); if (isScaladoc2) { jcmd.addArgs("-doc-format:html"); jcmd.addOption("-doc-title", doctitle); } else { jcmd.addOption("-bottom", getBottomText()); jcmd.addOption("-charset", charset); jcmd.addOption("-doctitle", doctitle); jcmd.addOption("-footer", footer); jcmd.addOption("-header", header); jcmd.addOption("-linksource", linksource); jcmd.addOption("-nocomment", nocomment); jcmd.addOption("-stylesheetfile", stylesheetfile); jcmd.addOption("-top", top); jcmd.addOption("-windowtitle", windowtitle); } return jcmd; }

Target:
protected JavaMainCaller getScalaCommand() throws Exception { checkScalaVersion(); VersionNumber sv = findScalaVersion(); boolean isPreviousScala271 = (new VersionNumber("2.7.1").compareTo(sv) > 0 && !sv.isZero()); if (StringUtils.isEmpty(scaladocClassName)) { if (!isPreviousScala271) { scaladocClassName = "scala.tools.nsc.ScalaDoc"; } else { scaladocClassName = scalaClassName; } } JavaMainCaller jcmd = getEmptyScalaCommand(scaladocClassName); jcmd.addArgs(args); jcmd.addJvmArgs(jvmArgs); addCompilerPluginOptions(jcmd); if (isPreviousScala271) { jcmd.addArgs("-Ydoc"); } Set<String> paths = new HashSet<>(project.getCompileClasspathElements()); paths.remove(project.getBuild().getOutputDirectory()); addAdditionalDependencies(paths); if (!paths.isEmpty()) jcmd.addOption("-classpath", MainHelper.toMultiPath(paths)); boolean isScaladoc2 = (new VersionNumber("2.8.0").compareTo(sv) <= 0 || sv.isZero()) && ("scala.tools.nsc.ScalaDoc".equals(scaladocClassName)); if (isScaladoc2) { jcmd.addArgs("-doc-format:html"); jcmd.addOption("-doc-title", doctitle); } else { jcmd.addOption("-bottom", getBottomText()); jcmd.addOption("-charset", charset); jcmd.addOption("-doctitle", doctitle); jcmd.addOption("-footer", footer); jcmd.addOption("-header", header); jcmd.addOption("-linksource", linksource); jcmd.addOption("-nocomment", nocomment); jcmd.addOption("-stylesheetfile", stylesheetfile); jcmd.addOption("-top", top); jcmd.addOption("-windowtitle", windowtitle); } return jcmd; }
Source:
private Span[] overrideDefaultType(Span[] names) { Span[] converted = new Span[names.length]; for (int i = 0; i < names.length; i++) { Span n = names[i]; if (Objects.isNull(n.getType())) { converted[i] = new Span(n.getStart(), n.getEnd(), this.defaultType, n.getProb()); } else { converted[i] = n; } } return converted; }

Target:
private Span[] overrideDefaultType(Span[] names) { for (int i = 0; i < names.length; i++) { Span n = names[i]; if (Objects.isNull(n.getType())) { names[i] = new Span(n.getStart(), n.getEnd(), this.defaultType, n.getProb()); } } return names; }
Source:
public String contents() throws IOException { try (TextFileContext context = new TextFileContext(file)) { return context.getDocument().get(); } catch (CoreException e) { } return null; }

Target:
public String contents() throws IOException { try (TextFileContext context = new TextFileContext(file)) { return context.getDocument().get(); } catch (CoreException e) { throw new IOException("error while reading file: " + file.getFullPath(), e); } }
Source:
private void annotate(RepositoryAnnotator annotator, Repository<Entity> repository, DatabaseAction action) { if (!repository.getCapabilities().contains(WRITABLE)) { throw new UnsupportedOperationException("Currently only writable repositories can be annotated"); } try { EntityType entityType = dataService.getMeta().getEntityType(repository.getName()); if (annotator instanceof EffectCreatingAnnotator) { targetMetaData = ((EffectCreatingAnnotator) annotator).getTargetEntityType(entityType); if (!dataService.hasRepository(targetMetaData.getId())) { try (Repository externalRepository = dataService.getMeta().createRepository(targetMetaData)) { permissionSystemService.giveUserWriteMetaPermissions(targetMetaData); runAsSystem(() -> dataService.getMeta().updateEntityType(externalRepository.getEntityType())); iterateOverEntitiesAndAnnotate(repository, annotator, DatabaseAction.ADD); } } else { throw new SecondRunNotSupportedException(annotator); } } else { runAsSystem(() -> dataService.getMeta() .updateEntityType( addAnnotatorMetaDataToRepositories(entityType, attributeFactory, annotator))); iterateOverEntitiesAndAnnotate(dataService.getRepository(repository.getName()), annotator, action); } } catch (CodedRuntimeException crte) { deleteResultEntity(annotator, targetMetaData); throw crte; } catch (Exception e) { deleteResultEntity(annotator, targetMetaData); throw new RuntimeException(e); } }

Target:
private void annotate(RepositoryAnnotator annotator, Repository<Entity> repository, DatabaseAction action) { if (!repository.getCapabilities().contains(WRITABLE)) { throw new UnsupportedOperationException("Currently only writable repositories can be annotated"); } try { EntityType entityType = dataService.getMeta().getEntityType(repository.getName()); if (annotator instanceof EffectCreatingAnnotator) { targetMetaData = ((EffectCreatingAnnotator) annotator).getTargetEntityType(entityType); if (!dataService.hasRepository(targetMetaData.getId())) { try (Repository externalRepository = dataService.getMeta().createRepository(targetMetaData)) { permissionSystemService.giveUserWriteMetaPermissions(targetMetaData); runAsSystem(() -> dataService.getMeta().updateEntityType(externalRepository.getEntityType())); iterateOverEntitiesAndAnnotate(repository, annotator, DatabaseAction.ADD); } } else { throw new SecondRunNotSupportedException(annotator); } } else { runAsSystem(() -> dataService.getMeta() .updateEntityType( addAnnotatorMetaDataToRepositories(entityType, attributeFactory, annotator))); iterateOverEntitiesAndAnnotate(dataService.getRepository(repository.getName()), annotator, action); } } catch (CodedRuntimeException crte) { throw crte; } catch (Exception e) { throw new RuntimeException(e); } }