id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
19,201
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); <BUG>writer.writeAttribute(Attribute.PATH.name, path.toString()); if(type != ModificationType.REMOVE) {</BUG> writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash())); } if(type != ModificationType.ADD) {
if (item.isDirectory()) { writer.writeAttribute(Attribute.DIRECTORY.name, "true"); if(type != ModificationType.REMOVE) {
19,202
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; <BUG>import org.jboss.logging.annotations.MessageBundle; import java.io.IOException;</BUG> import java.util.List; @MessageBundle(projectCode = "JBAS") public interface PatchMessages {
import org.jboss.logging.annotations.Cause; import java.io.IOException;
19,203
err.epoch_counter = epoch_counter; err.training_samples = model_info().get_processed_total(); err.validation = ftest != null; err.score_training_samples = ftrain.numRows(); err.classification = _output.isClassifier(); <BUG>hex.ModelMetrics mtrain = ModelMetrics.getFromDKV(this,ftrain); err.scored_train = new ScoredClassifierRegressor(mtrain);</BUG> if (get_params()._autoencoder) { if (printme) Log.info("Scoring the auto-encoder."); {
[DELETED]
19,204
if (printme) Log.info("Scoring the auto-encoder."); { final Frame mse_frame = scoreAutoEncoder(ftrain, Key.make()); final Vec l2 = mse_frame.anyVec(); Log.info("Mean reconstruction error on training data: " + l2.mean() + "\n"); <BUG>mse_frame.delete(); hex.ModelMetricsAutoEncoder mm1 = (ModelMetricsAutoEncoder)ModelMetrics.getFromDKV(this,ftrain); assert(err.scored_train._mse == l2.mean()); _output._training_metrics = mm1; }</BUG> if (ftest != null) {
ModelMetrics mtrain = ModelMetrics.getFromDKV(this,ftrain); //updated by model.score _output._training_metrics = mtrain; err.scored_train = new ScoredClassifierRegressor(mtrain); }
19,205
} else { if (printme) Log.info("Scoring the model."); final String m = model_info().toString(); if (m.length() > 0) Log.info(m); final Frame trainPredict = score(ftrain); <BUG>trainPredict.delete(); hex.ModelMetricsSupervised mm1 = (ModelMetricsSupervised)ModelMetrics.getFromDKV(this,ftrain); _output._training_metrics = mm1;</BUG> if (mm1 instanceof ModelMetricsBinomial) { ModelMetricsBinomial mm = (ModelMetricsBinomial)(mm1);
hex.ModelMetrics mtrain = ModelMetrics.getFromDKV(this,ftrain); _output._training_metrics = mtrain; err.scored_train = new ScoredClassifierRegressor(mtrain); hex.ModelMetrics mtest = null;
19,206
if (get_params()._score_training_samples != 0 && get_params()._score_training_samples < ftrain.numRows()) { _output._training_metrics._description = "Metrics reported on " + ftrain.numRows() + " training set samples"; } if (ftest != null) { Frame validPred = score(ftest); <BUG>validPred.delete(); hex.ModelMetrics mtest = hex.ModelMetrics.getFromDKV(this, ftest); err.scored_valid = new ScoredClassifierRegressor(mtest); if (mtest != null) { _output._validation_metrics = mtest;</BUG> if (mtest instanceof ModelMetricsBinomial) {
mtest = ModelMetrics.getFromDKV(this, ftest); _output._validation_metrics = mtest;
19,207
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
19,208
} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_memo); <BUG>ChinaPhoneHelper.setStatusBar(this,true); </BUG> topicId = getIntent().getLongExtra("topicId", -1); if (topicId == -1) { finish();
ChinaPhoneHelper.setStatusBar(this, true);
19,209
MemoEntry.COLUMN_REF_TOPIC__ID + " = ?" , new String[]{String.valueOf(topicId)}); } public Cursor selectMemo(long topicId) { Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null, <BUG>MemoEntry._ID + " DESC", null); </BUG> if (c != null) { c.moveToFirst(); }
MemoEntry.COLUMN_ORDER + " ASC", null);
19,210
MemoEntry._ID + " = ?", new String[]{String.valueOf(memoId)}); } public long updateMemoContent(long memoId, String memoContent) { ContentValues values = new ContentValues(); <BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent); return db.update(</BUG> MemoEntry.TABLE_NAME, values, MemoEntry._ID + " = ?",
return db.update(
19,211
import android.widget.RelativeLayout; import android.widget.TextView; import com.kiminonawa.mydiary.R; import com.kiminonawa.mydiary.db.DBManager; import com.kiminonawa.mydiary.shared.EditMode; <BUG>import com.kiminonawa.mydiary.shared.ThemeManager; import java.util.List; public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode { </BUG> private List<MemoEntity> memoList;
import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter; public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
19,212
private DBManager dbManager; private boolean isEditMode = false; private EditMemoDialogFragment.MemoCallback callback; private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; <BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) { this.mActivity = activity;</BUG> this.topicId = topicId; this.memoList = memoList;
public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) { super(recyclerView); this.mActivity = activity;
19,213
this.memoList = memoList; this.dbManager = dbManager; this.callback = callback; } @Override <BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { </BUG> View view; if (isEditMode) { if (viewType == TYPE_HEADER) {
public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
19,214
editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment"); } }); } } <BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private View rootView; private TextView TV_memo_item_content;</BUG> private ImageView IV_memo_item_delete;
protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private ImageView IV_memo_item_dot; private TextView TV_memo_item_content;
19,215
package ac.simons.tests.oembed; import net.sf.ehcache.CacheManager; import org.apache.http.impl.client.DefaultHttpClient; import org.junit.Assert; import org.junit.Test; <BUG>import ac.simons.oembed.DefaultOembedProvider; import ac.simons.oembed.Oembed; import ac.simons.oembed.OembedException; import ac.simons.oembed.OembedJsonParser; import ac.simons.oembed.OembedResponse;</BUG> public class ExampleTest {
import ac.simons.oembed.OembedBuilder; import ac.simons.oembed.OembedProviderBuilder; import ac.simons.oembed.OembedResponse;
19,216
import ac.simons.oembed.OembedJsonParser; import ac.simons.oembed.OembedResponse;</BUG> public class ExampleTest { @Test public void youtubeJson() throws OembedException { <BUG>final Oembed oembed = new Oembed(new DefaultHttpClient()); oembed.withProvider( new DefaultOembedProvider() </BUG> .withName("youtube")
import ac.simons.oembed.OembedProviderBuilder; import ac.simons.oembed.OembedResponse; final Oembed oembed = new OembedBuilder(new DefaultHttpClient()) .withProviders( new OembedProviderBuilder()
19,217
mCurrentLocation = location; updateMarkers(); } @Override public void onMapReady(GoogleMap map) { <BUG>mMap = map; updateMarkers();</BUG> mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { @Override public View getInfoWindow(Marker arg0) {
updateLocationUI();
19,218
mLocationRequest, this); } } @Override public void onRequestPermissionsResult(int requestCode, <BUG>@NonNull String permissions[], @NonNull int[] grantResults) { mLocationPermissionGranted = false;</BUG> switch (requestCode) { case PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION: { if (grantResults.length > 0
@NonNull String permissions[], mLocationPermissionGranted = false;
19,219
protected ClassLoader loader; protected Mode mode; protected boolean logToConsole; protected boolean logToFile; protected Level defaultLevel = Level.INFO; <BUG>protected String consoleLogFormat = "%d{HH:mm:ss.SSS} %-5p [%X{flow}|%t] %c - %m%n"; protected String fileLogFormat = "%d %-5p [%X{flow}|%t] %c - %m%n"; </BUG> public Setup(Mode mode, ClassLoader loader) {
protected String consoleLogFormat = "%d{HH:mm:ss.SSS} %-5p [%t%X{flow}] %c - %m%n"; protected String fileLogFormat = "%d %-5p [%t%X{flow}] %c - %m%n";
19,220
package sirius.kernel.health; import com.google.common.collect.Lists; import org.apache.log4j.Level; <BUG>import org.apache.log4j.Logger; import sirius.kernel.Sirius; import sirius.kernel.commons.Strings;</BUG> import sirius.kernel.di.PartCollection; import sirius.kernel.di.std.Parts;
import org.apache.log4j.MDC; import sirius.kernel.async.CallContext; import sirius.kernel.commons.Strings;
19,221
INFO(msg); } else { FINE(msg); } } <BUG>private static ThreadLocal<Boolean> frozen = new ThreadLocal<Boolean>(); private void tap(Object msg, boolean wouldLog, Level level) {</BUG> if (Boolean.TRUE.equals(frozen.get())) { return; }
private static ThreadLocal<Boolean> frozen = new ThreadLocal<>(); private void tap(Object msg, boolean wouldLog, Level level) {
19,222
frozen.set(Boolean.FALSE); } } public void INFO(String msg, Object... params) { msg = Strings.apply(msg, params); <BUG>if (logger.isInfoEnabled()) { logger.info(msg); } tap(msg, logger.isInfoEnabled(), Level.INFO);</BUG> }
fixMDC(); tap(msg, true, Level.INFO); } else { tap(msg, false, Level.INFO);
19,223
package com.liferay.portal.mobile.device.wurfl; import com.liferay.portal.kernel.mobile.device.AbstractDevice; import com.liferay.portal.kernel.mobile.device.Capability; import com.liferay.portal.kernel.mobile.device.DeviceCapabilityFilter; <BUG>import com.liferay.portal.kernel.mobile.device.Dimensions; import com.liferay.portal.kernel.util.GetterUtil;</BUG> import java.util.HashMap; import java.util.Map.Entry; import java.util.Map;
import com.liferay.portal.kernel.mobile.device.VersionableName; import com.liferay.portal.kernel.util.GetterUtil;
19,224
import java.io.InputStream; import java.net.URL; import static org.assertj.core.api.Assertions.assertThat; public class TomcatWebServerTest { @Test <BUG>public void shouldBootWebServer() throws Exception { try(WeldContainer weldContainer = new Weld().disableDiscovery()</BUG> .extensions(new ConfigurationExtension()) .beanClasses(TomcatWebServer.class, DefaultServlet.class, MessageProvider.class, WebServerConfiguration.class, DefaultConfigPropertyProducer.class)
SSLBypass.disableSSLChecks(); try(WeldContainer weldContainer = new Weld().disableDiscovery()
19,225
tomcat.start(); try(InputStream stream = new URL("http://localhost:8080/").openStream()) { String data = IOUtils.toString(stream).trim(); assertThat(data).isEqualTo(MessageProvider.DATA); } <BUG>try(InputStream stream = new URL("http://localhost:8080/rest").openStream()) { </BUG> String data = IOUtils.toString(stream).trim(); assertThat(data).isEqualTo("Hello, world!"); }
try(InputStream stream = new URL("https://localhost:8443/rest").openStream()) {
19,226
import java.io.InputStream; import java.net.URL; import static org.assertj.core.api.Assertions.assertThat; public class JettyBootTest { @Test <BUG>public void shouldBootWebServer() throws Exception { try(WeldContainer weldContainer = new Weld().disableDiscovery()</BUG> .extensions(new ConfigurationExtension()) .beanClasses(JettyWebServer.class, DefaultServlet.class, MessageProvider.class, WebServerConfiguration.class, DefaultConfigPropertyProducer.class)
SSLBypass.disableSSLChecks(); try(WeldContainer weldContainer = new Weld().disableDiscovery()
19,227
webServer.start(); try(InputStream stream = new URL("http://localhost:8080/").openStream()) { String data = IOUtils.toString(stream).trim(); assertThat(data).isEqualTo(MessageProvider.DATA); } <BUG>try(InputStream stream = new URL("http://localhost:8080/").openStream()) { </BUG> String data = IOUtils.toString(stream).trim(); assertThat(data).isEqualTo(MessageProvider.DATA); }
try(InputStream stream = new URL("https://localhost:8443/").openStream()) {
19,228
} public String getAddress() { return address; } public boolean isSecuredConfigured(){ <BUG>return securedPort != 0 && keystorePath != null && truststorePassword != null; }</BUG> public int getSecuredPort(){ return securedPort; }
public int getPort() { return port; return securedPort != 0;
19,229
import de.vanita5.twittnuker.receiver.NotificationReceiver; import de.vanita5.twittnuker.service.LengthyOperationsService; import de.vanita5.twittnuker.util.ActivityTracker; import de.vanita5.twittnuker.util.AsyncTwitterWrapper; import de.vanita5.twittnuker.util.DataStoreFunctionsKt; <BUG>import de.vanita5.twittnuker.util.DataStoreUtils; import de.vanita5.twittnuker.util.ImagePreloader;</BUG> import de.vanita5.twittnuker.util.InternalTwitterContentUtils; import de.vanita5.twittnuker.util.JsonSerializer; import de.vanita5.twittnuker.util.NotificationManagerWrapper;
import de.vanita5.twittnuker.util.DebugLog; import de.vanita5.twittnuker.util.ImagePreloader;
19,230
final List<InetAddress> addresses = mDns.lookup(host); for (InetAddress address : addresses) { c.addRow(new String[]{host, address.getHostAddress()}); } } catch (final IOException ignore) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, ignore); }</BUG> }
DebugLog.w(LOGTAG, null, ignore);
19,231
@Override public void afterExecute(Bus handler, SingleResponse<Relationship> result) { if (result.hasData()) { handler.post(new FriendshipUpdatedEvent(accountKey, userKey, result.getData())); } else if (result.hasException()) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, "Unable to update friendship", result.getException()); }</BUG> }
public UserKey[] getAccountKeys() { return DataStoreUtils.getActivatedAccountKeys(context);
19,232
MicroBlog microBlog = MicroBlogAPIFactory.getInstance(context, accountId); if (!Utils.isOfficialCredentials(context, accountId)) continue; try { microBlog.setActivitiesAboutMeUnread(cursor); } catch (MicroBlogException e) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, e); }</BUG> }
DebugLog.w(LOGTAG, null, e);
19,233
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBannerImage(fileBody); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
if (deleteImage) { Utils.deleteMedia(context, imageUri);
19,234
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBackgroundImage(fileBody, tile); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
twitter.updateProfileBannerImage(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
19,235
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); return twitter.updateProfileImage(fileBody); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
twitter.updateProfileBannerImage(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
19,236
import de.vanita5.twittnuker.annotation.CustomTabType; import de.vanita5.twittnuker.library.MicroBlog; import de.vanita5.twittnuker.library.MicroBlogException; import de.vanita5.twittnuker.library.twitter.model.RateLimitStatus; import de.vanita5.twittnuker.library.twitter.model.Status; <BUG>import de.vanita5.twittnuker.fragment.AbsStatusesFragment; import org.mariotaku.sqliteqb.library.AllColumns;</BUG> import org.mariotaku.sqliteqb.library.Columns; import org.mariotaku.sqliteqb.library.Columns.Column; import org.mariotaku.sqliteqb.library.Expression;
import org.mariotaku.pickncrop.library.PNCUtils; import org.mariotaku.sqliteqb.library.AllColumns;
19,237
context.getApplicationContext().sendBroadcast(intent); } } @Nullable public static Location getCachedLocation(Context context) { <BUG>if (BuildConfig.DEBUG) { Log.v(LOGTAG, "Fetching cached location", new Exception()); }</BUG> Location location = null;
DebugLog.v(LOGTAG, "Fetching cached location", new Exception());
19,238
import java.util.List; import java.util.Map.Entry; import javax.inject.Singleton; import okhttp3.Dns; @Singleton <BUG>public class TwidereDns implements Constants, Dns { </BUG> private static final String RESOLVER_LOGTAG = "TwittnukerDns"; private final SharedPreferences mHostMapping; private final SharedPreferencesWrapper mPreferences;
public class TwidereDns implements Dns, Constants {
19,239
for (Location location : twitter.getAvailableTrends()) { map.put(location); } return map.pack(); } catch (final MicroBlogException e) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, e); }</BUG> }
DebugLog.w(LOGTAG, null, e);
19,240
package org.xerial.snappy; import java.io.IOException; public class BitShuffleNative { <BUG>public native boolean supportBitSuffle();</BUG> public native int bitShuffle(Object input, int inputOffset, int typeSize, int byteLength, Object output, int outputOffset) throws IOException; public native int bitUnShuffle(Object input, int inputOffset, int typeSize, int byteLength, Object output, int outputOffset) throws IOException; }
[DELETED]
19,241
public ReportElement getBase() { return base; } @Override public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException { <BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false); </BUG> base.print(document, pageStream, pageNo, x, y, width); pageStream.close();
PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
19,242
public PdfTextStyle(String config) { Assert.hasText(config); String[] split = config.split(","); Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000"); fontSize = Integer.parseInt(split[0]); <BUG>font = resolveStandard14Name(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG> } public int getFontSize() { return fontSize;
font = getFont(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));
19,243
package cc.catalysts.boot.report.pdf.elements; import cc.catalysts.boot.report.pdf.config.PdfTextStyle; import cc.catalysts.boot.report.pdf.utils.ReportAlignType; import org.apache.pdfbox.pdmodel.PDPageContentStream; <BUG>import org.apache.pdfbox.pdmodel.font.PDFont; import org.slf4j.Logger;</BUG> import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import java.io.IOException;
import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.util.Matrix; import org.slf4j.Logger;
19,244
addTextSimple(stream, textConfig, textX, nextLineY, ""); return nextLineY; } try { <BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText); </BUG> float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]); if (!underline) { addTextSimple(stream, textConfig, x, nextLineY, split[0]); } else {
String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
19,245
public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { try { stream.setFont(textConfig.getFont(), textConfig.getFontSize()); stream.setNonStrokingColor(textConfig.getColor()); stream.beginText(); <BUG>stream.newLineAtOffset(textX, textY); stream.showText(text);</BUG> } catch (Exception e) { LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage()); }
stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY)); stream.showText(text);
19,246
public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { addTextSimple(stream, textConfig, textX, textY, text); try { float lineOffset = textConfig.getFontSize() / 8F; stream.setStrokingColor(textConfig.getColor()); <BUG>stream.setLineWidth(0.5F); stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset); </BUG> stream.stroke(); } catch (IOException e) {
stream.moveTo(textX, textY - lineOffset); stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
19,247
list.add(text.length()); return list; } public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) { String endPart = ""; <BUG>String shortenedText = text; List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {</BUG> String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0)); StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {
19,248
package cc.catalysts.boot.report.pdf.elements; import org.apache.pdfbox.pdmodel.PDDocument; <BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import java.io.IOException;</BUG> import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList;
import org.apache.pdfbox.pdmodel.PDPageContentStream; import java.io.IOException;
19,249
public DDMStructure addStructure( long userId, long groupId, long classNameId, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, DDMForm ddmForm, DDMFormLayout ddmFormLayout, String storageType, ServiceContext serviceContext) <BUG>throws PortalException { DDMPermissionHandler ddmPermissionHandler = DDMUtil.getDDMPermissionHandler(classNameId); DDMPermission.check( getPermissionChecker(), serviceContext.getScopeGroupId(), ddmPermissionHandler.getResourceName(classNameId), ddmPermissionHandler.getAddStructureActionId());</BUG> return ddmStructureLocalService.addStructure(
DDMStructurePermission.checkAddStruturePermission( getPermissionChecker(), groupId, classNameId);
19,250
long groupId, long parentStructureId, long classNameId, String structureKey, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, DDMForm ddmForm, DDMFormLayout ddmFormLayout, String storageType, int type, ServiceContext serviceContext) <BUG>throws PortalException { DDMPermissionHandler ddmPermissionHandler = DDMUtil.getDDMPermissionHandler(classNameId); DDMPermission.check( getPermissionChecker(), serviceContext.getScopeGroupId(), ddmPermissionHandler.getResourceName(classNameId), ddmPermissionHandler.getAddStructureActionId());</BUG> return ddmStructureLocalService.addStructure(
DDMStructurePermission.checkAddStruturePermission( getPermissionChecker(), groupId, classNameId);
19,251
public DDMStructure addStructure( long groupId, long parentStructureId, long classNameId, String structureKey, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, String xsd, String storageType, int type, ServiceContext serviceContext) <BUG>throws PortalException { DDMPermissionHandler ddmPermissionHandler = DDMUtil.getDDMPermissionHandler(classNameId); DDMPermission.check( getPermissionChecker(), serviceContext.getScopeGroupId(), ddmPermissionHandler.getResourceName(classNameId), ddmPermissionHandler.getAddStructureActionId());</BUG> return ddmStructureLocalService.addStructure(
Map<Locale, String> descriptionMap, DDMForm ddmForm, DDMFormLayout ddmFormLayout, String storageType, int type, DDMStructurePermission.checkAddStruturePermission( getPermissionChecker(), groupId, classNameId);
19,252
long userId, long groupId, String parentStructureKey, long classNameId, String structureKey, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, DDMForm ddmForm, DDMFormLayout ddmFormLayout, String storageType, int type, ServiceContext serviceContext) <BUG>throws PortalException { DDMPermissionHandler ddmPermissionHandler = DDMUtil.getDDMPermissionHandler(classNameId); DDMPermission.check( getPermissionChecker(), serviceContext.getScopeGroupId(), ddmPermissionHandler.getResourceName(classNameId), ddmPermissionHandler.getAddStructureActionId());</BUG> return ddmStructureLocalService.addStructure(
DDMStructurePermission.checkAddStruturePermission( getPermissionChecker(), groupId, classNameId);
19,253
public DDMStructure addStructure( long userId, long groupId, String parentStructureKey, long classNameId, String structureKey, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, String xsd, String storageType, int type, ServiceContext serviceContext) <BUG>throws PortalException { DDMPermissionHandler ddmPermissionHandler = DDMUtil.getDDMPermissionHandler(classNameId); DDMPermission.check( getPermissionChecker(), serviceContext.getScopeGroupId(), ddmPermissionHandler.getResourceName(classNameId), ddmPermissionHandler.getAddStructureActionId());</BUG> return ddmStructureLocalService.addStructure(
Map<Locale, String> descriptionMap, DDMForm ddmForm, DDMFormLayout ddmFormLayout, String storageType, int type, DDMStructurePermission.checkAddStruturePermission( getPermissionChecker(), groupId, classNameId);
19,254
public DDMStructure copyStructure( long structureId, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, ServiceContext serviceContext) throws PortalException { DDMStructure structure = ddmStructurePersistence.findByPrimaryKey( <BUG>structureId); DDMPermissionHandler ddmPermissionHandler = DDMUtil.getDDMPermissionHandler(structure.getClassNameId()); DDMPermission.check( getPermissionChecker(), serviceContext.getScopeGroupId(), ddmPermissionHandler.getResourceName(structure.getClassNameId()), ddmPermissionHandler.getAddStructureActionId());</BUG> return ddmStructureLocalService.copyStructure(
DDMStructurePermission.checkAddStruturePermission(
19,255
getUserId(), structureId, serviceContext); } @Override public void deleteStructure(long structureId) throws PortalException { DDMStructurePermission.check( <BUG>getPermissionChecker(), structureId, ActionKeys.DELETE); </BUG> ddmStructureLocalService.deleteStructure(structureId); } @Override
getPermissionChecker(), structureId, ActionKeys.VIEW);
19,256
public DDMTemplate addTemplate( long groupId, long classNameId, long classPK, long resourceClassNameId, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, String type, String mode, String language, String script, ServiceContext serviceContext) <BUG>throws PortalException { DDMPermissionHandler ddmPermissionHandler = DDMUtil.getDDMPermissionHandler(resourceClassNameId); DDMPermission.check( getPermissionChecker(), serviceContext.getScopeGroupId(), ddmPermissionHandler.getResourceName(classNameId), ddmPermissionHandler.getAddTemplateActionId());</BUG> return ddmTemplateLocalService.addTemplate(
DDMTemplatePermission.checkAddTemplatePermission( getPermissionChecker(), groupId, classNameId, resourceClassNameId);
19,257
long resourceClassNameId, String templateKey, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, String type, String mode, String language, String script, boolean cacheable, boolean smallImage, String smallImageURL, File smallImageFile, ServiceContext serviceContext) <BUG>throws PortalException { DDMPermissionHandler ddmPermissionHandler = DDMUtil.getDDMPermissionHandler(resourceClassNameId); DDMPermission.check( getPermissionChecker(), serviceContext.getScopeGroupId(), ddmPermissionHandler.getResourceName(classNameId), ddmPermissionHandler.getAddTemplateActionId());</BUG> return ddmTemplateLocalService.addTemplate(
DDMTemplatePermission.checkAddTemplatePermission( getPermissionChecker(), groupId, classNameId, resourceClassNameId);
19,258
public DDMTemplate copyTemplate( long templateId, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, ServiceContext serviceContext) throws PortalException { DDMTemplate template = ddmTemplatePersistence.findByPrimaryKey( <BUG>templateId); DDMPermissionHandler ddmPermissionHandler = DDMUtil.getDDMPermissionHandler(template.getResourceClassNameId()); DDMPermission.check( getPermissionChecker(), serviceContext.getScopeGroupId(), ddmPermissionHandler.getResourceName(template.getClassNameId()), ddmPermissionHandler.getAddTemplateActionId());</BUG> return ddmTemplateLocalService.copyTemplate(
DDMTemplatePermission.checkAddTemplatePermission( template.getClassNameId(), template.getResourceClassNameId());
19,259
package com.easytoolsoft.easyreport.web.controller.common; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping(value = "/error") <BUG>public class ErrorController extends AbstractController { @RequestMapping(value = {"/404"})</BUG> public String error404() { return "/error/404"; }
public class ErrorController { @RequestMapping(value = {"/404"})
19,260
return hashJar(fileDetails, hasher, classpathContentHasher); } else { return hashFile(fileDetails, hasher, classpathContentHasher); } } <BUG>private Hasher createHasher() { Hasher hasher = Hashing.md5().newHasher(); hasher.putBytes(SIGNATURE); return hasher; } private HashCode hashJar(FileDetails fileDetails, Hasher hasher, ClasspathContentHasher classpathContentHasher) { ZipFile zipFile = null;</BUG> try {
[DELETED]
19,261
if (!zipEntry.isDirectory()) { entriesByName.put(zipEntry.getName(), zipEntry); } } for (ZipEntry zipEntry : entriesByName.values()) { <BUG>visit(zipFile, zipEntry, hasher, classpathContentHasher); } return hasher.hash();</BUG> } catch (IOException e) {
hashZipEntry(zipFile, zipEntry, hasher, classpathContentHasher); return hasher.hash(); } catch (ZipException e) { DeprecationLogger.nagUserWith("Malformed jar [" + fileDetails.getName() + "] found on classpath. Gradle 5.0 will no longer allow malformed jars on a classpath."); return hashFile(fileDetails, hasher, classpathContentHasher);
19,262
package org.gradle.api.internal.changedetection.state; import com.google.common.hash.HashCode; import org.gradle.api.internal.cache.StringInterner; import org.gradle.api.internal.file.collections.DirectoryFileTreeFactory; import org.gradle.api.internal.hash.FileHasher; <BUG>import org.gradle.internal.nativeintegration.filesystem.FileSystem; import java.util.ArrayList;</BUG> import java.util.Collections; import java.util.Comparator; import java.util.List;
import org.gradle.internal.nativeintegration.filesystem.FileType; import java.util.ArrayList;
19,263
package org.openstreetmap.josm.data.coor; import static org.openstreetmap.josm.tools.I18n.trc; import static java.lang.Math.PI; <BUG>import static java.lang.Math.asin; import static java.lang.Math.cos;</BUG> import static java.lang.Math.sin; import static java.lang.Math.sqrt; import static java.lang.Math.toRadians;
import static java.lang.Math.atan2; import static java.lang.Math.cos;
19,264
} @RootTask static Task<Exec.Result> exec(String parameter, int number) { Task<String> task1 = MyTask.create(parameter); Task<Integer> task2 = Adder.create(number, number + 2); <BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh") .in(() -> task1)</BUG> .in(() -> task2) .process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\""))); }
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class) .in(() -> task1)
19,265
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { <BUG>return Task.ofType(String.class).named("MyTask", parameter) .in(() -> Adder.create(parameter.length(), PLUS))</BUG> .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, sum, fib)); }
return Task.named("MyTask", parameter).ofType(String.class) .in(() -> Adder.create(parameter.length(), PLUS))
19,266
} @RootTask public static Task<String> standardArgs(int first, String second) { firstInt = first; secondString = second; <BUG>return Task.ofType(String.class).named("StandardArgs", first, second) .process(() -> second + " " + first * 100);</BUG> } @Test public void shouldParseFlags() throws Exception {
return Task.named("StandardArgs", first, second).ofType(String.class) .process(() -> second + " " + first * 100);
19,267
assertThat(parsedEnum, is(CustomEnum.BAR)); } @RootTask public static Task<String> enums(CustomEnum enm) { parsedEnum = enm; <BUG>return Task.ofType(String.class).named("Enums", enm) .process(enm::toString);</BUG> } @Test public void shouldParseCustomTypes() throws Exception {
return Task.named("Enums", enm).ofType(String.class) .process(enm::toString);
19,268
assertThat(parsedType.content, is("blarg parsed for you!")); } @RootTask public static Task<String> customType(CustomType myType) { parsedType = myType; <BUG>return Task.ofType(String.class).named("Types", myType.content) .process(() -> myType.content);</BUG> } public enum CustomEnum { BAR
return Task.named("Types", myType.content).ofType(String.class) .process(() -> myType.content);
19,269
TaskContext taskContext = TaskContext.inmem(); TaskContext.Value<Long> value = taskContext.evaluate(fib92); value.consume(f92 -> System.out.println("fib(92) = " + f92)); } static Task<Long> create(long n) { <BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n); </BUG> if (n < 2) { return fib .process(() -> n);
TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
19,270
public NodeFirstRelationshipStage( Configuration config, NodeStore nodeStore, RelationshipGroupStore relationshipGroupStore, NodeRelationshipLink cache ) { super( "Node --> Relationship", config, false ); add( new ReadNodeRecordsStep( control(), config.batchSize(), config.movingAverageSize(), nodeStore ) ); <BUG>add( new NodeFirstRelationshipStep( control(), config.workAheadSize(), config.movingAverageSize(), nodeStore, relationshipGroupStore, cache ) ); add( new UpdateRecordsStep<>( control(), config.workAheadSize(), config.movingAverageSize(), nodeStore ) );</BUG> }
add( new RecordProcessorStep<>( control(), "LINK", config.workAheadSize(), config.movingAverageSize(), new NodeFirstRelationshipProcessor( relationshipGroupStore, cache ), false ) ); add( new UpdateRecordsStep<>( control(), config.workAheadSize(), config.movingAverageSize(), nodeStore ) );
19,271
import org.neo4j.kernel.impl.api.CountsAccessor; import org.neo4j.kernel.impl.store.NodeLabelsField; import org.neo4j.kernel.impl.store.NodeStore; import org.neo4j.kernel.impl.store.record.NodeRecord; import org.neo4j.unsafe.impl.batchimport.cache.NodeLabelsCache; <BUG>public class NodeCountsProcessor implements StoreProcessor<NodeRecord> </BUG> { private final NodeStore nodeStore; private final long[] labelCounts;
public class NodeCountsProcessor implements RecordProcessor<NodeRecord>
19,272
super.addStatsProviders( providers ); providers.add( monitor ); } @Override protected void done() <BUG>{ monitor.stop();</BUG> } @Override public int numberOfProcessors()
super.done(); monitor.stop();
19,273
import org.neo4j.kernel.impl.store.RelationshipGroupStore; import org.neo4j.kernel.impl.store.record.NodeRecord; import org.neo4j.kernel.impl.store.record.RelationshipGroupRecord; import org.neo4j.unsafe.impl.batchimport.cache.NodeRelationshipLink; import org.neo4j.unsafe.impl.batchimport.cache.NodeRelationshipLink.GroupVisitor; <BUG>public class NodeFirstRelationshipProcessor implements StoreProcessor<NodeRecord>, GroupVisitor </BUG> { private final RelationshipGroupStore relGroupStore; private final NodeRelationshipLink nodeRelationshipLink;
public class NodeFirstRelationshipProcessor implements RecordProcessor<NodeRecord>, GroupVisitor
19,274
private static final String DATASET_CAPACITY_TABLE = "dataset_capacity"; private static final String DATASET_TAG_TABLE = "dataset_tag"; private static final String DATASET_CASE_SENSITIVE_TABLE = "dataset_case_sensitivity"; private static final String DATASET_REFERENCE_TABLE = "dataset_reference"; private static final String DATASET_PARTITION_TABLE = "dataset_partition"; <BUG>private static final String DATASET_SECURITY_TABLE = "dataset_security"; </BUG> private static final String DATASET_OWNER_TABLE = "dataset_owner"; private static final String DATASET_OWNER_UNMATCHED_TABLE = "stg_dataset_owner_unmatched"; private static final String DATASET_CONSTRAINT_TABLE = "dataset_constraint";
private static final String DATASET_SECURITY_TABLE = "dataset_security_info";
19,275
throw new IllegalArgumentException( "Dataset deployment info update fail, " + "Json missing necessary fields: " + root.toString()); </BUG> } <BUG>final Object[] idUrn = findIdAndUrn(idNode, urnNode); final Integer datasetId = (Integer) idUrn[0];</BUG> final String urn = (String) idUrn[1]; ObjectMapper om = new ObjectMapper(); for (final JsonNode deploymentInfo : deployment) { DatasetDeploymentRecord record = om.convertValue(deploymentInfo, DatasetDeploymentRecord.class);
"Dataset deployment info update error, missing necessary fields: " + root.toString()); final Object[] idUrn = findDataset(root); if (idUrn[0] == null || idUrn[1] == null) { throw new IllegalArgumentException("Cannot identify dataset from id/uri/urn: " + root.toString()); final Integer datasetId = (Integer) idUrn[0];
19,276
rec.setModifiedTime(System.currentTimeMillis() / 1000); if (datasetId == 0) { DatasetRecord record = new DatasetRecord(); record.setUrn(urn); record.setSourceCreatedTime("" + rec.getCreateTime() / 1000); <BUG>record.setSchema(rec.getOriginalSchema()); record.setSchemaType(rec.getFormat()); </BUG> record.setFields((String) StringUtil.objectToJsonString(rec.getFieldSchema()));
record.setSchema(rec.getOriginalSchema().getText()); record.setSchemaType(rec.getOriginalSchema().getFormat());
19,277
datasetId = Integer.valueOf(DatasetDao.getDatasetByUrn(urn).get("id").toString()); rec.setDatasetId(datasetId); } else { DICT_DATASET_WRITER.execute(UPDATE_DICT_DATASET_WITH_SCHEMA_CHANGE, <BUG>new Object[]{rec.getOriginalSchema(), rec.getFormat(), StringUtil.objectToJsonString(rec.getFieldSchema()), "API", System.currentTimeMillis() / 1000, datasetId}); }</BUG> List<Map<String, Object>> oldInfo; try {
new Object[]{rec.getOriginalSchema().getText(), rec.getOriginalSchema().getFormat(), StringUtil.objectToJsonString(rec.getFieldSchema()), "API", System.currentTimeMillis() / 1000, datasetId});
19,278
case "deploymentInfo": try { DatasetInfoDao.updateDatasetDeployment(rootNode); } catch (Exception ex) { Logger.debug("Metadata change exception: deployment ", ex); <BUG>} break; case "caseSensitivity": try { DatasetInfoDao.updateDatasetCaseSensitivity(rootNode); } catch (Exception ex) { Logger.debug("Metadata change exception: case sensitivity ", ex);</BUG> }
[DELETED]
19,279
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.Progressable; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AFileSystem extends FileSystem {</BUG> private URI uri; private Path workingDir; private AmazonS3Client s3;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
19,280
public void initialize(URI name, Configuration conf) throws IOException { super.initialize(name, conf); uri = URI.create(name.getScheme() + "://" + name.getAuthority()); workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri, this.getWorkingDirectory()); <BUG>String accessKey = conf.get(ACCESS_KEY, null); String secretKey = conf.get(SECRET_KEY, null); </BUG> String userInfo = name.getUserInfo();
String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null)); String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
19,281
} else { accessKey = userInfo; } } AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( <BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey), new InstanceProfileCredentialsProvider(), new S3AAnonymousAWSCredentialsProvider() );</BUG> bucket = name.getHost();
new BasicAWSCredentialsProvider(accessKey, secretKey), new AnonymousAWSCredentialsProvider()
19,282
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)); </BUG> s3 = new AmazonS3Client(credentials, awsConf); <BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS); partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (partSize < 5 * 1024 * 1024) {
new InstanceProfileCredentialsProvider(), new AnonymousAWSCredentialsProvider() bucket = name.getHost(); ClientConfiguration awsConf = new ClientConfiguration(); awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS))); awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP); awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES))); awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT))); maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS)); partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE)); partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
19,283
cannedACL = null; } if (!s3.doesBucketExist(bucket)) { throw new IOException("Bucket " + bucket + " does not exist"); } <BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART); long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE); </BUG> if (purgeExistingMultipart) {
boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART)); long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
19,284
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AOutputStream extends OutputStream {</BUG> private OutputStream backupStream; private File backupFile; private boolean closed;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
19,285
this.client = client; this.progress = progress; this.fs = fs; this.cannedACL = cannedACL; this.statistics = statistics; <BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (conf.get(BUFFER_DIR, null) != null) {
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
19,286
<BUG>package org.ops4j.pax.logging.log4j2.internal; import java.util.Map;</BUG> import org.apache.logging.log4j.Level; import org.apache.logging.log4j.ThreadContext; import org.apache.logging.log4j.message.Message;
import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Map;
19,287
}</BUG> } public void debug( String message, Throwable t ) { if( isDebugEnabled() ) <BUG>{ setDelegateContext(); Message msg = m_delegate.getMessageFactory().newMessage(message); m_delegate.logMessage(m_fqcn, Level.DEBUG, null, msg, t); clearDelegateContext(); m_service.handleEvents( m_bundle, null, LogService.LOG_DEBUG, message, t );</BUG> }
if( isTraceEnabled() ) doLog( Level.TRACE, LogService.LOG_DEBUG, m_fqcn, message, t ); doLog( Level.DEBUG, LogService.LOG_DEBUG, m_fqcn, message, t );
19,288
package com.badlogic.gdx.graphics.glutils; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import com.badlogic.gdx.Gdx; <BUG>import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.utils.BufferUtils;</BUG> import com.badlogic.gdx.utils.GdxRuntimeException; public class ImmediateModeRenderer { private int primitiveType;
import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.BufferUtils;
19,289
package com.teamwizardry.wizardry.common.world; import com.teamwizardry.wizardry.init.ModBlocks; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; <BUG>import net.minecraft.init.Biomes; </BUG> import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World;
import com.teamwizardry.wizardry.common.entity.EntityFairy; import net.minecraft.init.Blocks;
19,290
ChunkPrimer chunkprimer = new ChunkPrimer(); generate(x, z, chunkprimer); Chunk chunk = new Chunk(world, chunkprimer, x, z); byte[] biomeArray = chunk.getBiomeArray(); for (int i = 0; i < biomeArray.length; ++i) { <BUG>biomeArray[i] = (byte) Biome.getIdForBiome(Biomes.PLAINS); }</BUG> chunk.generateSkylightMap(); return chunk; }
biomeArray[i] = (byte) 42;
19,291
return false; } @NotNull @Override public List<Biome.SpawnListEntry> getPossibleCreatures(@NotNull EnumCreatureType creatureType, @NotNull BlockPos pos) { <BUG>return Collections.emptyList(); }</BUG> @Nullable @Override public BlockPos getStrongholdGen(@NotNull World worldIn, @NotNull String structureName, @NotNull BlockPos position) {
ArrayList<Biome.SpawnListEntry> list = new ArrayList<>(); list.add(new Biome.SpawnListEntry(EntityFairy.class, 1, 1, 3)); return list;
19,292
import com.teamwizardry.wizardry.common.entity.EntityDevilDust; import com.teamwizardry.wizardry.common.entity.EntityFairy; import com.teamwizardry.wizardry.common.entity.EntitySpellCodex; import com.teamwizardry.wizardry.common.tile.TilePedestal; import com.teamwizardry.wizardry.init.ModBlocks; <BUG>import com.teamwizardry.wizardry.init.ModItems; import net.minecraft.entity.item.EntityItem;</BUG> import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items;
import com.teamwizardry.wizardry.init.ModPotions; import net.minecraft.entity.item.EntityItem;
19,293
public void onFallDamage(LivingHurtEvent event) { if (!(event.getEntity() instanceof EntityPlayer)) return; if (event.getSource() == EntityDamageSource.outOfWorld) { EntityPlayer player = ((EntityPlayer) event.getEntityLiving()); BlockPos spawn = player.isSpawnForced(0) ? player.getBedLocation(0) : player.world.getSpawnPoint().add(player.world.rand.nextGaussian() * 16, 0, player.world.rand.nextGaussian() * 16); <BUG>BlockPos teleportTo = spawn.add(0, 255 - spawn.getY(), 0); </BUG> TeleportUtil.teleportToDimension((EntityPlayer) event.getEntity(), 0, teleportTo.getX(), teleportTo.getY(), teleportTo.getZ()); event.getEntity().fallDistance = -500; event.setCanceled(true);
BlockPos teleportTo = spawn.add(0, 300 - spawn.getY(), 0);
19,294
if (event.getEntity().fallDistance >= 250) { BlockPos location = event.getEntity().getPosition(); BlockPos bedrock = PosUtils.checkNeighbor(event.getEntity().getEntityWorld(), location, Blocks.BEDROCK); if (bedrock != null) { if (event.getEntity().getEntityWorld().getBlockState(bedrock).getBlock() == Blocks.BEDROCK) { <BUG>TeleportUtil.teleportToDimension((EntityPlayer) event.getEntity(), Wizardry.underWorld.getId(), 0, 100, 0); fallResetUUIDs.add(event.getEntity().getUniqueID());</BUG> ((EntityPlayer) event.getEntity()).addStat(Achievements.CRUNCH); event.setCanceled(true);
TeleportUtil.teleportToDimension((EntityPlayer) event.getEntity(), Wizardry.underWorld.getId(), 0, 300, 0); ((EntityPlayer) event.getEntity()).addPotionEffect(new PotionEffect(ModPotions.NULLIFY_GRAVITY, 100, 1, false, false)); fallResetUUIDs.add(event.getEntity().getUniqueID());
19,295
if (event.getEntityPlayer().fallDistance >= 250) { BlockPos location = event.getEntityPlayer().getPosition(); BlockPos bedrock = PosUtils.checkNeighbor(event.getEntity().getEntityWorld(), location, Blocks.BEDROCK); if (bedrock != null) { if (event.getEntity().getEntityWorld().getBlockState(bedrock).getBlock() == Blocks.BEDROCK) { <BUG>TeleportUtil.teleportToDimension(event.getEntityPlayer(), Wizardry.underWorld.getId(), 0, 100, 0); fallResetUUIDs.add(event.getEntityPlayer().getUniqueID());</BUG> event.getEntityPlayer().addStat(Achievements.CRUNCH); }
TeleportUtil.teleportToDimension(event.getEntityPlayer(), Wizardry.underWorld.getId(), 0, 300, 0); ((EntityPlayer) event.getEntity()).addPotionEffect(new PotionEffect(ModPotions.NULLIFY_GRAVITY, 100, 1, false, false)); fallResetUUIDs.add(event.getEntityPlayer().getUniqueID());
19,296
package com.teamwizardry.wizardry.common.world; <BUG>import com.teamwizardry.wizardry.Wizardry; import net.minecraft.client.Minecraft;</BUG> import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator;
import com.teamwizardry.wizardry.common.world.biome.BiomeUnderWorld; import net.minecraft.client.Minecraft;
19,297
ModBlocks.init(); Achievements.init(); Fluids.preInit(); ModEntities.init(); ModPotions.init(); <BUG>ModCapabilities.preInit(); WizardryPacketHandler.registerMessages();</BUG> NetworkRegistry.INSTANCE.registerGuiHandler(Wizardry.instance, new GuiHandler()); ModStructures.INSTANCE.getClass(); Wizardry.underWorld = DimensionType.register("underworld", "_dim", Config.underworld_id, WorldProviderUnderWorld.class, false);
ModBiomes.init(); WizardryPacketHandler.registerMessages();
19,298
} @RootTask static Task<Exec.Result> exec(String parameter, int number) { Task<String> task1 = MyTask.create(parameter); Task<Integer> task2 = Adder.create(number, number + 2); <BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh") .in(() -> task1)</BUG> .in(() -> task2) .process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\""))); }
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class) .in(() -> task1)
19,299
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { <BUG>return Task.ofType(String.class).named("MyTask", parameter) .in(() -> Adder.create(parameter.length(), PLUS))</BUG> .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, sum, fib)); }
return Task.named("MyTask", parameter).ofType(String.class) .in(() -> Adder.create(parameter.length(), PLUS))
19,300
final String instanceField = "from instance"; final TaskContext context = TaskContext.inmem(); final AwaitingConsumer<String> val = new AwaitingConsumer<>(); @Test public void shouldJavaUtilSerialize() throws Exception { <BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39) .process(() -> 9999L); Task<String> task2 = Task.ofType(String.class).named("Baz", 40) .in(() -> task1)</BUG> .ins(() -> singletonList(task1))
Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class) Task<String> task2 = Task.named("Baz", 40).ofType(String.class) .in(() -> task1)